org.hibernate.NonUniqueResultException: query did not return a unique result: 2
VCD: 10.3, 10.4, 10.5, 10.6
TCP: 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1
computevm database table.UNDEPLOYED state while a newer, active record exists for the exact same object.Establish an SSH session to the primary node as root and log into the VCD database:sudo -i -u postgres psql -d vcloud
Identify the specific object causing the conflict by reviewing the job details:SELECT * FROM jobs WHERE object = '[Object_Name]';SELECT * FROM job_detail WHERE job_id = '[Job_UUID]';
Execute a query to isolate which VM MoRefs have more than one entry:SELECT id, vmmoref, vc_id, deployment_status
FROM (
SELECT id, vmmoref, vc_id, deployment_status,
COUNT(*) OVER (PARTITION BY vc_id, vmmoref) as count
FROM computevm
) sub
WHERE count > 1
ORDER BY vmmoref;
Query the duplicate rows using the specific vmmoref found in the previous step (for example, vm-####):SELECT * FROM computevm WHERE vmmoref = 'vm-1234';Review the output to target the stale record. The invalid row is typically marked as UNDEPLOYED while the valid active row is marked as DEPLOYED.
Delete the specific stale row using its unique ID:DELETE FROM computevm WHERE id = '[ID from step 3]';