Importing Log Backups up to a Specific Time (Restore)

Use

If you do not want to restore a database instance to its last consistent state but only up to a certain point in the past, enter this point in time as an option for the import of the log backups.

The system imports the backup and asks you to specify the next data carrier. This process is repeated until the page which corresponds to the specified point in time has been imported. At this point the system ends the import of the backup and starts the database instance (Restart).

To read the prerequisites, see Database Manager CLI, recover_start, recover_replace

See also:

Restoring the Database Instance

Evaluating the Restart Information and Backup History for Importing Backups

Concepts of the Database System, Restoring the Database Instance

Scenario

You want to restore the database instance DEMODB to a consistent state up to and including the data that had been saved by 16:36:00 on 02/02/2006. Using the backup history, you have determined that this point in time must be located in the log backup logBackup.011.

You have imported the most current complete data backup. You are still in the same database session.

According to the backup history, the next page to be imported is in the log backup logBackup.009.

Procedure

In the following example, the relevant values in the output are in bold print; explanations of the output are marked as comments with the number sign (#).

       1.      Start import of log backups with data carrier logBackup.009. The log entries up to 16:36:00  on 02.02.2006 are to be imported:

dbmcli on DEMODB>recover_start DemoFileLog LOG 009 UNTIL 20060202 163600

OK

Returncode              -8020

# The specified data carrier has been imported. Return code -8020 prompts you to specify the next data carrier.

Date                    20060203

Time                    00134353

Server                  GENUA

Database                DEMODB

Kernel Version          Kernel    7.6.00   Build 016-123-109-428

Pages Transferred       1168

Pages Left              0

Volumes                 1

Medianame               LogBackupFile

Location                C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.009

Errortext

Label                   LOG_000000009

Is Consistent

First LOG Page                  17187

Last LOG Page           18452

DB Stamp 1 Date         20060202

DB Stamp 1 Time         00093758

DB Stamp 2 Date         20060202

DB Stamp 2 Time         00093819

Page Count              1265

Devices Used            1

Database ID             GENUA:DEMODB_20060125_165646

Max Used Data Page

--

       2.      Resume import of log backups with the next data carrier:

dbmcli on DEMODB>recover_replace LogBackupFile "C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup" 010

OK

Returncode              -8020

# The specified data carrier has been imported. Return code -8020 prompts you to specify the next data carrier.

Date                    20060203

Time                    00134353

Server                  GENUA

Database                DEMODB

Kernel Version          Kernel    7.6.00   Build 016-123-109-428

Pages Transferred       2032

Pages Left              0

Volumes                 1

Medianame               LogBackupFile

Location                C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.010

Errortext

Label                   LOG_000000010

Is Consistent

First LOG Page                  18453

Last LOG Page           20670

DB Stamp 1 Date         20060202

DB Stamp 1 Time         00163233

DB Stamp 2 Date         20060202

DB Stamp 2 Time         00163447

Page Count              2217

Devices Used            1

Database ID             GENUA:DEMODB_20060125_165646

Max Used Data Page

---

       3.      Resume import of log backups with the next data carrier:

dbmcli on DEMODB>recover_replace LogBackupFile "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup" 011

OK

Returncode              0

# The specified data carrier has been imported. Return code 0 tells you that all log entries that had been written up to the specified point in time have been imported.

Date                    20060203

Time                    00134353

Server                  GENUA

Database                DEMODB

Kernel Version          Kernel    7.6.00   Build 016-123-109-428

Pages Transferred       1280

Pages Left              0

Volumes                 1

Medianame               LogBackupFile

Location                C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups.011

Errortext

Label                   LOG_000000011

Is Consistent

First LOG Page                  20671

Last LOG Page           23024

DB Stamp 1 Date         20060202

DB Stamp 1 Time         00163601

DB Stamp 2 Date         20060202

DB Stamp 2 Time         00163604

Page Count              2353

Devices Used            1

Database ID             GENUA:DEMODB_20060125_165646

Max Used Data Page

---

dbmcli on DEMODB>

Result

The system has imported the log backups up to the specified point in time and subsequently transferred the database instance to the ONLINE operational state.