Using IBM Db2 Bridge
You can run IBM Db2 Bridge, from either the command line client or a website.
Before you begin
To use IBM Db2 Bridge, you must first start the IBM Db2 Bridge Server and then use the IBM Db2 Bridge Client to send a data movement job request. Running the IBM Db2 Bridge Server by using the systemcl command is recommended.
Alternatively after the installation and if the default port number values were used, the
IBM
Db2 Bridge
website is accessible under https://<db2bridge_service_hostname>:14080
. Where
the <db2bridge_service_hostname>
is either the hostname or the IP address of a
machine where IBM
Db2 Bridge is
running.
Procedure
Run a data movement job from the command line.
To run a data movement job, use
the db2bridge_client script and provide the data movement scenario, and the
source and target environments
details.
db2bridge_client <db2bridge_server_details> <subcommand_scenario> <subcommand_parameters>
Example
Example 1: Moving two tables, TABLE1 and TABLE2, from one Db2 database to
another Db2
database:
DB2BRIDGE_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: Moving two tables, TABLE1 and TABLE2, from one Db2 database to
another Db2
database. The tables are renamed to TABLE1A and
TABLE2A:
DB2BRIDGE_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: Moving a whole schema. This scenario can be done by using the following
command:
db2bridge_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: Moving to Db2 on Cloud. The
following command can move the database and the schema to a cloud offering, in this case to Db2 on
Cloud.
db2bridge_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: Moving from one cloud offering to another cloud offering. This scenario can be done by
using the following
command:
db2bridge_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 move cloud instances, you need to enable Transport Layer
Security (TLS) connections for both directions. This means specifying the following parameters in
the command: --target-ssl True
--source-ssl True
- Specifying an SSL port
db2_db2cloud
option, --target-ssl True
is set by default.Attention: TLS was developed in 1999
as the successor to the popular encryption protocol Secure Socket Layer (SSL). Because of the
popularity of SSL, the acronym is now synonymous with encryption technology and by association,
TLS. As a
result, some Db2
commands and database objects that are related to TLS encryption still
contain 'ssl' in their names. However, Db2 does not use the SSL
protocol for data encryption. Any references to SSL in this guide can be interpreted as TLS.
Example 6: Moving a whole database:
db2bridge_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-db
Example 7: Moving by acquiring the
parameters from the text files:
db2bridge_client db2_db2 @<filename> [@<filename>...]
Important:
Example text file:Filename
must be prefixed with an @
symbol.# 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:db2bridge_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.