Database in-place upgrade failed. Please see vcdb_inplace.err and vcdb_inplace.out for details.
1 [23505](1) ERROR: could not create unique index "pk_vpx_dual"
DETAIL: Key (dummy)=() is duplicated.;
Error while executing the query
Error while executing ./Upgrade-v2017-to-v2018/postgresql/upgrade_PostgreSQL.sql, reason: Statement failure(rc=-1).
or
1 [23505](1) ERROR: could not create unique index "pk_vpx_lock"
DETAIL: Key (id)=(0) is duplicated.;
Error while executing the query
vCenter Server 7.0X
vCenter Server 8.0X
This issue occurs when the vCenter database contains a duplicate value, specifically when the table vc.vpx_dual or vc.vpx_lock has more than one row. This table is supposed to contain only one row, any more will violate its key constraint.
To solve this issue, clean out the vCenter database table vc.vpx_dual or vc.vpx_lock in the source appliance, and retry the upgrade. To achieve this, apply the steps below:
Note: please ensure that a fresh backup of the vCenter Server Appliance exists before attempting to make any changes to the vCenter database.
# service-control --stop vmware-vpxd
# psql -d VCDB -U postgres
SELECT * FROM VPX_DUAL;
SELECT * FROM VPX_LOCK;
DELETE FROM VPX_DUAL;
INSERT INTO VPX_DUAL VALUES('X');
or
DELETE FROM VPX_LOCK;
INSERT INTO VPX_LOCK VALUES('0');
\q
# service-control --start vmware-vpxd