## Export

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

### Prerequisites

For a description of the prerequisites, see Transport Mode.

### Executing the Export

You want to export table HOTEL of schema HOTEL of user MONA from database DEMODB. The application data (DATA) is to be exported in files in the CSV format. The values of the column INFO of data type LONG of table HOTEL are to be exported to 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: 20060312161616

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

Step 2: Enter a package comment
Package comment: export

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: 2

Step 4: What do you want to do
[1] Choose an export package
[2] Create an export package

Step 4: 2

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

Step 6: Choose what you want include into the package
[1] Complete user; one file per user
[2] Complete user; one file per user, excluding some tables
[3] Complete user; one file per table
[4] Complete user; one file per table, excluding some tables
[5] Complete schema; one file per schema
[6] Complete schema; one file per schema, excluding some tables
[7] Complete schema; one file per table
[8] Complete schema; one file per table, excluding some tables
[9] Schema tables ; one file per table

Step 6: 9

Step 7: Enter the source database connection
Database schema : hotel

Step 8: Enter the table names you want include into the package

[1] hotel

[2]

Step 9: Choose the transformation streams
[1] Catalog and data
[2] Catalog
[3] Data

Step 9: 1

Step 10: Do you want to specify the data stream format
[1] Yes
[2] No

Step 10: 1

Step 11: How do you want to export the data stream
[1] Comma separated values; one file per lob column
[2] Comma separated values; one file per lob value
[3] Fixed width values; one file per lob column
[4] Fixed width values; one file per lob value
[5] Platform independent loader records format (with logging)
[6] Platform independent database page format (without logging, backup necessary)

Step 11: 2

Step 12: How do you want to import the data
[1] Row by row (with logging)
[2] Row by page (without logging, backup necessary)

Step 12: 1

Step 13: The package can be executed or generated now.
[1] Execute package to transport data now
[2] Generate package to transport data later

Step 13: 1

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

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

Step 14: 1

EXPORT TABLE "HOTEL"
CATALOG OUTSTREAM FILE 'HOTEL.CATALOG' DDL
DATA OUTSTREAM FILE 'HOTEL.DATA' CSV
Start 1 MAXROWS
LOB OUTSTREAM FILE "INFO" 'HOTEL_INFO.DATA###'
;

Package execution time : 10.039s
Package execution log : loader_20060312161616.log
Package name : 20060312161616

You can see the Loader commands that are processed when export package 20060312161616 is executed in log file loader_20060312161616.log.

#### Repeating the Export

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

loadercli –p 20060312161616

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

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

EXPORT TABLE "HOTEL"
CATALOG OUTSTREAM FILE 'HOTEL.CATALOG' DDL
DATA OUTSTREAM FILE 'HOTEL.DATA' CSV
Start 1 MAXROWS
LOB OUTSTREAM FILE "INFO" 'HOTEL_INFO.DATA###'
;

Package execution time : 2.152s
Package execution log : loader_20060312171717.log
Package name : 20060312161616

You can see the Loader commands that are processed when export package 20060312161616 is executed in log file loader_20060312171717.log.

#### Generating an Export Package

If you want to generate an export package without executing it, proceed as follows:

loadercli –p

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

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

Step 2: Enter a package comment
Package comment: export_generate

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: 2

Step 4: What do you want to do
[1] Choose an export package (updates data)
[2] Create an export package

Step 4: 2

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

Step 6: Choose what you want include into the package
[1] Complete user; one file per user
[2] Complete user; one file per user, excluding some tables
[3] Complete user; one file per table
[4] Complete user; one file per table, excluding some tables
[5] Complete schema; one file per schema
[6] Complete schema; one file per schema, excluding some tables
[7] Complete schema; one file per table
[8] Complete schema; one file per table, excluding some tables
[9] Schema tables ; one file per table

Step 6: 9

Step 7: Enter the source database connection
Database schema : hotel

Step 8: Enter the table names you want include into the package

[1] hotel

[2]

Step 9: Choose the transformation streams
[1] Catalog and data
[2] Catalog
[3] Data

Step 9: 1

Step 10: Do you want to specify the data stream format
[1] Yes
[2] No

Step 10: 1

Step 11: How do you want to export the data stream
[1] Comma separated values; one file per lob column
[2] Comma separated values; one file per lob value
[3] Fixed width values; one file per lob column
[4] Fixed width values; one file per lob value
[5] Platform independent loader records format (with logging)
[6] Platform independent database page format (without logging, backup necessary)

Step 11: 2

Step 12: How do you want to import the data
[1] Row by row (with logging)
[2] Row by page (without logging, backup necessary)

Step 12: 1

Step 13: The package can be executed or generated now.
[1] Execute package to transport data now
[2] Generate package to transport data later

Step 13: 2

Export package name : 20060322101010
Export package comment : export_generate
Export package creation : 20060322101010
Export package execution : 20060322101010
Export package path : c:\transport
Export package status [-T]: EXECUTE
Export direction [-t]: GENERATE
Export package [-p]: TABLE
Export part [-P]: TABLE
Export streams [-s]: CATALOG,DATA,PACKAGE
Export format [-f]: CSV
Export format [-F]: ROW
Export encoding [-c]:
Export lobcolumn [-l]: COLUMNVALUE
Source database computer [-nSRC]: GENUA
Source database name [-dSRC]: DEMODB
Source database user [-uSRC]: MONA
Source database table : "HOTEL"."HOTEL"

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

Step 14: 1

EXPORT TABLE "HOTEL"
CATALOG OUTSTREAM FILE 'HOTEL.CATALOG' DDL
DATA OUTSTREAM FILE 'HOTEL.DATA' CSV
Start 1 MAXROWS
LOB OUTSTREAM FILE "INFO" 'HOTEL_INFO.DATA###'
;

Package execution time : 11.195s
Package name : 20060322101010

#### Executing a Generated Export Package

If you would like to execute an export package you have generated, specify the name of the export package when you call the Loader CLI:

loadercli –p 20060322101010

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

Export package name : 20060322101010
Export package comment : export_generate
Export package creation : 20060322101010
Export package execution : 20060322121212
Export package path : c:\transport
Export package status [-T]: EXECUTE
Export direction [-t]: EXPORT
Export package [-p]: 20060322101010
Export part [-P]: TABLE
Export streams [-s]: CATALOG,DATA,PACKAGE
Export format [-f]: CSV
Export format [-F]: ROW
Export encoding [-c]:
Export lobcolumn [-l]: COLUMNVALUE
Source database computer [-nSRC]: GENUA
Source database name [-dSRC]: DEMODB
Source database user [-uSRC]: MONA
Source database table : "HOTEL"."HOTEL"

EXPORT TABLE "HOTEL"
CATALOG OUTSTREAM FILE 'HOTEL.CATALOG' DDL
DATA OUTSTREAM FILE 'HOTEL.DATA' CSV
Start 1 MAXROWS
LOB OUTSTREAM FILE "INFO" 'HOTEL_INFO.DATA###'
;

Package execution time : 2.058s
Package execution log : loader_20060322121212.log
Package name : 20060322101010

You can see the Loader commands that are processed when export package 20060322101010 is executed in log file loader_20060322121212.log.

See also:

Importing

Transporting.

Command File Mode

Session Mode

Loader, Log File