Show TOC

Background documentationCommand File Mode Locate this document in the navigation structure

 

The following are instructions on how to execu‎te the Transport, Export or Import of data with Loader CLI in command mode.

Prerequisites

You require the demo databases DEMODB and TESTDB. Start the Loader in command file mode: loadercli -b <command.dat>. The command_file contains the Loader commands necessary for the planned transformation.

A command file can be generated, for example, when a transformation is executed with the Loader in transport mode. You can then modify the file and execute it in Loader command file mode. See also: Loader, Command file Mode, Command File, Transport Mode, Transformation

Activities

Calling the Loader CLI in vommand file mode

Example Example

loadercli -b command.dat -d demodb -u mona,red -n genua -E 20

End of the example.

The Loader establishes a connection to the database DEMODB on computer GENUA for the database user MONA. The Loader processes the commands and statements contained in the command file command.dat. If errors occur (return code <> 0), processing of the command file is terminated as soon as 20 commands have terminated with an error.

Example Example

The command file command.dat may have the following content:

//IMPORT TABLE DATA

IMPORT TABLE hotel.customer

CATALOG INSTREAM 'customer_ddl.catalog'

DATA INSTREAM 'customer_csv.data'

PAGE WITH 25 ROWS USAGE

//CREATE INDEX

CREATE INDEX customer_index ON hotel.customer(name ASC,firstname ASC)

//EXPORT COLUMNS

EXPORT COLUMNS cno, title, name, firstname

FROM hotel.customer WITH LOCK

DATA OUTSTREAM 'newcustomer_csv.data'

End of the example.

This command file contains the following Loader commands and SQL statements: IMPORT TABLE, CREATE INDEX and EXPORT COLUMNS. You have to specify the information on the database session (database user, name of database, name of database computer) as a command line option when you call the Loader.

Calling the Loader CLI in Command File Mode with an Explicitly Specified Command Separator

Example Example

loadercli -b command.dat -d demodb -u mona,red -n genua -E 20 -cs ;

End of the example.

The Loader establishes a connection to the database DEMODB on computer GENUA for the user MONA. The Loader processes the commands and statements contained in the command.dat command file. If errors occur (return code <> 0), processing of the command file is terminated as soon as 20 commands have terminated with an error.

Example Example

The command file command.dat may have the following content:

//IMPORT TABLE DATA

IMPORT TABLE hotel.customer

CATALOG INSTREAM 'customer_ddl.catalog'

DATA INSTREAM 'customer_csv.data'

PAGE WITH 25 ROWS USAGE;

//CREATE INDEX

CREATE INDEX customer_index ON hotel.customer(name ASC,firstname ASC);

//EXPORT COLUMNS

EXPORT COLUMNS cno, title, name, firstname

FROM hotel.customer WITH LOCK

DATA OUTSTREAM 'newcustomer_csv.data';

End of the example.

This command file contains the following Loader commands and SQL statements: IMPORT TABLE, CREATE INDEX and EXPORT COLUMNS, all of which require a subsequent semi-colon. You have to specify the information on the database session (database user, name of database, name of database computer) as a command line option when you call the Loader.

Creating a Command File in Transport Mode and Executing it in the Command File Mode

You have already executed an export with the Loader in transport mode. The package directory contains the command file 20060322101010.EXPORT. You can execute the commands contained in the command file in command file mode. To do this, proceed as follows:

  1. Change to the package directory:

    <loader_user_data>\packages\export\GENUA\DEMODB\20060322101010

  2. Start the export:

    loadercli -b 20060322101010.EXPORT -d demodb -u mona,red -s hotel -E 10