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 2020-12-02:16:00:00 [oracle@dbv2 standby]$ ./dbvctl -d DEV ============================================================= Dbvisit Standby Database Technology (10.0.0RC_15_g81628a5f) (pid 2188) dbvctl started on dbv2: Wed Dec 2 16:02:11 2020 ============================================================= >>> Applying Log file(s) from dbv1 to DEV on dbv2: Taking into account RECOVER_UNTIL_TIME=2020-12-02:16:00:00 set in file /usr/dbvisit/standby/log/recover_until_time.txt thread 1 sequence 17 (1_17_1013170568.arc)... done thread 1 sequence 18 (1_18_1013170568.arc)... done Last applied log(s): thread 1 sequence 18 Next SCN required for recovery 1096524 generated at 2020-12-02:16:00:41 +13:00. Next required log thread 1 sequence 18 ============================================================= dbvctl ended on dbv2: Wed Dec 2 16:02:13 2020 ============================================================= [oracle@dbv2 standby]$ rm log/recover_until_time.txt [oracle@dbv2 standby]$ ./dbvctl -d DEV ============================================================= Dbvisit Standby Database Technology (10.0.0RC_15_g81628a5f) (pid 2291) dbvctl started on dbv2: Wed Dec 2 16:05:56 2020 ============================================================= >>> Applying Log file(s) from dbv1 to DEV on dbv2: thread 1 sequence 18 (1_18_1013170568.arc)... done thread 1 sequence 19 (1_19_1013170568.arc)... done Last applied log(s): thread 1 sequence 19 Next SCN required for recovery 1096760 generated at 2020-12-02:16:01:59 +13:00. Next required log thread 1 sequence 20 ============================================================= dbvctl ended on dbv2: Wed Dec 2 16:05:57 2020 =============================================================
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