Troubleshooting: Database migration fails due to database user mismatch

During the migration of your HCL Commerce database, a permissions error (SQLCODE=-551) is encountered when running the database migration.

Problem

During the migration of your HCL Commerce database, a permissions error (SQLCODE=-551) is encountered when running the database migration.

For example, running the wcim_ant command in a manner similar to the following:
./wcim_ant.sh -tier db -action migrate -from 80 -instanceName demo -isStaging true -defaultTablespace yes
Produces an error similar to the following:
com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-551, SQLSTATE=42501, SQLERRMC=WCS;REPLACE TRIGGER;WCS.PERF_PX8, DRIVER=4.19.66

Solution

In this case, triggers that are present in the database were created and are owned by a database user other than the schema owner. This mismatch of ownership of the triggers causes the failure, and must be changed to successfully complete the migration.

For example, use the following SQL to transfer the ownership of the trigger PERF_PX8 to the WCS user.
TRANSFER OWNERSHIP OF TRIGGER PERF_PX8 TO USER WCS;

Once all problematic triggers are re-assigned to the appropriate user, re-run the database migration.