Wednesday, March 28, 2018

Uing IBM Database Conversion Workbench to move data from Oracle to DB2

Here's some tips:

1. More details (including download link) on the utility here.

2. Run the utility on the DB2 server (need to use the load functionality) or else you need to copy the scripts across.

3. Copy Oracle jar file to the DB2 server so that DCW  can connect to the Oracle database.

4. Schema names must match between Oracle and DB2 (cannot be different names).

5. DB2 user created must be grant tablespace privilege:
 Example:
GRANT USE OF TABLESPACE UNICA TO USER AM75 WITH GRANT OPTION

6.  DB2 must be granted use of LOAD command:
EXAMPLE:
db2 GRANT DBADM ON DATABASE TO USER AM75


7.  Privileges on the following DCW directories must be granted to instance owner (db2inst1):
<DCW WORKSPACE>/
              data
              dump (need write access)
              msg (need write access)

8. For load error messages check db2loadmessages.log in workspace/log directory

9. If keep failing, can try to run the load manually (error below shows directory permission not granted to db2inst1)
:
[unica@rhel71 workspace]$ db2 connect to unicadb using am75
SQL0104N  An unexpected token "using" was found following "<identifier>". 
Expected tokens may include:  "USER".  SQLSTATE=42601
[unica@rhel71 workspace]$ db2 connect to unicadb user am75 using passw0rd

   Database Connection Information

 Database server        = DB2/LINUXX8664 10.5.8
 SQL authorization ID   = AM75
 Local database alias   = UNICADB

[unica@rhel71 workspace]$ db2 -tvmf db2masload.sql
LOAD  FROM "/apps/ibm/DCW4.0/eclipse/workspace/data/am75_usm_user.txt" OF DEL MODIFIED BY   CODEPAGE=1208  COLDEL~ ANYORDER  USEDEFAULTS CHARDEL"" DELPRIORITYCHAR  DUMPFILE="/apps/ibm/DCW4.0/eclipse/workspace/dump/am75_usm_user.txt" METHOD P (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27) MESSAGES "/apps/ibm/DCW4.0/eclipse/workspace/msg/am75_usm_user.txt" REPLACE INTO "AM75"."USM_USER" ( "USER_ID", "USER_LOGIN", "PASSWD", "FIRST_NAME", "LAST_NAME", "CREATE_DATE", "CREATE_BY", "USER_STATUS", "USER_TITLE", "DEPARTMENT", "ORGANIZATION", "COUNTRY", "USER_EMAIL", "PW_EXPIRATION", "PW_EXPIRATION_POLI", "ALTERNATE_LOGIN", "UPDATE_DATE", "UPDATE_BY", "PW_FAILED_TRIES", "ADDRESS1", "ADDRESS2", "PHONE1", "PHONE2", "PHONE3", "PW_RESET", "SYSTEM_DEFINED", "PARTITION_ID" ) NONRECOVERABLE INDEXING MODE AUTOSELECT
SQL2036N  The path for the file, named pipe, or device
"/apps/ibm/DCW4.0/eclipse/workspace/dump/am75_usm_user.txt.load.000" is not
valid.