Copying schema using "db2move COPY -co " command not working

603 Views Asked by At

I am connected to database tp2 trying to copy its schema "s2" to another database tp3 by using command {db2move tp2 COPY -sn s2 -co TARGET_DB tp3 USER db2inst1 USING password}

Error is something like this

Application code page not determined, using ANSI codepage 1208

***** DB2MOVE *****

Action: COPY

Start time: Tue Sep 15 00:26:11 2020

All schema names matching: S2;

Connecting to database TP2 ... successful! Server : DB2 Common Server V11.1.3

Copy schema S2 to S2 on the target database TP3

Create DMT : "SYSTOOLS"."DMT_5f5fc3d8938d2"

Rolled back all changes from the create phase (debuginfo:140).

db2move failed with -1 (debuginfo:50).

Files generated:

COPYSCHEMA.20200915002611.msg COPYSCHEMA.20200915002611.ERR

Please delete these files when they are no longer needed.

**Error occured -1

End time: Tue Sep 15 00:26:48 2020

  1. I tried connect reset .
  2. I also tried connecting to both databases and running the command unfortunately getting same error every time.
  3. Sorry if i'm missing something obvious i am new to db2.

COPYSCHEMA.20200915002611.ERR

Type : TABLE Error Msg : [IBM][CLI Driver][DB2/LINUXX8664] SQL0204N "TP2HIST" is an undefined name. SQLSTATE=42704 DDL : CREATE TABLE "S2 "."BLABLA" ( "ID" INTEGER ) IN "TP2HIST" ORGANIZE BY ROW

COPYSCHEMA.20200915002611.msg

***** DB2MOVE *****

Action: COPY

Start time: Tue Sep 15 00:26:11 2020

All schema names matching: S2;

Connecting to database TP2 ... successful! Server : DB2 Common Server V11.1.3

Copy schema S2 to S2 on the target database TP3

Create DMT : "SYSTOOLS"."DMT_5f5fc3d8938d2"

Rolled back all changes from the create phase (debuginfo:140).

db2move failed with -1 (debuginfo:50).

Files generated:

COPYSCHEMA.20200915002611.msg

Thanks in advance

1

There are 1 best solutions below

0
On

The message ""TP2HIST" is an undefined name." means that at least one tablespace is different between the source and the target database.

The tablespaces used by the source-schema(s) must either already exist with appropriate characteristics in the target database OR you tell db2move to adjust (i.e. use different tablespaces during the copy), via the tablespace_map option to db2move.

The Db2 free online documentation covers the tablespace_map option examples, and in enough detail, or you can just create the relevant tablespace(s) in the target database with the same characteristics as exist in the source database, and grant whatever permissions are required, before you run the db2move.

This is simple database administration, not programming. Consult a Db2 DBA to get more details, or just study the documentation in the Knowledge Centre online in the links above and related pages.