Troubleshooting: Cannot count number of records

You are attempting to migrating a database from a previous version of WebSphere Commerce to WebSphere Commerce Version 7, but the database migration fails with an error. The error says that the migration operation was unable to accurately count the number of records in a very large database table.

Problem

The following example shows what the message looks like if the migration operation is unable to count the records for a table called WCSDBADM.BUSAUDIT:
[2011.10.20.21.29.36] VERBOSE:  checkDatabase:
[2011.10.20.21.29.36] VERBOSE:  -checkFromParam:
[2011.10.20.21.29.36] INFO:     [wcimDBCheckingTask] SET SCHEMA WCSDBADM
[2011.10.20.21.29.36] INFO:     [wcimDBCheckingTask] select count(*) from BUSAUDIT
[2011.10.20.21.30.12] ERROR:    BUILD FAILED
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/build.xml:32: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/build.xml:44: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/db.xml:2: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/db.xml:9: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/build.xml:56: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/build.xml:60: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/features/BASE/db/common.xml:2: The following error occurred while executing this line:
[2011.10.20.21.30.12] ERROR:    /opt/IBM/WebSphere/CommerceServer70/migration/xml/features/BASE/db/common.xml:8: com.ibm.db2.jcc.am.SqlDataException: DB2 SQL Error: SQLCODE=-
802, SQLSTATE=22003, SQLERRMC=null, DRIVER=4.12.55
[2011.10.20.21.30.12] ERROR:    Total time: 37 seconds
[2011.10.20.21.30.12] ERROR:    [WCIMANT] <run> WCIM has completed the job(s) with errors. Check the log files for details.
[2011.10.20.21.30.47] INFO:     [WCIMUtil] <quit> Stopping server.

Solution

To solve the problem:
  1. Restore the previous database to the WebSphere Commerce Version 7 environment by manually issuing the database restore command.
  2. Export the data from the specific table for which the database migration operation is unable to retrieve a record count.
  3. Delete the data from the specific table mentioned in Step 2.
  4. Try again to migrate the database.
  5. After the database migration completes successfully, if the data you exported in Step 2 is still needed, import it back into the table.