ASA SQL User's Guide
Importing and Exporting Data
Rebuilding databases
The following steps help you rebuild a database while minimizing downtime. This can be especially useful if your database is in operation 24 hours a day.
It's wise to do a practice run of steps 1-4, and determine the times required for each step, prior to beginning the actual backup. You may also want to save copies of your files at various points during the rebuild.
Make sure that no other scheduled backups rename the production database's log. If this happens in error, you will need to apply the transactions from these renamed logs to the rebuilt database in the correct order.
To rebuild a database and minimize the downtime
Using DBBACKUP -r, create a backup of the database and log, and rename the log.
Rebuild the backed up database on another machine.
Do another DBBACKUP -r on the production server to rename the log.
Run DBTRAN on the log from step 3 and apply the transactions to the rebuilt server.
You now have a rebuilt database that contains all transactions up to the end of the backup in step 3.
Shut down the production server and make copies of the database and log.
Copy the rebuilt database onto the production server.
Run DBTRAN on the log from step 5.
This should be a relatively small file.
Start the server on the rebuilt database, but don't allow users to connect.
Apply the transactions from step 8.
Allow users to connect.