You can use the IMPORT DB command to import all the data belonging to a database application.
You require the TESTDB demo database.
You have exported the required data using the EXPORT DB Command.
The IMPORT DB
command can only be executed by the database system administrator (SYSDBA
user). Start the Loader as database administrator and log on to the demo
database TESTDB. Use the session
mode.
loadercli -d demodb –u dbadmin,secret
Data is to be imported into the TESTDB database.
You can make entries after the keyword CATALOG and/or DATA to select what is to be imported, the database catalog and/or the data belonging to the application.
If you import
a table, the Loader also creates all the objects and links (views, foreign key
dependencies with other tables…) that are defined for the table. If the
necessary objects are not present and the import therefore cannot be executed,
the Loader notifies you of the fact. Typical error messages include: -25451 and
-25392. If
these errors occur, the import is terminated at this point.
You can import the database catalog information for all database users belonging to the application of a database.
IMPORT DB
CATALOG INSTREAM
'demodb_ddl.catalog'
The database catalog (CATALOG) is imported in the DDL format (default value).
See also:
Loader, Data
Stream
You can import the application data for all database users.
IMPORT DB
DATA INSTREAM
'demodb_pages.data'
The application data (DATA) is imported in the PAGES format (default value).
IMPORT DB
DATA INSTREAM 'demodb_records.data'
RECORDS
The application data (DATA) is imported in the RECORDS format.
A PAGES import uses a database format (based on a page) and does not write log entries, so it is faster than an import that uses the RECORDS format of the Loader. However, the tables imported in the PAGES format are write-protected until you back up the data.
See also:
Loader, PAGES,
RECORDS
You can import the data belonging to a database application
IMPORT DB
CATALOG INSTREAM
'demodb_ddl.catalog'
DATA INSTREAM
'demodb_pages.data'
Observe the sequence of the syntax elements. Always enter the syntax element for the import of the database catalog first, and then the syntax element for the import of the application data.
By specifying a data stream after the keyword CONFIGURATION, you can exclude the application data of the tables specified in this data stream. The tables must be identified in the data stream by specifying their schema and the table name.
Test the Loader behavior for different tables. When you exclude tables, you must be careful not to violate any dependencies, such as by excluding the tables CITY or HOTEL.
You want to exclude the EMPLOYEE table from the import. Create the employee.configuration file with the following contents:
HOTEL,EMPLOYEE
Specify the following import command in the Loader session mode. Observe the sequence of the syntax elements. First, enter the syntax element that excludes the table from the import.
IMPORT DB
CONFIGURATION INSTREAM
'employee.configuration'
CATALOG INSTREAM
'demodb_ddl.catalog'
DATA INSTREAM 'demodb_pages.data'
The database catalog entries of all tables are always imported, regardless of the restrictions made in employee.configuration.
If you specify a data stream after the keyword PACKAGE, the command entries from the SYSLOADER.TRANSFORMATIONMODEL table are exported to the specified data stream. This is an additional log option. Always enter the PACKAGE syntax element as the last syntax element.
IMPORT DB
CATALOG INSTREAM 'demodb_ddl.catalog'
PACKAGE OUTSTREAM
'demodb_csv.package'
See also:
Loader, Additional Log
Functions (package_spec)
Combining the syntax options can result in correspondingly complex commands. Observe the sequence of the syntax elements.
IMPORT DB
CONFIGURATION INSTREAM FILE 'employee.configuration' CSV ASCII
CATALOG INSTREAM FILE 'demodb_ddl.catalog' DDL
DATA INSTREAM FILE 'demodb_pages.data' PAGES
PACKAGE OUTSTREAM FILE 'demodb_import.package'
CSV
For a complete
syntax description, see IMPORT DB Command
in the Loader documentation.
See also:
Other commands for Importing