Importing data from a client machine to Amazon RDS for Db2 with the IMPORT command
You can use the IMPORT command from a client machine to import your data into
the Amazon RDS for Db2 server.
Important
The IMPORT command method is useful for migrating small tables and tables
that include large objects (LOBs). The IMPORT command is slower than the
LOAD utility because of the INSERT and DELETE
logging operations. If your network bandwidth between the client machine and RDS for Db2 is
limited, we recommend that you use a different migration approach. For more information,
see Using native Db2 tools to migrate data from Db2 to Amazon RDS for Db2.
To import data into the RDS for Db2 server
-
Log in to your client machine with IBM Db2 Data Management Console. For more information, see Connecting to your Amazon RDS for Db2 DB instance with IBM Db2 Data Management Console.
-
Catalog the RDS for Db2 database on the client machine.
-
Catalog the node. In the following example, replace
dns_ip_addressandportwith the DNS name or the IP address and the port number of the self-managed Db2 database.db2 catalog tcpip node srcnode REMOTEdns_ip_addressserverport -
Catalog the database. In the following example, replace
source_database_nameandsource_database_aliaswith the name of the self-managed Db2 database and the alias that you want to use for this database.db2 catalog databasesource_database_nameassource_database_aliasat node srcnode \ authentication server_encrypt
-
-
Attach to the source database. In the following example, replace
source_database_alias,user_id, anduser_passwordwith the alias you created in the previous step and the user ID and password for the self-managed Db2 database.db2look -dsource_database_alias-iuser_id-wuser_password-e -l -a -f -wlm \ -cor -createdb -printdbcfg -o db2look.sql -
Generate the data file by using the
EXPORTcommand on your self-managed Db2 system. In the following example, replacedirectorywith the directory on your client machine where your data file exists. Replacefile_nameandtable_namewith the name of the data file and the name of the table.db2 "export to /directory/file_name.txt of del lobs to /directory/lobs/ \ modified by coldel\| select * fromtable_name" -
Connect to your RDS for Db2 database using the master username and master password for your RDS for Db2 DB instance. In the following example, replace
,rds_database_aliasmaster_username,andmaster_passwordwith your own information.db2 connect touserrds_database_aliasmaster_usernameusingmaster_password -
Use the
IMPORTcommand to import data from a file on the client machine into the remote RDS for Db2 database. For more information, see IMPORT commandin the IBM Db2 documentation. In the following example, replace directoryandfile_namewith the directory on your client machine where your data file exists and the name of the data file. ReplaceSCHEMA_NAMEandTABLE_NAMEwith the name of your schema and table.db2 "IMPORT from /directory/file_name.tbl OF DEL LOBS FROM /directory/lobs/ \ modified by coldel\| replace intoSCHEMA_NAME.TABLE_NAME" -
Terminate your connection.
db2 terminate