Ispirer Website Ispirer Toolkit Overview Free Trial

How to Convert and Import Database in Command Line Mode

Ispirer Toolkit allows you to convert and load converted database via command line or shell script.

First of all we need to open a command line window by running Start → Ispirer Toolkit → SQLWays Command Line or Start → Run → cmd.exe

Preparing Command Line

To convert database objects we need to use sqlways.exe command line utility. So we have to prepare appropriate command line for this command line tool.

Command line may look as follows:

"C:\Program Files\Ispirer\IspirerToolkit10\sqlways.exe" /IMPORD=Fast /D=vmdbsrvusql2019_Adventure /U=** /P=************ /SROW=1 /DIR=S:\Work\TEMP_OJ\MSSQL2PG_Adventure\Export /LOG=sqlways.log /TARGET=PostgreSQL /NSTOP /TRACE /RPT=reports /PRJF=S:\Work\TEMP_OJ\MSSQL2PG_Adventure\sqlways.xml /INI=S:\Work\TEMP_OJ\MSSQL2PG_Adventure\sqlways_db.ini /TD=Zhyrava /TH=vmdbsrvupostgre /TP=************ /TU=******** 

Note: SQLWays command line options are case insensitive and their order is insignificant.

Here is the list of parameters used in the provided command line:

  • sqlways.exe - this is the name of the utility that performs the conversion. If required it can be specified with the full path to the utility.
  • /d - specifies the ODBC Data Source Name (DSN) to connect to the source database. Articles on how to tune the ODBC Connection to your source database can be found in the Database: Setup and Troubleshooting section for corresponding source database.
  • /IMPORD - import order for tables
  • /U - specifies the user name for the source connection.
  • /P - specifies the password for the source connection.
  • /SROW - specifies the start row
  • /DIR - specifies the location of the generated files (output directory).
  • /LOG - specifies the name of the conversion log file.
  • /TARGET - specifies the target database.
  • /NSTOP - specified that process should be continue when an error occurs
  • /TRACE - specifies the trace mode
  • /RPT - specifies the report file name
  • /PRJF - specifies the path to the project file. In this file information about the objects specified for conversion is stored. You can find more information about the project file here.
  • /INI - specifies the options file. Options file is a file that stores all the options supported by the tool. Options file with the default settings is located in the directory like: “C:\Users\[user_name]\Documents\Ispirer\SQLWays 8.0\”. You can use it as a default options file. More information about the supported options can be found here.
  • /TD - specifies the target database name, where import should be done.
  • /TH - specifies the target host\server name.
  • /TP - specifies the password that will be used to connect to the target database.
  • /TU - specifies the user name for the target connection.

More details could be found here.

Easiest Way to Get Command Line

The easiest way to prepare correct command line is to run the SQLWays Wizard tool, select all the required objects for conversion and on the “Summary” page, you will see the generated command line:

You can just copy the generated command line and run it.

Running Prepared Command Line

After we prepared the command line with appropriate set of options we need to run it in the command line prompt.

And as a result, in the output directory we will see all the generated scripts.

Thus the conversion process is finished.

During the Conversion process, the SQLWays.exe tool generates all the scripts required for the import and places them in the appropriate order to maintain referential integrity.

To perform the import, we need to run the generated file “sqlways_all.bat” with the “all” option. To do this, we need to go to the output directory (the directory we specified in the /DIR option) and run this file.

Please see the screenshot for reference:

You can also run a general command file name 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.

A more detailed list of command line options can be found here.

If you have questions about how to run the migration in batch mode, please contact our technical team at support@ispirer.com