Simple SQL/CLI application that transfers data between 2 databases.

root

transfer-db

Simple ODBC application that transfers data between 2 databases.

The application uses the SQL/CLI API and only few ODBC extensions that are absolutely needed to make ODBC work. This means that the application is easily portable to other SQL/CLI implementations.

It includes a database agnostic dump file format library.

Current release is 0.3.1.1.

Release Notes

The dump and restore are not finalized yet, so they don't work with the current version.

SYNOPSYS

To use transfer-db you either right your own transfer plan by hand or use transfer-db to generate a transfer plan for you. You can edit the generated tranfer plan.

A transfer plan is an yaml file specifying the database connection parameters and what tables and data should be transferred.

Gnereating a plan:

transfer-db makePlan splitByRows <n> -d<SOURCEDB_ODBC_DATASOURCE> -u<SOURCEDB_USER_NAME> -p<SOURCEDB_PASSWORD> -s<SOURCEDB_SCHEMA> -D<DESTDB_ODBC_DATASOURCE> -U<DESTDB_USER_NAME> -P<DESTDB_PASSWORD> -S<DESTDB_SCHEMA> > my-plan.yaml

This command will generate on the standard output a plan for transferring the database SOURCEDB DESTDB in batches of <n> rows (the splitByRows sub-command). In case of failure, you could restart the process by skipping the completed batches.

After that, simply run:

transfer-db run my-plan.yaml > therun-0001.log

This command will run the plan in the my-plan.yaml file and will capture the stdout of transfer-db command into the file therun-0001.log. This file logs the transferred tables and batches and could be used to generate a corrective plan in case something went wrong. On console (stderr) there will be printed detailed information about running the plan.

For more advanced options, on controlling the number of threads or of what batches should be run, type:

transfer-db help

To generate a corrective plan, you need the original plan and the stdout log generated by the run command:

transfer-db correctivePlan my-plan.yaml -sfix-001.sql -pnew-plan.yaml -itherun-001.log

This command will read the original plan from my-plan.yaml file, the log of the previous run from therun-001.log file and will generate 2 files:

  • fix-001.sql that you will need to run to against the destination database in order to remove partial batches.
  • new-plan.yaml that you should use with for a new transfer run, to transfer the remaining records.