Troubleshooting data migration from SQL Server to Db2

When you migrate data from SQL Server to Db2, you might experience issues with operation not allowed, DBMS_STATS.GATHER_SCHEMA_STATS commands, and custom expressions.

Operation not allowed

If you encounter the following error when you migrate data:
SQL0668N Operation not allowed for reason code "1" on table "RICALM.RQRMENT_DECIMAL_EXT". SQLSTATE=57007
Try the following option:
  • Verify whether any table is in Integrity Pending No Access State by using the following command:
    SELECT TABNAME, TABSCHEMA, STATUS FROM SYSCAT.TABLES WHERE STATUS ='C' AND TABSCHEMA IN ('CONFIG','RICALM','RIDW','RIODS','RITRS');
  • In case there is any result that is generated, mark those tables with Integrity Checked. Save the following script in setIntegrityChecked.sql file in SQLLIB\BIN folder:
    BEGIN
    FOR v_row AS SELECT TABSCHEMA, TABNAME FROM SYSCAT.TABLES WHERE
    STATUS = 'C' AND TABSCHEMA IN 
    ('CONFIG','RICALM','RIDW','RIODS','RITRS') 
    DO
    EXECUTE IMMEDIATE 'SET INTEGRITY FOR '|| TRIM(v_row.TABSCHEMA) 
    ||'.'|| TRIM(v_row.TABNAME) || ' IMMEDIATE CHECKED';
    END FOR;
    END@
  • Run the following command in Db2 Command Window:
    db2 -td@ -vf C:\IBM\SQLLIB\BIN\setIntegrityChecked.sql

Custom expression errors

Reports that use custom expressions for SQL Server might encounter errors in Db2. In this case, you can fix the reports manually by fixing the custom expressions for Db2.

Ready-to-copy reports

After migration, the duplicated reports from Ready-to-Copy reports must be deleted and the Ready-to-use reports must be reimported from the Admin section. Duplicate and save the reimported reports for the proper data after migration.