Background documentationIMPORT USER Locate this document in the navigation structure

 

You can import user data exported from a database using the EXPORT USER command into a database. Use the IMPORT USER command to do so. The data imported into the database belongs to the database user logged onto the database at the time of the import.

Prerequisites

You can use the demo databases DEMODB and TESTDB. You have exported the required data from demo database DEMODB. In demo database TESTDB, create the data administrator MONA if you have not already done so. Start the Loader and log onto database TESTDB as database administrator MONA with the password RED. Use the session mode: loadercli -d testdb -u mona,red..

Activities

Data for the database user MONA is to be imported into the TESTDB database. You can make entries after the keywords CATALOG and/or DATA to select what is to be imported, the database catalog and/or the application data.

Caution Caution

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 this fact. Typical error messages include -25451 and -25392. If these errors occur, the import is terminated at this point.

End of the caution.
Importing the Database Catalog for the Current Database User

You can import the user-specific database catalog information belonging to the application.

IMPORT USER

  CATALOG INSTREAM 'mona_ddl.catalog'

The database catalog (CATALOG) is imported in the DDL (default value) format.

See also: Loader, Data Stream

Importing the Application Data for the Current Database User

You can import the user-specific application data.

IMPORT USER

  DATA INSTREAM 'mona_pages.data'

The application data (DATA) is imported in the PAGES format (default value).

IMPORT USER

  DATA INSTREAM 'mona_pages.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

Importing the Database Catalog and the Application Data for the Current Database User

You can import the data that was exported specifically for a user.

IMPORT USER

  CATALOG INSTREAM 'mona_ddl.catalog'

  DATA INSTREAM 'mona_pages.data'

Note 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.

Excluding Tables from the Import

By specifying a data stream after the keyword CONFIGURATION, you can exclude the application data of selected tables that are specified in this data stream. The tables must be identified in the data stream by specifying the schema and 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. Note the sequence of the syntax elements. First, enter the syntax element that excludes the table from the import.

IMPORT USER

  CONFIGURATION INSTREAM 'employee.configuration'

  CATALOG INSTREAM 'mona_ddl.catalog'

  DATA INSTREAM 'mona_pages.data'

The database catalog entries of all tables are always imported, regardless of the restrictions made in employee.configuration.

Additional Log Functions

If you specify a data stream after the keyword PACKAGE, the command entries in the SYSLOADER.TRANSFORMATIONMODEL table are exported to this data stream. This is an additional logging option. Always enter the PACKAGE syntax element as the last syntax element.

IMPORT USER

  CATALOG INSTREAM 'mona_ddl.catalog'

  PACKAGE OUTSTREAM 'mona_csv.package'

See also: Loader, Additional Log Functions (package_spec)

Complete Syntax of the IMPORT USER Command

Combining the syntax options can result in correspondingly complex commands. Note the sequence of the syntax elements.

IMPORT USER

  CONFIGURATION INSTREAM FILE 'employee.configuration' CSV ASCII

  CATALOG INSTREAM FILE 'mona_ddl.catalog' DDL

  DATA INSTREAM FILE 'mona_pages.data' PAGES

  PACKAGE OUTSTREAM FILE 'mona_csv.package' CSV

For a complete syntax description, see IMPORT USER command in the Loader documentation.

More Information

Other commands for Importing

Session Mode