vCenter Server 7.0
vCenter Server 8.0
This issue can occur when there are still other inventory objects of the datacenter registered in vCenter, such as a datastore, an ESXi host or a virtual machine.
To solve this problem, first ensure that you have created a fresh backup or snapshot of the vCenter Server Appliance.
In case the vCenter is a member of an Enhanced Linked Mode replication group, please be aware that you need to have backups of all nodes. Should you decide to use snapshots instead, please ensure that offline snapshots (as in snapshots in powered off state) have been created of all ELM members. In case you need to restore, you must restore all of the ELM members, or otherwise the linked mode replication will break.
To identify, if there are any leftover objects nested in the datacenter you want to delete, you can use the following command in the BASH of the vCenter Server Appliance, where you replace <datacenter> with the actual name of your datacenter:
# psql -d VCDB -U postgres -c "select * from vpx_entity where parent_id in ( select id from vpx_entity where parent_id in ( select id from vpx_entity where name like '<datacenter>' ));"
If you cannot identify the type of the blocking object by its name, you can use the type_id column to see what kind it is. A list of all type_id values with their specific object types can be found in the vpx_object_type table. Just run the following command to get this list:
# psql -d VCDB -U postgres -c "select * from vpx_object_type;"
Once you have identified the blocking inventory object, use the vSphere Client to delete it.
In the vCenter inventory structure other objects like VMs, Hosts or Datastores are never direct child objects of a datacenter. Instead every datacenter has 4 folder objects nested directly under it, which are called:
These 4 folder objects are reflected in vSphere client by the tabs on the left-hand side in the inventory view of the client:
Any other inventory objects will be a child object of its specific folder (hosts and clusters are nested under host, virtual machines under vm etc.). Hence to query the inventory table vpx_entity, you need to filter for child objects of child objects, result in the more complex query shown above.