We're here to help!

Advanced - Recover Standby Database until Specific SCN or Timestamp

Follow

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_UNTILTIME_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_UNTILTIME_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 of changing the parameter in the DDC everytime.


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
2018-05-31:23:23:00


[oracle@dbv2 standby]$ ./dbvctl -d DEV
=============================================================
Dbvisit Standby Database Technology (8.0.22_RC3_3_g07a25024) (pid 1264)
dbvctl started on dbv2: Thu May 31 23:24:10 2018
=============================================================


>>> Applying Log file(s) from dbv1 to DEV on dbv2:

    Taking into account RECOVER_UNTIL_TIME=2018-05-31:23:23:00 set in file
    recover_until_time.txt
    thread 1 sequence 13 (1_13_972451080.arc)
    Last applied log(s):
    thread 1 sequence 13

    Next SCN required for recovery 1128505 generated at 2018-05-31:23:23:40 +00:00.
    Next required log thread 1 sequence 13

=============================================================
dbvctl ended on dbv2: Thu May 31 23:24:11 2018
=============================================================



[oracle@dbv2 standby]$ rm log/recover_until_time.txt



[oracle@dbv2 standby]$ ./dbvctl -d DEV
=============================================================
Dbvisit Standby Database Technology (8.0.22_RC3_3_g07a25024) (pid 1297)
dbvctl started on dbv2: Thu May 31 23:24:35 2018
=============================================================


>>> Applying Log file(s) from dbv1 to DEV on dbv2:

    thread 1 sequence 13 (1_13_972451080.arc)
    Last applied log(s):
    thread 1 sequence 13

    Next SCN required for recovery 1129082 generated at 2018-05-31:23:23:49 +00:00.
    Next required log thread 1 sequence 14

=============================================================
dbvctl ended on dbv2: Thu May 31 23:24:36 2018
=============================================================



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 recoveruntiltime.txt
2018-09-06:13:35:00
[oracle@dbv2 ~]$

and if you don't want to set the parameter you can just remove/move the file and the recovery will happen 


Have more questions? Submit a request

Comments