IBM Support

Migrate-export command error SQLSTATE=42601

Technical Blog Post


Abstract

Migrate-export command error SQLSTATE=42601

Body

Migrate-export command error SQLSTATE=42601

The migrate-export command can be used to take a backup of the TEPS database, and this should be done regularly.

see this blog for information on that:

https://www.ibm.com/support/pages/node/1084227

( Migrate-export and backing up your TEPS database. )

However there was a report that when the migrate-export  was done that the saveexport.sql file (which is the file that is created from the command) was empty.

Each time the command is run, the migrate.log is created in the logs directory.  
Note: this log is over written by the next run as is the saveexport.sql file.

The migrate.log showed an SQLSTATE=42601 error.

The file in this case  looks something like this:

***** STEP export.1 *****
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /f /opt/IBM/ITM/li6263/cq/sqllib/migrate-clean.sql
***** STEP export.2 *****
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /f /opt/IBM/ITM/li6263/cq/sqllib/seed-0-I.sql
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /f /opt/IBM/ITM/li6263/cq/sqllib/seed-0.sql
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /f /opt/IBM/ITM/li6263/cq/sqllib/seed-4.sql
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /e DELETE FROM KFWTOPO;
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /e DELETE FROM KFWPARMA;
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /d KFW_DSN /e DELETE FROM KFWSOUND;
***** STEP export.3 *****
/opt/IBM/ITM/li6263/cq/bin/KfwSQLClient /n /x /r /opt/IBM/ITM/li6263/cq/sqllib/saveexport.sql /z /a KFW_DSN /d KFW_DSN /k /t /opt/IBM/ITM/li6263/cq/sqllib/export.parms
Unable to execute request.
---> name = Error result:
-----> -2101a = -1 L
-----> -2102 = "[IBM][CLI Driver][DB2/LINUX] SQL0104N An unexpected token "Freddie" was found following "xtem~NODE~a2f8907@'". Expected tokens may include: "CONCAT". SQLSTATE=42601, GENERIC SQLSTATE: 42601, ERR: -104
SQLExecDirect rc=-1: SQL_ERROR"
Exception CTPropertyException -- exiting
---> name = SQL Exception
-----> -2101a = -1 L

this shows that there is a corruption in the database.

In this case the problem was with the WSGALLERY related records, and you can safely remove all these records (WSGALLERY)  from the TEPS DB using the KfwSQLClient or DB2 command-line tools.

It was possible to fix with these steps:

1) Stop the TEPS.
2) Take a db2 back up of TEPS database.
3) Create a file in /tmp that contains the two lines:
DELETE FROM KFWPRESDEF WHERE PRESENTATIONID LIKE 'WSGALLERY%'
DELETE FROM KFWPRESENTATION WHERE REQUESTTYPE LIKE 'WSGALLERY%'
save as myqueries.sql
4) run the command from /tmp:
itmcmd execute cq "KfwSQLClient -f myqueries.sql"

5) run migrate-export
6) restart TEPS.
If you do not want to use KfwSQLClient then request your database administrator to run the sql given.

Always take a DB2 copy of the database before doing any tasks like this, so the database can be restored if there are any problems.
If you are unsure of any steps talk to ITM Support first.

[{"Business Unit":{"code":"BU004","label":"Hybrid Cloud"},"Product":{"code":"","label":""},"Component":"","Platform":[{"code":"","label":""}],"Version":"","Edition":""},{"Business Unit":{"code":"BU050","label":"BU NOT IDENTIFIED"},"Product":{"code":"SSZ8F3","label":"IBM Tivoli Monitoring V6"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":""}]

UID

ibm11083321