VMware Cloud Community
jzee1
Contributor
Contributor

Error when attempting to reconnect host to vCenter

Running vCenter 6.5, ESXi 6.5

I was using a 30-day evaluation license for vCenter Server.  When my evaluation period expired, all of my hosts disconnected from vCenter.  I just purchased a vCenter Server license and installed the key.  Now when I attempt to reconnect my host, I'm met with the following error message:

A general system error occurred: Error[VdbODBCError] (-1) "ODBC error: (23505) - ERROR: duplicate key value violates unique constraint "pk_vpx_vm_virtual_device";

Error while executing the query" is returned when executing SQL statement "INSERT INTO VPX_VM_VIRTUAL_DEVICE (ID, DEVICE_KEY, CONN_AL_GU_CONTROL_FLAG, CONN_CONNECTED_FLAG, CONN_START_CONNECTED_FLAG, CONN_STATUS, DEVICE_INFO_SUMMARY, DEVICE_INFO_LABEL, DEVICE_CONTROLLER_KEY, DEVICE_UNIT_NUMBER, DEVICE_TYPE, DEVICE_TEXT) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"

I suppose I have two questions:

  1. Why am I getting this error message and how can I fix it?
  2. If I cannot fix this error, if I remove the host from inventory will I be able to re-add it without any problems?  The message I get when I go to remove the disconnected host gives a very scary warning message that all of my VMs on the host will be removed.  I would just like to be assured that my host will not be altered and my VMs will not be deleted!

Thank you

0 Kudos
6 Replies
daphnissov
Immortal
Immortal

You may want to see this thread for more information. You may (and probably should) reconsider deploying a Windows-based vCenter as it's not long for this Earth.

0 Kudos
jzee1
Contributor
Contributor

Thanks daphnissov,

Unfortunately, right now I'm just in scramble mode to try to get vCenter back up as soon as possible.  I need to be able to use some of the vCenter functionality (specifically PCI device passthrough) in a couple of days from now.  I have about 30 VMs on my ESXi host that I don't want to rebuild, and have no reliable options for backing them up now that vCenter is hosed.

Would you be able to comment on the option of "Remove from inventory" from vCenter then re-adding the host?  Will selecting "Remove from inventory" actually unregister all of my VMs on my host, or just unregister them on vCenter?  If the latter is the case, they should re-register when I re-add the host to vCenter, right?    

0 Kudos
daphnissov
Immortal
Immortal

No, if you remove an ESXi host from inventory it only removes that host and the VMs which reside upon it from ​vCenter's​ inventory. It doesn't touch the ESXi host or alter the VMs in any way.

0 Kudos
Vijay2027
Expert
Expert

Take a look at postgresql.log and identify the duplicate key.

For example:

VCDB vc ERROR:  duplicate key value violates unique constraint "pk_vpx_vm_virtual_device"

VCDB vc DETAIL:  Key (id, device_key)=(361, 3002) already exists.

To remove duplicate Key:: DELETE FROM vpx_vm_virtual_device where id='xxx' and device_key='xxxx';

Take a snapshot before you proceed with this.

DELETE FROM vpx_vm_virtual_device where id='xxx' and device_key='xxxx';

Take a snapshot befoe you make any changes.

0 Kudos
Vijay2027
Expert
Expert

To connect to DB:

Windows:

VMware Knowledge Base

appliance:

VMware Knowledge Base

0 Kudos
Yuva_1990
Hot Shot
Hot Shot

Hi

Please helps us with postgresql.log  for further investigation

Regards

Yuvaraj

0 Kudos