Import

Below are just a few examples of importing data when the Loader CLI is in transport mode.

Prerequisites

For a description of the prerequisites, see Transport Mode.

Executing the Import

You want to import the HOTEL table of schema HOTEL of user MONA to database TESTDB. The application data (DATA) is to be imported in files in the CSV format. The values of the column INFO of data type LONG of table HOTEL are to be exported from a separate file for each data record.

loadercli -p

Package history: C:\Documents and Settings\anna\Application Data\sdb\loader\log\transport.log
Package path: c:\transport
Package name: 20060322131313

Step 1: Enter a package path
Package path:
c:\transport

Step 2: Enter a package comment
Package comment:
import

Step 3: What do you want to do
[1] Transport from a source database into a target database
[2] Export from a source database
[3] Import into a target database

Step 3: 3

Step 4: Enter the source database of the export package
Database computer  :
genua
Database name       :
demodb

Step 5: Choose an export package

Export package path                        : c:\transport
Source database computer   [-nSRC]: genua
Source database name        [-dSRC]: demodb

[1]:

Export package name          : 20060322101010
Export package comment     : export_generate

[2]:

Export package name          : 20060312161616
Export package comment     : export

Step 5: 2

Step 6: Enter the target database of the export package
Database computer  :
genua
Database name       :
testdb
Database user         : mona
Password          :
red

Step 7: Enter the target database schema
Database schema:
hotel

Import package name             : 20060322131313
Import package comment          : import
Import package creation         : 20060322131313
Import package execution        : 20060322131313
Import package path             : c:\transport
Import package status       [-T]: EXECUTE
Import direction            [-t]: IMPORT
Import package              [-p]: 20060312161616
Import part                 [-P]: TABLE
Import streams              [-s]: CATALOG,DATA,PACKAGE
Import format               [-f]: CSV
Import format               [-F]: ROW
Import encoding             [-c]:
Import lobcolumn            [-l]: COLUMNVALUE
Source database computer [-nSRC]: GENUA
Source database name     [-dSRC]: DEMODB
Source database user     [-uSRC]: MONA
Target database computer [-nTRG]: GENUA
Target database name     [-dTRG]: TESTDB
Target database user     [-uTRG]: MONA
Source database table           : "HOTEL"."HOTEL"

Step 10: Continue
[1] OK
[2] CANCEL

Step 10: 1

IMPORT TABLE "HOTEL" UPDATE DUPLICATES
  CATALOG INSTREAM FILE 'HOTEL.CATALOG' DDL
  DATA    INSTREAM FILE 'HOTEL.DATA'    CSV
  Start 1 MAXROWS
  "HNO"       1 CHAR
  "NAME"      1 CHAR
  "ZIP"       1 CHAR DEFAULT NULL
  "ADDRESS"   1 CHAR
  "INFO"      1 CHAR DEFAULT NULL
  RECORDS USAGE
  ;

Package execution time   : 25.817s
Package execution log    : loader_20060322131313.log
Package name             : 20060322131313

You can see the Loader commands that are processed when import package 20060322131313 is executed in log file loader_20060322131313.log.

Repeating the Import

If you would like to repeat the import you just executed, specify the name of the import package when you call the Loader CLI:

loadercli –p 20060322131313

Step 1: Enter the source database connection
Database computer  : genua
Database name       : demodb
Database user         : mona
Password          : red

Import package name             : 20060322131313
Import package comment          : import
Import package creation         : 20060322131313
Import package execution        : 20060322151515
Import package path             : c:\transport
Import package status       [-T]: EXECUTE
Import direction            [-t]: IMPORT
Import package              [-p]: 20060312161616
Import part                 [-P]: TABLE
Import streams              [-s]: CATALOG,DATA,PACKAGE
Import format               [-f]: CSV
Import format               [-F]: ROW
Import encoding             [-c]:
Import lobcolumn            [-l]: COLUMNVALUE
Source database computer [-nSRC]: GENUA
Source database name     [-dSRC]: DEMODB
Source database user     [-uSRC]: MONA
Target database computer [-nTRG]: GENUA
Target database name     [-dTRG]: TESTDB
Target database user     [-uTRG]: MONA
Source database table           : "HOTEL"."HOTEL"

IMPORT TABLE "HOTEL" UPDATE DUPLICATES
  CATALOG INSTREAM FILE 'HOTEL.CATALOG' DDL
  DATA    INSTREAM FILE 'HOTEL.DATA'    CSV
  Start 1 MAXROWS
  "HNO"       1 CHAR
  "NAME"      1 CHAR
  "ZIP"       1 CHAR DEFAULT NULL
  "ADDRESS"   1 CHAR
  "INFO"      1 CHAR DEFAULT NULL
  RECORDS USAGE
  ;

Package execution time   : 8.025s
Package execution log    : loader_20060322151515.log
Package name             : 20060322131313

You can see the Loader commands that are processed when import package 20060322131313 is executed in log file loader_20060322151515.log.

See also:

Exporting

Transporting

Command File Mode

Session Mode

Loader, Log File