VMware Cloud Community
Rebelno1
Enthusiast
Enthusiast

db seems corrupted

Hi guys hoping you can help me today

my vCenter services has stopped when i look at the vpxd.log i saw the errors

info 'Default'] Creating SSL Contexts

error 'vpxdvpxdDatastore'] Duplicate name (H2o1) in datastore folder

error 'vpxdvpxdMain'] [Vpxd::ServerApp::Init] Init failed: VpxdDatastore::Init(gDB)

--> Backtrace:

--> backtrace[00] rip 000000018018b7fa

--> backtrace[01] rip 0000000180104c78

--> backtrace[02] rip 0000000180105f6e

--> backtrace[03] rip 000000018008ff08

--> backtrace[04] rip 0000000001125bac

--> backtrace[05] rip 0000000001146722

So I open my database and try to find these duplicate ID's

and run a select * from vpx_entity where NAME='H2o1'

and see two duplicate id's

11305

31289

and try to delete the largest as suggested in many articles on the web  as this is more likely the latest invalid ID   running this command

DELETE FROM VPX_ENTITY WHERE ID = 31289;

but i get this error

The DELETE statement is in conflict with the REFERENCE constraint " FK_VPX_DS_A_REF_VPX_DATA " . The conflict occurred in database " VCDB " table " dbo.VPX_DS_ASSIGNMENT " column ' DS_ID ' .

The statement has been terminated

I cannot delete this entry for some reason can anyone let me know hopefully there is SQL expert among you

what i need to do to get this duplicate ID out as I have not got a back up of the database so i cannot afford to lose this one .

please help !

Thanks in advance

0 Kudos
2 Replies
ThompsG
Virtuoso
Virtuoso

Hi there,

This is probably a dumb question as I'm sure you have tried already: Have you tried deleting the lower ID instead?

Kind regards.

0 Kudos
Ajay1988
Expert
Expert

Run in the below order . This is because of dependencies between tables.

delete from VPX_DS_ASSIGNMENT where DS_ID=31289;

delete from VPX_VM_DS_SPACE where DS_ID=31289;

delete from VPX_DATASTORE where ID=31289;

delete from VPX_ENTITY where ID=31289;

If you think your queries have been answered
Mark this response as "Correct" or "Helpful".

Regards,
AJ
0 Kudos