You are on page 1of 2

Flashback RAC database to guarantee restore point (11g)

I finally have a quiet night at home to catch up on some blogging. One thing I’d like to share with
you is the process to flashback a RAC database to a guarantee restore point. I’ve been doing a
lot of these recently so the application testers can do repetitive testing using the same data for
their starting point.
In this testing scenario we always want to start at the same point in time. Therefore we do not
need to have Flashback Database enabled. Flashback Database would give us the ability to
restore the database back to varying points in time, but it also creates overhead that you will
want to avoid if you can.
Step #1 – Create the guarantee restore point.
First, the application testers load the database with their test data. And then I create a guarantee
restore point by logging in to the database as a user with sysadm privileges. In this example, I’m
naming the restore point JULY_PERF_TEST
SQL> create restore point JULY_PERF_TEST guarantee flashback database;
Step #2 -The application team does the testing they need.
When ready, they contact you, the DBA, to restore the database back to the guarantee restore
point.
Step #3 – Stop the RAC database and bring up 1 instance in mount mode.
%srvctl stop database -d mydb
%srvctl start instance -d mydb -i mydb1 -o mount
Step #4 – Log in to RMAN catalog to do the flashback commands
%rman catalog rman/password@mycatalogdb RMAN> connect target / RMAN> allocate channel
for maintenance type SBT_TAPE; <== Is required if logs need restored
allocated channel: ORA_MAINT_SBT_TAPE_1 channel ORA_MAINT_SBT_TAPE_1: SID=465
instance=mydb01x1 device type=SBT_TAPE channel ORA_MAINT_SBT_TAPE_1: Veritas
NetBackup for Oracle – Release 7.1 (2011020316)
RMAN> flashback database to restore point JULY_PERF_TEST;
Starting flashback at 18-JUN-13 allocated channel: ORA_DISK_1 channel ORA_DISK_1:
SID=542 instance=mydb01x1 device type=DISK
starting media recovery
channel ORA_MAINT_SBT_TAPE_1: starting archived log restore to default destination channel
ORA_MAINT_SBT_TAPE_1: restoring archived log archived log thread=2 sequence=3 channel
ORA_MAINT_SBT_TAPE_1: restoring archived log <== RMAN looks for missing logs
archived log thread=3 sequence=3 channel ORA_MAINT_SBT_TAPE_1: restoring archived log
archived log thread=1 sequence=2 channel ORA_MAINT_SBT_TAPE_1: reading from backup
piece mydb01x_20130614_0315___14022_1_818046936 channel ORA_MAINT_SBT_TAPE_1:
ORA-19870: error while restoring backup piece
mydb01x_20130614_0315___14022_1_818046936 ORA-19507: failed to retrieve sequential file,
handle=”mydb01x_20130614_0315___14022_1_818046936″, parms=”” ORA-27029: skgfrtrv:
sbtrestore returned error ORA-19511: Error received from media manager layer, error text:
Backup file <mydb01x_20130614_0315___14022_1_818046936> not found in NetBackup
catalog
failover to previous backup <== RMAN will automatically search old backups channel
ORA_MAINT_SBT_TAPE_1: starting archived log restore to default destination channel
ORA_MAINT_SBT_TAPE_1: restoring archived log archived log thread=2 sequence=3 channel
ORA_MAINT_SBT_TAPE_1: restoring archived log <== RMAN restores needed logs archived
log thread=3 sequence=3 channel ORA_MAINT_SBT_TAPE_1: restoring archived log archived
log thread=1 sequence=2 channel ORA_MAINT_SBT_TAPE_1: reading from backup piece
mydb01x_20130614_0315___14018_1_818046935 channel ORA_MAINT_SBT_TAPE_1: piece
handle=mydb01x_20130614_0315___14018_1_818046935 tag=mydb01X_20130614_0315__
channel ORA_MAINT_SBT_TAPE_1: restored backup piece 1 channel
ORA_MAINT_SBT_TAPE_1: restore complete, elapsed time: 00:00:15 channel
ORA_MAINT_SBT_TAPE_1: deleting archived log(s) archived log file
name=+mydb01X_FLASH/mydb01x/archivelog/2013_06_18/thread_1_seq_2.6585.818425799
RECID=20360 STAMP=818425800 channel ORA_MAINT_SBT_TAPE_1: deleting archived
log(s) archived log file
name=+mydb01X_FLASH/mydb01x/archivelog/2013_06_18/thread_2_seq_3.6588.818425799
RECID=20358 STAMP=818425800 channel ORA_MAINT_SBT_TAPE_1: deleting archived
log(s) <== RMAN deletes logs after apply archived log file
name=+mydb01X_FLASH/mydb01x/archivelog/2013_06_18/thread_3_seq_3.6587.818425799
RECID=20359 STAMP=818425800 media recovery complete, elapsed time: 00:00:03 Finished
flashback at 18-JUN-13
Step #5 – Open the database resetlogs. If you execute this command in RMAN it will update
the RMAN catalog appropriately.
RMAN> alter database open resetlogs;
database opened new incarnation of database registered in recovery catalog starting full resync
of recovery catalog full resync complete
RMAN> exit Step #6 – Bring up the remaining database instances. I prefer to do a clean
shutdown and startup.
%srvctl stop database -d mydb
%srvctl start database -d mydb
Step #7 – Restart the application servers
Make sure the application servers are stopped and restarted so there is no data remaining in the
middle tier caches. This can corrupt the data and/or cause connectivity issues.
And you are done! Here are some additional notes.
If you need to send media manager ENV parameters for the channels you allocate, you will need
to put the allocate channel and flashback commands in a run block.
To view data about restore points, query v$restore_point. The v$restore_point view contains the
SCN for the restore point. After the flashback is complete you can query current_scn from
v$database and it should show an SCN that is close to, but after the SCN listed in
v$restore_point.

You might also like