Recover Standby Database until Specific SCN or Timestamp
1. Introduction
One of the features provided by Dbvisit Standby is the option to recover the standby database up until a specified SCN or TIMESTAMP.
This can be especially useful where you have a financial system with a standby database being used for reporting. Once the batch processing is complete on your primary database the batch process creates a text file on the standby server indicating the SCN or TIMESTAMP to which the standby should recover. This can then allow the DBA to recover the standby database automatically up until this specified SCN or TIMESTAMP.
The standby database can then be opened read-only and used for reporting. This is useful if you would like to view data at a specific point in time.
2. Configuration
Two dynamically created files can be used to save specific SCN or timestamp.
Files full names are specified by the following two global variables:
- RECOVER_UNTIL_SCN_FILE
- RECOVER_UNTIL_TIME_FILE
The default location is under the DBVISIT_BASE/standby/log folder on the Standby Database server.
From Dbvisit Standby Version 8.0.24 we can customise the location of the RECOVER_UNTIL_SCN_FILE and RECOVER_UNTIL_TIME_FILE in the DDC. If the file is present it checks for the parameter and recovers according to the SCN or TIMESTAMP set. If not it recovers using the default. This would eliminate the need for changing the parameter in the DDC every time.
RECOVER_UNTIL_TIME_FILE = $DBVISIT_BASE/standby/log/recover_until_time.txt by default
RECOVER_UNTIL_SCN_FILE = $DBVISIT_BASE/standby/log/recover_until_scn.txt by default
Below is an example of using the until time option (Expected format is YYYY-MM-DD:HH24:MI: SS). In this example, we manually create a text file with a timestamp to which the standby should be recovered to.
The standby will not recover past this time until this file has been removed or updated to a later time.
Below is the contents of the recover_until_time.txt
 file, as well as the output from a dbvisit, run on the standby server when this file is in place:
[oracle@dbv2 standby]$ pwd /usr/dbvisit/standby [oracle@dbv2 standby]$ cat log/recover_until_time.txt 2019-05-09:13:10:00 [oracle@dbv2 standby]$ ./dbvctl -d DEV ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 1522) dbvctl started on dbv2: Thu May 9 13:13:41 2019 ============================================================= >>> Applying Log file(s) from dbv1 to DEV on dbv2: Taking into account RECOVER_UNTIL_TIME=2019-05-09:13:10:00 set in file /usr/dbvisit/standby/log/recover_until_time.txt thread 1 sequence 14 (1_14_1004372670.arc)... done Last applied log(s): thread 1 sequence 14 Next SCN required for recovery 1131254 generated at 2019-05-09:13:10:13 +12:00. Next required log thread 1 sequence 14 ============================================================= dbvctl ended on dbv2: Thu May 9 13:13:43 2019 ============================================================= [oracle@dbv2 standby]$ rm log/recover_until_time.txt [oracle@dbv2 standby]$ ./dbvctl -d DEV ============================================================= Dbvisit Standby Database Technology (9.0.0_1271_g4b00fb49) (pid 1558) dbvctl started on dbv2: Thu May 9 13:14:52 2019 ============================================================= >>> Applying Log file(s) from dbv1 to DEV on dbv2: thread 1 sequence 14 (1_14_1004372670.arc)... done Last applied log(s): thread 1 sequence 14 Next SCN required for recovery 1131617 generated at 2019-05-09:13:13:14 +12:00. Next required log thread 1 sequence 15 ============================================================= dbvctl ended on dbv2: Thu May 9 13:14:54 2019 =============================================================
The same process can be followed when using an SCN number.
For eg: You can set the below [oracle@dbv2 ~]$ pwd /home/oracle [oracle@dbv2 ~]$ cat recoveruntilscn.txt 1129090 [oracle@dbv2 ~]$ and if you don't want to set the parameter you can just remove/move the file and the recovery will happen