This section applies to SQL Anywhere MobiLink clients (clients using dbmlsync), as well as SQL Remote and Replication Agent.
If a database is participating in synchronization or replication, particular care needs to be taken if you want to rebuild the database. Synchronization and replication are based on the offsets in the transaction log. When you rebuild a database, the offsets in the old transaction log are different than the offsets in the new log, making the old log unavailable. For this reason, good backup practices are especially important when participating in synchronization or replication.
There are two ways of rebuilding a database involved in synchronization or replication. The first method uses the dbunload utility -ar option to make the unload and reload occur in a way that does not interfere with synchronization or replication. The second method is a manual method of accomplishing the same task.
To rebuild a database involved in synchronization or replication (dbunload utility)
Shut down the database.
Perform a full off-line backup by copying the database and transaction log files to a secure location.
Run the following dbunload command to rebuild the database:
dbunload -c connection-string -ar directory |
The connection-string is a connection with DBA authority, and directory is the directory used in your replication environment for old transaction logs. There can be no other connections to the database.
The -ar option only applies to connections to a personal server, or connections to a network server over shared memory.
For more information, see Unload utility (dbunload).
Shut down the new database and then perform the validity checks that you would usually perform after restoring a database.
For more information about validity checking, see Validating a database.
Start the database using any production options you need. You can now allow user access to the reloaded database.
There are additional options available for the dbunload utility that allow you to tune the unload, as well as connection parameter options that allow you to specify a running or non-running database and database parameters. See Unload utility (dbunload).
If the above procedure does not meet your needs, you can manually adjust the transaction log offsets. The following procedure describes how to perform that operation.
To rebuild a database involved in synchronization or replication, with manual intervention
Shut down the database.
Perform a full off-line backup by copying the database and transaction log files to a secure location.
Run the dbtran utility to display the starting offset and ending offset of the database's current transaction log file.
Note the ending offset for use in Step 8.
Rename the current transaction log file so that it is not modified during the unload process, and place this file in the dbremote off-line logs directory.
Rebuild the database.
For information about this step, see Rebuilding databases.
Shut down the new database.
Erase the current transaction log file for the new database.
Use dblog on the new database with the ending offset noted in Step 3 as the -z parameter, and also set the relative offset to zero.
dblog -x 0 -z 0000698242 -il -ir -is database-name.db |
When you run the Message Agent, provide it with the location of the original off-line directory on its command line.
Start the database. You can now allow user access to the reloaded database.
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |