Using Db2 Migration Service

To use the Db2 Migration Service, users can either use the command line client or access it through a website.

Before you begin

Attention: The IBM® Db2 Migration Service is offered at this time as a technical preview. It is intended for use in non-production environments.

To use the Db2 Migration Service, you must first start the Migration Server, and then use Migration Client to send a migration job request. Running the Migration Server by using the systemcl command is recommended.

Alternatively after the installation and if the default port number values were used, the Db2 Migration Service website is accessible under https://<migration_service_hostname>:14080. Where the <migration_service_hostname> is either the hostname or the IP address of a machine where the Db2 Migration Service is running.

Procedure

Run a migration job from the command line.
To run a migration job, use the migration_client script and provide the migration scenario, and the source and target environments details.
migration_client <migration_server_details> <subcommand_scenario> <subcommand_parameters>

Example

Example 1: Migrating two tables, TABLE1 and TABLE2, from one Db2 database to another Db2 database:
MIGRATION_CLIENT DB2_DB2 --THOSTS 10.0.0.1 --TUSER ADMIN2 --TPASS PASSWORD2 --TDB TDATABASE --SHOST 10.0.0.2 --SUSER ADMIN1 --SPASS PASSWORD1 --SDB SDATABASE --TABLES TABLE1 TABLE2
Example 2: Migrating two tables, TABLE1 and TABLE2, from one Db2 database to another Db2 database. The tables are renamed to TABLE1A and TABLE2A:
MIGRATION_CLIENT DB2_DB2 --THOSTS 10.0.0.1 --TUSER ADMIN2 --TPASS PASSWORD2 --TDB TDATABASE --SHOST 10.0.0.2 --SUSER ADMIN1 --SPASS PASSWORD1 --SDB SDATABASE --MV TABLE1 TABLE1A --MV TABLE2 TABLE2A
Example 3: Migrating a whole schema. This scenario can be done by using the following command:
migration_client db2_db2 --shosts 10.0.0.1 --suser ADMIN1 --spass PASSWORD1 --sschema SOURCE_SCHEMA --sdb SDATABASE --thosts 10.0.0.2 --tuser ADMIN2 --tpass PASSWORD2 --tdb TDATABASE --whole-schema
Example 4: Migrating to Db2 on Cloud. The following command can migrate the database and the schema to a cloud offering, in this case to Db2 on Cloud.
migration_client db2_db2cloud --shosts 10.0.0.1 --sport 50000 --suser ADMIN1 --spass PASSWORD1 --thost db2oncloud.ibm.com --tport 12345 --tuser ADMIN2 --tpass PASSWORD2 --sdb SDATABASE --sschema SSCHEMA --whole-schema --tschema TSCHEMA --binary
Example 5: Migrating from one cloud offering to another cloud offering. This scenario can be done by using the following command:
migration_client db2_db2 --shost DB2ONCLOUD1.IBM.COM --sschema SSCHEMA --suser ADMIN1 --spass PASSWORD1 --sdb SDATABASE --sport 50001  --thost DB2ONCLOUD2.IBM.COM --tschema TSCHEMA --tuser ADMIN2  --tpass PASSWORD2 --tdb TDATABASE --tport 50001 --target-ssl True --source-ssl True
Note: Using the db2_db2 option to migrate cloud instances, you need to enable SSL connections for both directions. This means specifying the following parameters in the command:
  • --target-ssl True
  • --source-ssl True
  • Specifying an SSL port
If you are using the db2_db2cloud option, --target-ssl True is set by default.

Example 6: Migrating by acquiring the parameters from the text files:
migration_client db2_db2 @<filename> [@<filename>...] 
Important: Filename must be prefixed with an @ symbol.
Example text file:
# Migration arguments

--thosts      # Target hosts
10.0.0.1
--tuser       # Target user
ADMIN2
--tpass       # Target password
PASSWORD2 
--tdb         # Target database
TDATABASE 
--shost       # Source host
10.0.0.2 
--suser       # Source user
ADMIN1 
--spass       # Source password
PASSWORD1 
--sdb         # Source database
SDATABASE 
--tables      # List of tables to migrate
TABLE1 
TABLE2
--truncate-table     # Truncate target table
Example usage of the text file:
migration_client db2_db2 @conn.txt @other.txt
This functionality can be used with other scenarios as well.
Note: Using more than one file to acquire arguments from, arguments from all of these files are concatenated.