To generate a standby instance, you first import a complete data backup, followed by all subsequent log backups from one database instance (original instance), into another database instance (standby instance). You do not have to stop the original instance to set up a standby instance. It remains operable throughout. For security reasons, the original instance and the standby instance are located on different database computers.
First you create a new database instance to set up as the standby instance.
For this standby instance you define a backup template for a complete data backup and a backup template for a log backup. The values defined for the properties type, backup type, size, block size and overwrite in these two templates have to be identical to the values of the backup template that was used to create the backup of the original instance. The backup template nameis freely selectable; the data carrier (device/file) property must refer to the location at which the complete data backup or the log backups of the source database are stored.
Now you import the complete data backup into the standby instance and thereby initialize it.
The standby instance is now ready for regular imports of the log backups. We recommend that you automate this process using scripts. You can, however, import log backups manually as well.
You determine which backup is to be imported next from the data in the restart information and the backup history.
If at any point since the initialization you have unintentionally transferred the database instance to the ONLINE operational state while importing the data backup, you have to start the import of the complete data backup with initialization all over again.
To read the
prerequisites, see Database Manager CLI, db_activate
RECOVER,
recover_start,
recover_replace
See also:
Creating and Configuring a Database Instance
Creating a Database Copy (Importing a Data Backup into Another Database Instance)
Evaluating the Restart Information and Backup History for Importing Backups
Concepts of the Database, Standby
Database
You want to
generate a standby instance TESTDB for your database instance DEMODB. You have
created a complete data backup of DEMODB using a backup template with the
following properties:
Name: DemoDataCompl
Data carrier (device/file): Backups 2005\Data\completeDataJan
Type: File
Backup type: complete data backup (DATA)
Size restriction: none (0)
Block size: 6
Overwrite: NO
You continually
back up the log entries from DEMODB using the backup template DemoFileLog with the following properties:
Data carrier
(device/file):Backups 2005\Data\logBackup
Type: File
Backup type: automatic log backup (AUTO)
No size restriction
The backup history tells you that after the data backup, the log page with the number 37746 is to be imported and that this log page must be located in the log backup with the version number 018.
DEMODB is on computer GENUA. TESTDB should be created on the local computer. GENUA and the local computer are compatible.
...
1. Create the new database instance TESTDB:
Use the same version of the database software that you used to create DEMODB. Configure TESTDB with the same parameter values as DEMODB.
See Creating and Configuring a Database Instance
2. Call the Database Manager CLI in session mode, log on as operator DBM with the password DBM, connect to the database instance TESTDB.
>dbmcli –u DBM,DBM –d TESTDB
dbmcli on TESTDB>
3. Define a backup template for a complete data backup:
Define the new backup template with the same properties as the one that was used to create the complete data backup of DEMODB. One exception is the property Data carrier (device/file). Here the path has to point to the location at which the complete data backup of DEMODB is stored:
Backup
template name: DataSave
Data carrier (device/file): \\GENUA\Documents and Settings\All
Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\completeDataJan
Type: FILE
Backup type: complete data backup (DATA)
Size restriction: none (0)
Block size: 6
Overwrite: NO
dbmcli on TESTDB>medium_put DataSave "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\completeDataJan" FILE DATA 0 6 NO
4. Define a backup template for a log backup:
Define the new backup template with the same properties as the one that was used to create the log backups of DEMODB. One exception is the property Data carrier (device/file). Here the path has to point to the location at which the files of the log backups of DEMODB are stored:
Backup
template name: LogSave
Data carrier (device/file): \\GENUA\Documents and Settings\All
Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup
Type: FILE
Backup type: log backup (LOG)
Size restriction: none (0)
Block size: 6
Overwrite: NO
dbmcli on TESTDB>medium_put LogSave "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup" FILE LOG 0
5. Transfer TESTDB to the ADMIN operational state:
dbmcli on TESTDB>db_admin
OK
6. Open a database session:
dbmcli on TESTDB>db_connect
OK
7. Import the complete data backup from DEMODB with initialization of TESTDB:
dbmcli on TESTDB>db_activate RECOVER DataSave
OK
Returncode 0
Date 20060309
Time 00100407
Server GENUA
Database DEMODB
Kernel Version Kernel 7.6.00 Build 016-123-109-428
Pages Transferred 13632
Pages Left 0
Volumes 1
Medianame datasave
Location \\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\completeDataMay
Errortext
Label DAT_000000017
Is Consistent true
First LOG Page 37746
Last LOG Page
DB Stamp 1 Date 20060308
DB Stamp 1 Time 00160527
DB Stamp 2 Date
DB Stamp 2 Time
Page Count 13610
Devices Used 1
Database ID PARMA:DEMODB_20060125_165646
Max Used Data Page 0
8. Start the import of the log backups.
dbmcli on TESTDB>recover_start LogSave 018
OK
Returncode -8020
Date 20060309
Time 00100728
Server GENUA
Database DEMODB
Kernel Version Kernel 7.6.00 Build 016-123-109-428
Pages Transferred 1000
Pages Left 0
Volumes 1
Medianame logsave
Location \\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.018
Errortext
Label LOG_000000018
Is Consistent
First LOG Page 35382
Last LOG Page 37747
DB Stamp 1 Date 20060208
DB Stamp 1 Time 00110215
DB Stamp 2 Date 20060308
DB Stamp 2 Time 00160655
Page Count 2365
Devices Used 1
Database ID GENUA:DEMODB_20060125_165646
Max Used Data Page
9. Start the import of the next log backup:
dbmcli on TESTDB>recover_replace LogSave "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.019"
OK
Returncode -8020
Date 20060309
Time 00100728
Server GENUA
Database DEMODB
Kernel Version Kernel 7.6.00 Build 016-123-109-428
Pages Transferred 2152
Pages Left 0
Volumes 1
Medianame logsave
Location \\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.019
Errortext
Label LOG_000000019
Is Consistent
First LOG Page 37748
Last LOG Page 40013
DB Stamp 1 Date 20060308
DB Stamp 1 Time 00160725
DB Stamp 2 Date 20060308
DB Stamp 2 Time 00160758
Page Count 2265
Devices Used 1
Database ID GENUA:DEMODB_20060125_165646
Max Used Data Page
10. Start the import of the next log backup:
dbmcli on testdb1>recover_replace LogSave "\\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.020"
OK
Returncode -8020
Date 20060309
Time 00100728
Server GENUA
Database DEMODB
Kernel Version Kernel 7.6.00 Build 016-123-109-428
Pages Transferred 704
Pages Left 0
Volumes 1
Medianame logsave
Location \\GENUA\Documents and Settings\All Users\Application Data\sdb\data\wrk\DEMODB\Backups 2005\Data\logBackup.020
Errortext
Label LOG_000000020
Is Consistent
First LOG Page 40014
Last LOG Page 40772
DB Stamp 1 Date 20060308
DB Stamp 1 Time 00160758
DB Stamp 2 Date 20060308
DB Stamp 2 Time 00163132
Page Count 758
Devices Used 1
Database ID GENUA:DEMODB_20060125_165646
Max Used Data Page
11. ...
12. ...
You have set up the standby instance TESTDB for the original instance DEMODB.
The first DBM operator for TESTDB has the user name DBM and password DBM. The database system administrator of TESTDB has the user name DBADMIN and the password SECRET.
DEMODB remains in the ONLINE operational state.
TESTDB has to stay in the ADMIN operational state until it is started as the active instance.
The dataset from DEMODB has been copied to TESTDB. To use TESTDB as a standby instance for DEMODB, you must import all subsequent log backups from DEMODB into TESTDB on a continual basis. You can import subsequent log backups in the manner just described or automatically using a script.
If necessary, TESTDB can be started as the active instance at any time.
See also:
Starting a Standby Instance as the Active Instance