Skip to content
sanumala edited this page Apr 23, 2012 · 2 revisions

Welcome to the export-import-db2 wiki!

Purpose: Main purpose of this script is to export and import very large tables in db2 environments.

Pre-requisites: Find a Unix/Linux/AIX server where you can login and have enough space to save extracted data. And also you must be able to connect to both source and target databases.

Inputs: This Script accepts 2 input parameters. First one is a text file which contains list of tables separated line-by-line and the other is properties file which contains source and target database connection details.

Process: Give executable permissions to export_import.sh and run like export_import.sh tablesList.txt dbconfig.properties. Sample tables list and dbconfig files were attached.

Steps Involved in process:

  • First it validates input files exist in the present working directory or not. If yes it also validates whether these files are readable or not
  • Next it reads the dbconfig.properties and makes those properties available to supporting functions to make database calls.
  • Then it reads and stores the given list of tables into array
  • Once this pre validation and processing is done script will call exportData() function to extract data from given tables and during this time script will open as many database connections as needed and closes them appropriately. Please note that multiple exports are running in parallel and scripts waits until long running export is done. Once exports are done its echos to console continue with import
  • To execute imports script will call importData() function and this function also performs a parallel processing to load data into target. Once long running import is done script will echo a message to console and exists.
  • Different database logs will be written to ~/pwd/log_mmddyyyy.log

NOTE: Don’t exit script forcefully while inserts are in progress and always run this script in background using nohup and & and redirect console logs to nohup.out

Limitation: Did not implement logic to clean the extracted .ixf file(s) once restore is done. Either you can delete them manually or implement logic in different script, which will do such maintenance.

Clone this wiki locally