db2move import fails with SQL3201N due to foreign key definitions
db2scope 310002R9XW Visits (742)
After using "db2move mydb export", running command "db2move mydb import" returns error SQL3201N.
The following is an example from the output :
* IMPORT: table "DB2INST1"."TAB1"
***ERROR -3201. Check message file tab59.msg!
*** SQLCODE: -3201 - SQLSTATE:
*** SQL3201N The specified table cannot be replaced because another table is dependent on it.
* IMPORT: table "DB2INST1"."TAB2"
WARNING 3107. Check message file tab60.msg!
*** SQL Warning! SQLCODE is 3107
*** SQL3107W At least one warning message was encountered during LOAD processing.
-Rows read: 100
The error was foreign keys defined on the child tables. You can work around the error in this way:
1) First disable constraints and then execute db2move import.
db2 ALTER TABLE childtblname ALTER FOREIGN KEY fkname NOT ENFORCED
2) After imported data into tables , re-enable constraints
db2 ALTER TABLE childtblname ALTER FOREIGN KEY fkname ENFORCED