db_migrate_iias command
The db_migrate_iias command is used to migrate tables between IAS and Db2® Warehouse systems.
Requirements
- The following migration scenarios are supported with db_migrate_iias:
- IAS to IAS
- Db2 Warehouse to Db2 Warehouse
- IAS to Db2 Warehouse
- Db2 Warehouse to IAS
- You must provide the flag
-createTable
if the target tables do not exist. - All connections to the database are acquired by the dbsql command. To run the
script from a source system through python 2, you must have access to source and target tables. The
program searches for
python
binary in directories listed in$PATH
. The 2.7 version of the interpreter is required.
Usage
Note: Starting with IAS version 1.0.19.0, the
db_migrate_iias command can accept multiple target hosts, which improves
migration performance. As a result, the
The db_migrate_iias command can be run in three different ways:-target
option no longer accepts the
host
parameter. You must always specify the -thosts|-thost
option.- By passing each parameter
separately:
db_migrate_iias {-thost|thosts} <hostname> [<hostname2> ...] -sdb <database> -tdb <database> -suser <username> -tuser <username> -spass <password> -tpass <password> -t <table> [<table> ...] [optional parameters]
- By using -source and -target options:
db_migrate_iias {-thost|thosts} <hostname> [<hostname2> ...] -source <username> <password> <database> -target <username> <password> <database> -t <table> [<table> ...] [optional parameters]
- By acquiring the parameters from the text files:
db_migrate_iias @<filename> [@<filename>...]
Important: Filename must be prefixed with anExample text file:@
symbol.
Note that any comments in the file must be single-line with a hash (# Connection arguments -thosts # Target hosts 192.168.0.1 # Hostname 192.168.0.2 # Hostname2 -source # Source machine bluadmin # Username some_password # Password bludb # Database -target # Target machine bluadmin # Username some_password # Password bludb # Database
#
) sign. Newlines are ignored.Example usage of the text file:db_migrate_iias @conn.txt @other.txt
Basic parameters
- -h | --help
- Displays help for the command.
- -v | --version| -rev
- Displays program's version number.
- -verbose
-
Displays some additional information during migration.
Required parameters
- When the parameters are passed separately the following arguments are required:
- -thost|thosts <hostname> [<hostname2> ...]
- Specifies the IP address or addresses of the target nodes.
- -suser <username>
- Specifies source database user name.
- -tuser <username>
- Specifies target database user name.
- -spass <password>
- Specifies source password.
- -tpass <password>
- Specifies target password.
- -sdb <database>
- Specifies source database name.
- -tdb <database>
- Specifies target database name.
- When you use -source and -target parameters:
- -thost|thosts <hostname> [<hostname2> ...]
- Specifies the IP address or addresses of the target nodes.
- -source <username> <password> <database>
- Specifies source database user name, password and database name.
- -target <username> <password> <database>
- Specifies target user name, password and database name.
Table-related parameters
Values for the following parameters must consist of only table names. By default, schema is an
uppercase user name. If the user wants to specify a different schema, then the case-sensitive
-sschema
and/or -tschema
must be provided.
- -tables|-t <name [name …]>
- Specifies tables to migrate, assuming that both source and target tables have equivalent names.
The option can be used only once in a single db_migrate_iias execution, but you
can list multiple tables as
values:
Note that -t X Y Z is equivalent to thedb_migrate_iias -t TableA1 TableA1 TableA2...
-m X X -m Y Y -m Z Z
command execution. - -mv|-m <source> <target>
- Specifies a source table and a target table name, so that the source table can be moved to a
target table with a different name. Note that target table must already exist on target. The option
can be used multiple times at once, for instance:
db_migrate_iias -mv TableA1 TableA2 -mv TableB1 TableB2 ...
Note:-rename option has been deprecated due to its ambiguity.
Optional parameters
- -truncateTable
-
Option to truncate target table before loading any data into it. This parameter takes no arguments.
- -createTable
- Creates target table if not present in the target database. The parameter takes no arguments.
- --socketbufsize, -b SOCKET_BUFFER
- Specifies TCP socket buffer size in bytes. The default is 8388608.
- -ts, --tablespace TABLESPACE
- Specifies a case-sensitive table space name for new target tables. -createTable is required.
- -verbose
-
Displays some additional information during migration.
- -tempdir <dirpath>
- Specifies the absolute path of a directory, where the program stores temporary objects.
- -logdir
- Specifies the absolute directory path for the main log file.
- -sport <int>
- Specifies source port. The default is 50000.
- -tport <int>
- Specifies target port. The default is 50000.
- --source-ssl
- Connection to source database will be encrypted with SSL. Unless --source-certificate is specified, the certificate stored in keystore database will be used.
- --source-certificate <name>
- Requires --source-ssl to be provided. Specify a fully qualified certificate name to be used for SSL connection to source.
- --target-ssl
- Connection to target database will be encrypted with SSL. Unless --target-certificate is specified, the certificate stored in the keystore database will be used.
- --target-certificate <name>
- Requires --target-ssl to be provided. Specify a fully qualified certificate name to be used for SSL connection to target.
- -sschema <name>
- Specifies a case-sensitive source schema identifier. By default, it is an uppercase source user.
- -tschema <name>
- Specifies a case-sensitive target schema identifier. By default, it is an uppercase target user.
- -where <predicate
- Specifies a where clause to restrict the data selected for migration.
- -orderby <column>
- You can use the parameter to sort the data selected for migration. The parameter specifies the
ORDER BY
clause. - -binary
- Transfers data in binary format.
- -compress {NO,LZ4,GZIP}
- Specifies compression type. Default value is NO.
- -strategy {partitions,dataslices}
- Select the migration strategy. The
-strategy partitions
parameter, which is default, uses all MLNs to unload data, so the number of inserts is high. You can also use-strategy dataslices
, which allows you to control the number of inserts with the--max-inserts
parameter. - -hiddencols
- Tables with hidden columns are automatically skipped and ignored in the migration process. You
can use the
-hiddencols
parameter to migrate all of the hidden columns. - -maintmode
- Specifies whether to insert with maintenance mode (e.g. force autogenerated columns).
- -force, --force-continue
- Forces the migration to run regardless of error severity. The script normally tries to continue on error, but there are some critical cases when it chooses to abort.
- --max-inserts <int>
- Specifies a maximum number of insertion threads per table. By default, it is 8.
- --preserve-tempdir
- Preserves the temporary directory (specified with
-tempdir
) - -r, --count-rows <option>
- Displays the number of rows. NO, TARGET or BOTH. Default is NO.
- -c, --checksum <option>
- Different checksums may occur even on success. There may be some data in the target table before the process. Consider clearing the target data with -truncateTable. NO, COUNT, FULL or COLUMNS. Default is NO.
- -columnslist <columns>
- Lists columns for checksum, separated by commas and in quotes. Can only be used with -c or --checksum
See Migrating data with db_migrate_iias command - examples for more usage
examples.