DB2MOVE COPY option fails with SQL0601N error message
The db2move utility with the COPY option fails with SQL0601N error message indicating that the objects and packages being moved already exists.
If the target database already exists with existing objects and packages with the target schema name db2move will generate a SQL0601N error messages indicating it already exists.
db2move DBSRC COPY -sn schema1 -co TARGET_DB DBTGT user myuser1 using mypass1 SCHEMA_MAP "((SCHEMA1,NEWSCHEMA1))"
***** DB2MOVE *****
Start time: Mon Mar 1 13:06:28 2010
All schema names matching: V97FP1;
Connecting to database DBSRC ... successful! Server : DB2 Common Server V9.7.1
Copy schema DBSRC to DBTGT on the target database DBTGT
Rolled back all changes from the create phase (debuginfo:110).
Error Message : sqlcode -601:Create Schema "GSAM"
db2move failed with -1 (debuginfo:220).
Please delete these files when they are no longer needed.
**Error occured -1
There is a restriction with db2move -CO (copy option) that the new target schema cannot exist. The main reason for this is that the logic that determines which order to recreate the objects to satisfy dependencies will only examine objects in the source schema, not any preexisting objects in the target schema. The option was never intended to be a merge/append kind of schema copy. So the target schema cannot exist.
Resolving the problem
To verify that the schema name does exist, run the following selects in the target database changing <SCHEMA_NAME> to the schema name in question.
SELECT S.SCHEMANAME, S.OWNER, A.GRANTOR, A.GRANTEE
FROM SYSCAT.SCHEMATA S, SYSCAT.SCHEMAAUTH A
WHERE S.SCHEMANAME=A.SCHEMANAME AND S.SCHEMANAME
NOT IN 'SYSIBM','SYSFUN','SYSCAT','SYSSTAT','NULLID','SYSPROC','SQLJ','SYSTOOLS','SYSPUBLIC');
SELECT TABLE_SCHEM from SYSIBM.SQLSCHEMAS WHERE TABLE_SCHEM = '<SCHEMA_NAME>'
Issue a drop schema command before performing the copy schema using the ADMIN_DROP_SCHEMA procedure.
More support for:
DB2 for Linux, UNIX and Windows
Data Movement - db2move
Software version: 9.1, 9.5, 9.7
Operating system(s): AIX, HP-UX, Linux, Solaris, Windows
Reference #: 1422641
Modified date: 18 November 2015