Collection Contents Index Synchronizing databases Synchronizing data over a message system pdf/chap9.pdf

Data Replication with SQL Remote
   PART 3. SQL Remote Administration
     CHAPTER 9. Deploying and Synchronizing Databases       

Using the extraction utility


The extraction utility is an aid to creating remote Adaptive Server Anywhere databases. It cannot be used to create remote Adaptive Server Enterprise databases.

Running the extraction utility 

The extraction utility can be accessed in the following ways:

Caution    
Do not run the Message Agent while running the extraction utility. The results are unpredictable.

Top of page  Creating a database from the reload files

The command-line utility unloads a database schema and data suitable for building a remote Adaptive Server Anywhere database for a named subscriber. It produces a SQL command file with default name reload.sql and a set of data files. You can use these files to create a remote Adaptive Server Anywhere database.

Editing of reload.sql may be needed    
The database extraction utility 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.

  To create a remote database from the reload file:
  1. Create an Adaptive Server Anywhere database using Sybase Central or using the dbinit utility.

  2. Connect to the database from the Interactive SQL utility, and run the reload.sql command file. The following statement entered in the Interactive SQL command window runs the reload.sql command file:

    read path\reload.sql

    where path is the path of the reload command file.

When used from Sybase Central, the extraction utility carries out the database unloading task, in the same way that dbxtract or ssxtract does, and then takes the additional step of creating the new database.

The extraction utility does not use a message system. The reload file (ssxtract/dbxtract) or database (from Sybase Central) is created in a directory accessible from the current machine. Synchronizing many subscriptions over a message link can produce heavy message traffic and, if the message system is not completely reliable, it may take some time for all the messages to be properly received at the remote sites.

Top of page  Before extracting a database

You must complete the following tasks before using the extraction utility at a consolidated database.

For Info     For a description of how to carry out these steps, see the tutorial in the chapter A Tutorial for Adaptive Server Anywhere Users.

When you use the extraction utility to create a remote database, the user for which you are creating the database receives the same permissions they have in the consolidated database. Further, if the user is a member of any groups on the consolidated database, those group IDs are created in the remote database with the permissions they have in the consolidated database.

Top of page  Using the extraction utility from Sybase Central

For full information on using the extraction utility from Sybase Central, see the Sybase Central online Help. This section describes one way to extract a database for a remote user from the current consolidated database.

  To extract a database for a remote user:
  1. Click the Remote Users folder on the left panel, which is in the SQL Remote folder. The right panel displays the remote users.

  2. Right-click the remote user for whom you wish to extract a database, and select Extract Database from the popup menu. The Extraction Wizard is displayed.

  3. Follow the instructions in the Wizard.

For more information 

For information about the extraction utility options, available as command-line options or as choices presented by the Database Extraction Wizard, see Extraction utility options.

Top of page  Designing an efficient extraction procedure

It is very inefficient to create a large number of remote databases by running the extraction utility for each one. You can make the process much more efficient. This section describes one way of making the process more efficient.

There are several potential causes of inefficiency in a large-scale extraction process:

An efficient approach to extracting many databases 

One approach that avoids these problems is as follows:

  1. Make a copy of the consolidated database, and at the same time start the subscriptions from the live database. Messages will now start being sent to subscribers, even though they have no database and will not receive them yet.

    To start several subscriptions within a single transaction, use the REMOTE RESET statement (Adaptive Server Anywhere ) or sp_remote procedure (Adaptive Server Enterprise).

  2. Extract the remote databases from the copy of the database. As the database is a copy, there are no locking and concurrency problems. For a large number of remote databases, this process may take several days.

  3. As each remote database is created, it is out of date, but its user can receive and apply messages that have been being sent from the live consolidated database, to bring themselves up to date.

This solution interferes with the production database only during the first step. The copy must be made at isolation level three if the database is in use, and uses large numbers of locks. Also, the subscriptions must be started at the same time that the copy is made. Any operations that take place between the copy and the starting of the subscriptions would be lost, and could lead to errors at remote databases.

Top of page  Limits to using the extraction utility

While the extraction utility is the recommended way of creating and synchronizing remote databases from a consolidated databases, there are some circumstances where it cannot be used, and you must synchronize remote databases manually. This section describes some of those cases.

Top of page  Using the extraction utility for Adaptive Server Enterprise

The extraction utility for Adaptive Server Enterprise takes an Adaptive Server Enterprise database schema, and produces an Adaptive Server Anywhere database. There are several limitations and techniques specific to this tool.

Top of page  Adaptive Server Enterprise features unsupported in Adaptive Server Anywhere

There are some features in Adaptive Server Enterprise that are either not supported or are only partially supported in Adaptive Server Anywhere. The extraction utility handles some of these features partially, and some not at all.

For Info     For a full description of Adaptive Server Enterprise/Adaptive Server Anywhere compatibility, see the part Transact-SQL Compatibility, in the Adaptive Server Anywhere User's Guide.

Features not supported in ssxtract include the following:

Top of page  Customizing the system tables

The objects that are to be loaded into an Adaptive Server Anywhere database are described in the system catalog. The extraction utility for Adaptive Server Enterprise first creates a set of Adaptive Server Anywhere system tables in TEMPDB, and fills them with data from the Adaptive Server Enterprise catalog. It then unloads this set of tables to provide the reload script that in turn builds an Adaptive Server Anywhere database.

There may be cases where you wish to change the content of the Adaptive Server Anywhere system tables held in TEMPDB. SQL Remote provides a place for you to do that.

The stored procedure that creates and fills the Adaptive Server Anywhere system objects in TEMPDB is called sp_populate_sql_anywhere. As its final operation, this procedure calls a procedure called sp_user_extraction_hook. This procedure, by default, does nothing. If you wish to customize the extraction procedure, you can do so by writing a suitable sp_user_extraction_hook procedure.

Top of page  

Collection Contents Index Synchronizing databases Synchronizing data over a message system pdf/chap9.pdf