Troubleshooting: Database migration fails due to categories not associated with stores

During database migration from a previous version of WebSphere Commerce to WebSphere Commerce Version 7, you encounter an error that states there are some categories that are not associated with any stores in the database. This error causes database migration to fail.

Problem

This error occurs in the database check step during database migration. The error appears similar to the following:
INFO: [wcimDBCheckingTask] select count(catgroup_id) from catgroup where catgroup_id not in (select catgroup_id from storecgrp) and catgroup_id<>0
WARNING: [wcimDBCheckingTask] there are some categories that are not associated with any stores.
ERROR: BUILD FAILED
The error message indicates that all the catalog groups in the CATGROUP table should be referred by the STORECGRP table.

Solution

To fix the problem:
  1. Restore the previous database to the WebSphere Commerce Version 7 environment by manually issuing the database restore command.
  2. Run the following SQL statement for the restored database in the WebSphere Commerce Version 7 environment:
    select count(catgroup_id) from catgroup where catgroup_id not in (select catgroup_id from storecgrp) and catgroup_id<>0
    This will return a list of the catalog group IDs that are not associated with any store.
  3. For each of the catalog node IDs listed in Step 2, choose an existing store in database to associate the catalog node ID with. For each catalog node ID, insert the following into the STORECGRP table:
    <storeent_id, catgroup_id>
  4. After you have associated all of the catalog node IDs with an existing store, try again to migrate the database.