Starting a Standby Instance as the Active Instance

Use

You can start a standby instance with the current dataset of the original instance or with the dataset as it was in the original instance at a particular point in time in the past.

To start the standby instance with the current dataset of the original instance, you stop the original instance, execute a final log backup in the original instance, import this log backup into the standby instance and then start the standby instance.

You can only start the standby instance with the dataset of the original instance as it was at a point in time in the past if, until now, the log backups that have been imported into the standby instance are from before the desired point in time.

When you import the log backups, you specify the point in time up to which you want the system to import the log entries. If you have the log backups from the original instance imported automatically into the standby instance, then cancel this operation now. Then you start the import of the log backups once again and specify the point in time up to which you want the system to import the log entries.

The system imports the log entries and asks you to specify the succeeding data carrier(s) until it has reached the log entries that were written at the specified point in time. At this point the system ends the import of the log entries and transfers the database instance to the ONLINE operational state.

If a problem with the original instance has made it impossible to execute a final log backup, but the log volumes of the original instance are still intact, you can use operating system commands to copy their contents to the volumes of the standby instance.

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

See also:

Setting Up and Updating Standby Instances

Copying Log Volumes with Operating System Commands

Concepts of the Database, Standby Database

Scenario

On the local computer you have a standby instance named TESTDB for the database instance DEMODB on computer GENUA. Using a script, the log backups created by DEMODB are automatically imported into TESTDB at defined intervals.

On February 2, 2006 at 16:36:10 there was a hardware error in the data area in DEMODB. So you decide to restore the standby instance TESTDB to its state on February 2, 2006 at 16:36:00 and start it in that state.

Procedure

In the following section, explanations of the output are in bold print and marked as comments with the number sign (#).

...

       1.      The first step depends on whether you have, to this point, imported log backups into TESTDB automatically or manually.

0     If you have the log backups from the original instance imported automatically into the standby instance TESTDB, then cancel this operation now:
dbmcli on TESTDB>recover_cancel

OK

Returncode              0

Date

Time

Server

Database

Kernel Version

Pages Transferred       0

Pages Left              0

Volumes

Medianame

Location

Errortext

Label

Is Consistent

First LOG Page

Last LOG Page

DB Stamp 1 Date

DB Stamp 1 Time

DB Stamp 2 Date

DB Stamp 2 Time

Page Count              0

Devices Used

Database ID

Max Used Data Page

----

dbmcli on TESTDB>

Then transfer TESTDB to the ADMIN operational state:

dbmcli on TESTDB>db_admin

OK

0     If you have imported the log backups from DEMODB into TESTDB manually, you can now call the Database Manager CLI in session mode, log on as operator DBM with password DBM and connect to the standby instance TESTDB:

>dbmcli –u DBM,DBM –d TESTDB

dbmcli on TESTDB>

       2.      Open a database session:

dbmcli on TESTDB>db_connect

OK

       3.      Start the import of the missing log backups up to the desired point in time:

dbmcli on TESTDB>recover_start LogSave 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                \\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackupFeb.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

--

dbmcli on TESTDB>recover_replace LogBackupFile "C:\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackupFeb" 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                \\GENUA\\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackupFeb.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

---

dbmcli on TESTDB>recover_replace LogBackupFile "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackupFeb" 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                \\GENUA\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 TESTDB>

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.

You can now operate the standby instance as the active instance.