Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Upgrading VMware vCloud Usage Meter to version 2.3.2 fails with 'Foreign Key Constraint' errors (2041766)

Symptoms

  • You cannot upgrade to vCloud Usage Meter 2.3.2 from earlier versions.
  • After upgrading vCloud Usage Meter, data migration takes a very long time. 
  • You receive foreign key constraint errors in relation to the Collection table.
  • You receive an error similar to the following: 

    java.lang.RuntimeException: Exception while executing statement : ERROR: insert or update on table "Collection" violates foreign key constraint "CollectionFK5" Detail: Key (vcServerId)=(1) is not present in table "VcServer". errorCode: 0, sqlState: 23503 insert into "Collection" ("id", "stop", "vcServerId", "ok", "start") values (nextval('"s_Collection_id"'),?,?,?,?)

Cause

The constraint CollectionFK5 is a constraint that presents between the Collection, Sample and VCServer table. This issue occurs when Usage Meter tries to migrate data belonging to a Virtual Center that is no longer present in the VcServer table.

Note: If you want to migrate to vCloud Usage Meter 3.0, you must upgrade from vCloud Usage Meter 2.3.2. 

Resolution

To resolve this issue, you must manually purge the conflicting data from the Usage Meter database.
  • To determine the cause of this conflict, run this select statement on the database:

    select * from "Host";
    select * from "Collection" where "VcID" IS NOT IN (X,Y,Z);

    Note: X,Y and Z are the VcID values taken from the select statement on the Host table.

    For information on connecting to the database, see the Additional Information section below.

  • Remove the data from both the Sample and Collection table:

    delete from "Sample" where "VcID" IS NOT IN (X,Y,Z);
    delete from "Collection" where "VcID" IS NOT IN (X,Y,Z);

  • Run the migrate option. Samples should be carried over. 

    Note: Apply Usage Meter 2.3.2.1 update9 to the vCloud Usage Meter before migrating data. If you do not have this update, please contact VMware support.

Additional Information

To connect to the vCloud Usage Meter database:
  1. su - postgres (change to the postgres user).
  2. psql -d usage_meter_db (this is the current database).
  3. psql -d um22 (this is the legacy database that is created during the migration process).
     Note: This is the table you will run the statements on above. If you are unsure of the table names, run '\d' to list all of
     the tables.

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 0 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 0 Ratings
Actions
KB: