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 is wise to do a practice run of steps 1-4, and determine the times required for each step, prior to beginning the actual rebuild. 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.
Using dbbackup -r, create a backup of the database and log, and rename the log.
For more information, see Backup utility (dbbackup).
Rebuild the backed up database on another computer.
Perform another dbbackup -r on the production server to rename the transaction log.
Run dbtran on the transaction log and apply the transactions to the rebuilt server.
For more information, see Log Translation utility (dbtran).
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 do not allow users to connect.
Apply the transactions from Step 8.
Allow users to connect.