IBM Support

DB2MOVE COPY option fails with SQL0601N error message

Troubleshooting


Problem

The db2move utility with the COPY option fails with SQL0601N error message indicating that the objects and packages being moved already exists.

Symptom

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  *****

Action:  COPY
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).

Files generated:
-----------------
COPYSCHEMA.20100301130628.msg

Please delete these files when they are no longer needed.

**Error occured -1

Cause

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.

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Data Movement - db2move","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.7;9.5;9.1","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21422641