Extracting remote databases to a reload file

For information about extracting remote databases to a reload file and its alternative automatically extracting remote databases, see Extracting remote databases.

In most deployment scenarios, you need to customize the extraction and creation of remote databases. You can create a custom extraction by choosing to extract the database into a command file and a series of text files. Then, you can edit these files as required.

When you extract the database into files, you decide whether to create:

  • A SQL command file named reload.sql, which contains the statements necessary to build the remote database schema.   See -n option Extraction utility (dbxtract).

    For example, run the following command:

    dbxtract -c "UID=DBA;PWD=sql;DBF=c:\cons\cons.db" -n "c:\remote\reload.sql" UserName

  • A series of data files, each of which contains the contents of a database table.   A series of data files, each of which contains the contents of a database table. A new directory is created, named extract, to contain the data files. You can use these files to load data into an existing remote database. See -d option Extraction utility (dbxtract).

    For example, run the following command:

    dbxtract -c "UID=DBA;PWD=sql;DBF=c:\cons\cons.db" -d "c:\remote1\" UserName

  • Both the reload.sql file and the data files.    A new directory is created, named extract, to contain the data files. The reload.sql file contains instructions to load the data files. For example, run the following command:
    dbxtract -c "UID=DBA;PWD=sql;DBF=c:cons\cons.db" "c:\remote1\reload.sql" UserName

The reload.sql file

The reload.sql file contains the SQL statements to build the database schema, which includes the commands to create:

Editing of reload.sql may be needed

The Extraction utility (dbxtract) is intended to assist in preparing remote databases, but is not intended as a black box solution for all circumstances. You should edit the reload.sql command file as needed when creating remote databases. See Editing the reload.sql file.

Use the following procedure to create a remote database using a reload.sql file.

To create a remote database from the reload.sql file (command line)
  1. Use the Extraction utility (dbxtract) to extract the database schema and data to files. For example, run the following command:

    dbxtract -c "UID=DBA;PWD=sql;DBF=c:cons\cons.db" "c:\remote\reload.sql" UserName

    By default, subscriptions for the specified remote user are started automatically.

  2. Edit the reload.sql, if required. See Editing the reload.sql file.

  3. Create an empty SQL Anywhere database.

    For example, run the following command:

    dbinit c:\rem1\rem1.db
  4. Connect to the database from Interactive SQL, and run the reload.sql command file.

    For example, run the following command:

    READ remote\reload.sql

    The new remote database, rem1.db, is created with the appropriate schema, remote users, publications, subscriptions, and triggers. However, the Extraction utility (dbxtract) does not start the Message Agent, so no messages are exchanged. See Understanding the Message Agent (dbremote).

See also

Editing the reload.sql file
Extracting databases for a multi-tier hierarchy system
Creating multiple remote databases