Recover a database with multiple transaction logs using the dbtran utility

To maintain the integrity of your data when you use dbtran to translate multiple transaction logs, you must specify both the -m and -n options. The -m option instructs the Log Translation utility (dblog) to generate a file (named by -n) containing all the transactions from the logs in the specified directory.

You need to use -m because any transactions that span transaction log files could be rolled back if you translate each log individually using dbtran. When dbtran translates a log, it adds a ROLLBACK statement to the end of the log to undo any uncommitted transactions. In cases where a transaction spans two logs, the COMMIT for the transaction occurs in the second log file. Operations at the end of the first log file would be rolled back by dbtran because the file does not contain a COMMIT for the transaction. Translating all the transaction log files in a directory using -m ensures that all of your transactions are translated. See Transaction Log utility (dblog).

To recover from multiple transaction logs using the dbtran utility
  1. Run the Log Translation utility (dbtran) against the directory containing the transaction log files and output the resulting SQL statements into a .sql file.

  2. Start the backup copy of your database.

  3. Apply the .sql file generated by dbtran in step 1 to the backup copy of your database from Interactive SQL.

Example

The following example uses the dbtran utility to apply the backup and current transaction logs to the backup copy of the database.

  1. Run the Log Translation utility against the c:|backup directory and output the SQL statements into a file called recoverylog.sql:

    dbtran -m "c:\backup" -n recoverylog.sql
  2. Start the backup copy of the database called backupdemo.db:

    dbeng11 backupdemo.db
  3. Apply the recoverylog.sql file to the database from Interactive SQL:

    dbisql -c "UID=DBA;PWD=sql;ENG=backupdemo" READ recoverylog.sql
See also