Table of Contents


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.

Database Conversion

First of all we need to open a command line window by running 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=ASE15.7_CONNECT1 /U=user1 /P=pwd1 /SROW=1 /DIR="S:\Work\TEMP_OJ\Datamigration\ASE2MSSQL\Export" /LOG=sqlways.log /TARGET=Microsoft SQL Server /NSTOP /TRACE /RPT=reports /PRJF="S:\Work\TEMP_OJ\Datamigration\ASE2MSSQL\sqlways.xml" /INI="S:\Work\TEMP_OJ\Datamigration\ASE2MSSQL\sqlways_db.ini" /TD=Zhyrava /TH=servername1 /TP=pwd1 /TU=uuser1

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:


Filtering and Selecting Objects

These parameters allow you to select specific objects or patterns for conversion.


/T= — Convert Tables

Value Description
/T=schema.tablename Convert a specific table.
/T=“dbo_2.*” Convert all tables from schema `dbo_2`.
/T=*.* Convert all tables in all schemas.

/SP= — Convert Stored Procedures by Name or Pattern

Value Description
/SP=dbo.proc_name Convert one specific procedure.
/SP=dbo.test_* Convert all procedures starting with `test_` in schema `dbo`.

/O= — Convert All Object Types

Value Description
/O=*.* Convert all object types: tables, procedures, functions, triggers, etc.

/S= — Convert from Custom SQL SELECT Statement

Value Description
/S=SELECT * FROM Tab1 Converts the table definition and exports data based on the result of the SELECT query.


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 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 generated scripts.

Thus the conversion process is finished.


Import to Target Database

During the Conversion process via Ispirer SQLWays tool, the tool generates not only all the scripts needed to import the objects, but also some additional files: “import_data” and “sqlways_imp_cmd.txt”:

The “import_data” file contains attributes for import process performing:

The “sqlways_imp_cmd.txt” file contains the command line, which could be used for running of import via command line window.


Note: Running the Conversion process via command line prompt doesn't create the sqlways_imp_cmd.txt file.


Sample of the command line:

   "C:/Program Files/Ispirer/SQLWaysToolkit10\DBImport.exe" 
   /DATA="S:\ExportDirectories\SybaseASE_MSSQL\TestConnect\Export\import_data" /ARG=all; /TRACE /RPT /RPT_DIR=reports

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

More details could be found here.


During the Import process, the DBImport.exe tool uses this generated file “import_data” for import objects to Target database.

To perform the import from Command line window, we need to go to the Export directory, open the file sqlways_imp_cmd.txt, copy the command line, which was created during Conversion process and run this command line.

Please see the screenshot for reference:

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

/ARG Parameter in DBImport.exe

The /ARG parameter in the DBImport.exe command specifies which types of objects should be imported into the target database. It accepts a semicolon-separated list of object categories. This allows for granular control over the import process.

Syntax:

   /ARG=<object_type1>;<object_type2>;...;<object_typeN>;

Available Object Types:

Object Type Description
table Imports tables. Only table definitions are imported.
import Imports exported data (rows) into tables.
cns Imports constraints such as primary keys, foreign keys, unique constraints, etc.
idx Imports indexes for tables.
view Imports views, including their definitions and dependencies.
business_logic_object Imports business logic objects such as stored procedures, functions, and packages.
trigger Imports triggers associated with tables or views.
sequence Imports sequences, used for generating auto-increment values.
user_defined_type Imports user-defined types (UDTs), including domain definitions or custom types.
synonym Imports synonyms used to reference database objects under alternate names.
generated_objects Imports automatically generated support objects, often required to simulate functionality from the source DB.
all Imports all objects that were previously converted by Ispirer Toolkit. This is a shortcut and includes every supported category.

Examples:

Import all objects except indexes and user-defined types:

   "C:/Program Files/Ispirer/IspirerToolkit10/DBImport.exe" /DATA="..." /ARG=table;import;cns;view;business_logic_object;trigger;sequence;synonym;generated_objects; /TRACE /RPT /RPT_DIR=reports

Import everything except sequences and data:

   "C:/Program Files/Ispirer/IspirerToolkit10/DBImport.exe" /DATA="..." /ARG=table;cns;idx;view;business_logic_object;trigger;user_defined_type;synonym;generated_objects; /TRACE /RPT /RPT_DIR=reports

Import all converted objects:

   "C:/Program Files/Ispirer/IspirerToolkit10/DBImport.exe" /DATA="..." /ARG=all; /TRACE /RPT /RPT_DIR=reports


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