The following steps describe how to start the database server so it automatically applies all the transaction logs to the database in the correct order. When you specify the -ad option, the database server looks in the specified directory for the transaction logs for the database. It then determines the correct order to apply the logs based on the log offsets.
The following procedure assumes that previous backups of the database file have been made and are available, for example on tape.
Make a copy of the database and log file.
Restore the database (.db) file, not the log file, from tape into a temporary directory.
In the temporary directory, start the database, applying the transaction logs using the -ad option.
Start the database in your normal way.
Any new activity is appended to the current transaction log.
Suppose you have a consolidated database file named c:\dbdir\cons.db. The transaction log file c:\dbdir\cons.log is mirrored to d:\mirdir\cons.mlg.
Assume that you perform full backups weekly using the following command:
dbbackup -c "uid=DBA;pwd=sql" -r e:\backdir
Assume that you also perform incremental backups daily using the following command:
dbbackup -c "uid=DBA;pwd=sql" -r -t e:\backdir
This command backs up the transaction log cons.log to the directory e:\backdir. The transaction log file is then renamed to datexx.log, where date is the current date and xx is the next set of letters in sequence, and a new transaction log is started. The directory e:\backdir is then backed up using a third-party utility.
In this scenario you would be running the Message Agent with the optional directory to point to the renamed transaction log files. The Message Agent command line would be
dbremote -c "uid=DBA;pwd=sql" c:\dbdir
On the third day following the weekly backup, the database file gets corrupted because of a bad disk block.
Replace the c:\ drive.
Back up the mirrored transaction log d:\mirdir\cons.mlg.
Create a temporary directory to perform the recovery in. In this example, it is called c:\recover.
Restore the most recent backup of the database file, cons.db to c:\recover\cons.db.
Copy the backed up transaction logs to c:\dbdir.
Apply the renamed transaction logs:
dbeng10 c:\recover\cons.db -ad c:\dbdir
Copy the current transaction log, c:\dbdir\cons.log to the recovery directory, giving c:\recover\cons.log.
Start the database using the following command:
Shut down the database server.
Back up the recovered database and transaction log from c:\recover.
Copy the files from c:\recover to the appropriate production directories:
Copy c:\recover\cons.db to c:\dbdir\cons.db.
Copy c:\recover\cons.log to c:\dbdir\cons.log, and to d:\mirdir\cons.mlg.
Restart your system as normal.