About Ispirer Systems
Ispirer Home Page Database Migration Application Conversion Downloads
Database conversion implies that you can convert objects directly from the database using an ODBC connection. This process is divided into 2 stages: the export stage and the import stage. Below we will describe each of them in detail.
To be able to connect to the source database, you must configure an ODBC connection. This means that the Oracle client and Oracle ODBC software must be installed. Certain entries in the odbc.ini, odbcinst.ini files must also exist.
Please follow the official installation instructions:
Download Oracle Instant Client
Install Oracle Instant Client ODBC
First of all, you need to compose the appropriate command line to run the tool.
The command syntax is:
SQLWays /D=<source ODBC alias> /U=<login> /P=<password> /TARGET=<target DB> /TH=<target_host>/TD=<target_database> /TU=<user> /TP=<password> /DIR=<result_directory> {<objects to be converted>} /INI=<ini_file_path> [/NSTOP] [/SROW=1] [/LOG=<log file name>][/IMPS=Unix][/STDEL=<delimiter>] [/TRACE] <objects to be converted>: [/O=<objects template>] [/T=<tables template>] [/V=<views template>] [/SP=<procedures template>] [/FN=<functions template>] [/TG=<triggers template>] [/PKG=<packages template>] [/SQ=<functions template>] [/SN=<synonyms template>] [/UDF=<types template>] | /PRJF=<project_file_path>
Note: SQLWays command line options are case insensitive and their order is insignificant. Description of parameters:
Required parameters:
SQLWays - the name of the program that performs the conversion.
Optional parameters:
Information about all supported command line options can be found in the Command Line Options article.
Command sample:
SQLWays /D=ORACLE_ODBC /U=login /P=pass /TARGET=PostgreSQL /TH=postgreservername /TD=dbname /TU=postgres /TP=postgres /DIR=/home/bob/project1/Export /INI=/home/bob/project1/wzd_sqlways_db.ini /PRJF=/home/bob/project1/sqlways.xml /TRACE
Once we have prepared the command line with the appropriate set of options, we need to run it in the terminal:
And as a result, we will see all the generated files in the output directory:
sqlways.log - conversion log, which stores messages about the conversion process;
sqlways.trc - trace file that stores detailed information about the conversion process (in case the /TRACE argument was set);
reports - folder with html reports;
.sql - corresponding file(s) with converted SQL code;
*.sh shell - scripts with import commands inside;
sqlways_all.sh - main shell script to call all *.sh file(s) in the correct order;
*.ldi - files with the COPY command to load data;
*.txt - file containing table data.
First of all, to be able to run the import, the target database client and associated utility must be installed on the machine on which you are performing the migration, since this utility's specific command will be generated and the import will be executed using it. For example, for PostgreSQL as a target, the psql must be installed.
During the conversion process, SQLWays generates all the scripts and commands required for the import and then runs them in the appropriate order to maintain referential integrity.
So, to start the import, we just need to run the generated “sqlways_all.sh” (2) file. To do this, we need to go to the output directory (1) (the directory we specified in the /DIR option) and call it (in case of an error when calling *.sh, the execution permission can be set with the chmod +x * .sh command):
sqlways_all.sh contains a list of other *.sh files, inside which there is a psql command to import the corresponding objects (make sure the $PATH variable has the /usr/bin directory path):
![]() | ![]() |
sqlways_all.sh can also be executed as follows:
In this case, all information about the import process (all warnings, notifications and error messages) will be stored in the “sqlways_imp.log” file. This is an optional argument and can be omitted if you do not want to save the import results.
Another option that can be changed is the “all” argument, which affects the type of object that will be imported. Possible values:
all - import all objects, including data;
table - import only tables definitions;
import - import data only;
cns - import table constraints only;
idx - import table indexes only;
ddl - import all objects without data.
Thus, with their help, you can import objects in the required order.
Current errors are output using the echo Exit code command:
psql -h postgreservername -U postgres -p 5432 -d dbname --file some_proc_calls.sql >> some_proc_calls.log echo Exit code = $?
In this case, if an error occurs during the execution of the sql script, the exit code is still 0. If an error occurs while connecting to the server, then the exit code is 2.
If you need the exit code to be different from 0 in case of an error in the sql script, then you need to set the -v “ON_ERROR_STOP=1” argument of the psql command:
psql -h postgreservername -U postgres -p 5432 -d dbname --file some_proc_calls.sql -v "ON_ERROR_STOP=1" >> some_proc_calls.log echo Exit code = $?
The Exit Status details are described in the following documentation.
A more detailed list of command line options can be found here: Command Line Options Command-line Options
If you have any questions on how to run the migration in batch mode, please contact our technical team: support@ispirer.com