DB 2 Move

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

db2move - Database Movement Tool Command Page 1 of 5

DB2 Universal Database Version 8 is going out of support as of April 30, 2009. More details are
available here: http://www.ibm.com/support/docview.wss?rs=71&uid=swg21370360

db2move - Database Movement Tool Command

This tool facilitates the movement of large numbers of tables between DB2 databases located on
workstations. The tool queries the system catalog tables for a particular database and compiles a list of
all user tables. It then exports these tables in PC/IXF format. The PC/IXF files can be imported or loaded
to another local DB2 database on the same system, or can be transferred to another workstation
platform and imported or loaded to a DB2 database on that platform.

Note:
Tables with structured type columns are not moved when this tool is used.
Authorization

This tool calls the DB2 export, import, and load APIs, depending on the action requested by the user.
Therefore, the requesting user ID must have the correct authorization required by those APIs, or the
request will fail.

Command syntax

.----------------------------.
V |
>>-db2move--dbname--action----+------------------------+-+-----><
+- -tc--table-creators---+
+- -tn--table-names------+
+- -sn--schema-names-----+
+- -ts--tablespace-names-+
+- -tf--filename---------+
+- -io--import-option----+
+- -lo--load-option------+
+- -l--lobpaths----------+
+- -u--userid------------+
+- -p--password----------+
'- -aw-------------------'

Command parameters

dbname
Name of the database.
action
Must be one of: EXPORT, IMPORT, or LOAD.
-tc
table-creators. The default is all creators.

This is an EXPORT action only. If specified, only those tables created by the creators listed with this
option are exported. If not specified, the default is to use all creators. When specifying multiple
creators, they must be separated by commas; no blanks are allowed between creator IDs. The
maximum number of creators that can be specified is 10. This option can be used with the "-tn" table-
names option to select the tables for export.

An asterisk (*) can be used as a wildcard character that can be placed anywhere in the string.

-tn
table-names. The default is all user tables.

This is an EXPORT action only. If specified, only those tables whose names match exactly those in
the specified string are exported. If not specified, the default is to use all user tables. When specifying
multiple table names, they must be separated by commas; no blanks are allowed between table

http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/core/r00... 12/10/2010
db2move - Database Movement Tool Command Page 2 of 5

names. The maximum number of table names that can be specified is 10. This option can be used
with the "-tc" table-creators option to select the tables for export. db2move will only export those
tables whose names match the specified table names and whose creators match the specified table
creators.

An asterisk (*) can be used as a wildcard character that can be placed anywhere in the string.

-sn
schema-names. The default is all schemas.

If specified, only those tables whose schema names match exactly will be exported. If the asterisk
wildcard character (*) is used in the schema names, it will be changed to a percent sign (%) and the
table name (with percent sign) will be used in the LIKE predicate of the WHERE clause. If not
specified, the default is to use all schemas. If multiple schema names are specified, they must be
separated by commas; no blanks are allowed between schema names. The maximum number of
schema names that can be specified is 10. If used with the -tn or -tc option, db2move will export only
those tables whose schemas match the specified schema names and whose creators match the
specified creators.

Note:
Schema names of less than 8 character are padded to 8 characters in length. For example, a
schema name 'fred' has to be specified "-sn fr*d*" instead of "-sn fr*d" when using an asterisk.
2 -ts

2 tablespace-names. The default is all table spaces.

2 This is an EXPORT action only. If this option is specified, only those tables that reside in the specified
2 table space will be exported. If the asterisk wildcard character (*) is used in the table space name, it
2 will be changed to a percent sign (%) and the table name (with percent sign) will be used in the LIKE
2 predicate in the WHERE clause. If the -ts option is not specified, the default is to use all table spaces.
2 If multiple table space names are specified, they must be separated by commas; no blanks are
2 allowed between table space names. The maximum number of table space names that can be
specified is 10.

2 Note:
2 Table space names less than 8 characters are padded to 8 characters in length. For example, a
2 table space name 'mytb' has to be specified "-ts my*b*" instead of "-sn my*b" when using the
asterisk.
2 -tf

2 filename

2 This is an EXPORT action only. If specified, only the tables listed in the given file will be exported. The
2 tables should be listed one per line, and each table should be fully qualified. Here is an example of the
2 contents of a file:

2 "SCHEMA1"."TABLE NAME1"
2 "SCHEMA NAME77"."TABLE155"

2 -io
import-option. The default is REPLACE_CREATE.

Valid options are: INSERT, INSERT_UPDATE, REPLACE, CREATE, and REPLACE_CREATE.

-lo
load-option. The default is INSERT.

Valid options are: INSERT and REPLACE.

-l
lobpaths. The default is the current directory.

http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/core/r00... 12/10/2010
db2move - Database Movement Tool Command Page 3 of 5

This option specifies the absolute path names where LOB files are created (as part of EXPORT) or
searched for (as part of IMPORT or LOAD). When specifying multiple LOB paths, each must be
separated by commas; no blanks are allowed between LOB paths. If the first path runs out of space
(during EXPORT), or the files are not found in the path (during IMPORT or LOAD), the second path
will be used, and so on.

If the action is EXPORT, and LOB paths are specified, all files in the LOB path directories are deleted,
the directories are removed, and new directories are created. If not specified, the current directory is
used for the LOB path.

-u
userid. The default is the logged on user ID.

Both user ID and password are optional. However, if one is specified, the other must be specified. If
the command is run on a client connecting to a remote server, user ID and password should be
specified.

-p
password. The default is the logged on password.

Both user ID and password are optional. However, if one is specified, the other must be specified. If
the command is run on a client connecting to a remote server, user ID and password should be
specified.

-aw
Allow Warnings. When '-aw' is not specified, tables that experience warnings during export are not
included in the db2move.lst file (although that table's .ixf file and .msg file are still generated). In
some scenarios (such as data truncation) the user might wish to allow such tables to be included in
the db2move.lst file. Specifing this option allows tables which receive warnings during export to be
included in the .lst file.

Examples
• db2move sample export

This will export all tables in the SAMPLE database; default values are used for all options.

• db2move sample export -tc userid1,us*rid2 -tn tbname1,*tbname2

This will export all tables created by "userid1" or user IDs LIKE "us%rid2", and with the name
"tbname1" or table names LIKE "%tbname2".

• db2move sample import -l D:\LOBPATH1,C:\LOBPATH2

This example is applicable to the Windows operating system only. The command will import all
tables in the SAMPLE database; LOB paths "D:\LOBPATH1" and "C:\LOBPATH2" are to be
searched for LOB files.

• db2move sample load -l /home/userid/lobpath,/tmp

This example is applicable to UNIX based systems only. The command will load all tables in the
SAMPLE database; both the /home/userid/lobpath subdirectory and the tmp subdirectory
are to be searched for LOB files.

• db2move sample import -io replace -u userid -p password

This will import all tables in the SAMPLE database in REPLACE mode; the specified user ID and
password will be used.

Usage notes

7 This tool exports, imports, or loads user-created tables. If a database is to be duplicated from one
7 operating system to another operating system, db2move facilitates the movement of the tables. It is
7 also necessary to move all other objects associated with the tables, such as aliases, views, triggers,

http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/core/r00... 12/10/2010
db2move - Database Movement Tool Command Page 4 of 5

7 user-defined functions, and so on. If the import utility with the REPLACE_CREATE option is used to
7 create the tables on the target database, then the limitations outlined in Using import to recreate an
7 exported table are imposed. If unexpected errors are encountered during the db2move import phase
7 when the REPLACE_CREATE option is used, examine the appropriate tabnnn.msg message file and
consider that the errors might be the result of the limitations on table creation.

When export, import, or load APIs are called by db2move, the FileTypeMod parameter is set to
lobsinfile. That is, LOB data is kept in separate files from PC/IXF files. There are 26 000 file names
available for LOB files.

The LOAD action must be run locally on the machine where the database and the data file reside. When
the load API is called by db2move, the CopyTargetList parameter is set to NULL; that is, no copying
is done. If logretain is on, the load operation cannot be rolled forward later. The table space where
the loaded tables reside is placed in backup pending state, and is not accessible. A full database
backup, or a table space backup, is required to take the table space out of backup pending state.

Note:
'db2move import' performance can be improved by altering default buffer pool, IBMDEFAULTBP;
and by updating the configuration parameters sortheap, util_heap_sz, logfilsz, and logprimary.

Files Required/Generated When Using EXPORT:

• Input: None.
• Output:

EXPORT.out
The summarized result of the EXPORT action.
db2move.lst
The list of original table names, their corresponding PC/IXF file names (tabnnn.ixf), and
message file names (tabnnn.msg). This list, the exported PC/IXF files, and LOB files
(tabnnnc.yyy) are used as input to the db2move IMPORT or LOAD action.
tabnnn.ixf
The exported PC/IXF file of a specific table.
tabnnn.msg
The export message file of the corresponding table.
tabnnnc.yyy
The exported LOB files of a specific table.

"nnn" is the table number. "c" is a letter of the alphabet. "yyy" is a number ranging from 001 to
999.

These files are created only if the table being exported contains LOB data. If created, these
LOB files are placed in the "lobpath" directories. There are a total of 26 000 possible names for
the LOB files.

system.msg
The message file containing system messages for creating or deleting file or directory
commands. This is only used if the action is EXPORT, and a LOB path is specified.

Files Required/Generated When Using IMPORT:

• Input:

db2move.lst
An output file from the EXPORT action.
tabnnn.ixf
An output file from the EXPORT action.
tabnnnc.yyy

http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/core/r00... 12/10/2010
db2move - Database Movement Tool Command Page 5 of 5

An output file from the EXPORT action.

• Output:

IMPORT.out
The summarized result of the IMPORT action.
tabnnn.msg
The import message file of the corresponding table.

Files Required/Generated When Using LOAD:

• Input:

db2move.lst
An output file from the EXPORT action.
tabnnn.ixf
An output file from the EXPORT action.
tabnnnc.yyy
An output file from the EXPORT action.

• Output:

LOAD.out
The summarized result of the LOAD action.
tabnnn.msg
The LOAD message file of the corresponding table.

Related reference
• db2look - DB2 Statistics and DDL Extraction Tool Command

This topic can be found in: Command Reference.

http://publib.boulder.ibm.com/infocenter/db2luw/v8/topic/com.ibm.db2.udb.doc/core/r00... 12/10/2010

You might also like