Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to find the right SCN to recover until ?

user13486398Apr 16 2014 — edited Apr 22 2014

Hi,

I'm pretty new to RMAN, so I may be using some of its terms incorrectly.

I performed a backup as follows (the database is in ARCHIVELOG mode):

RMAN> crosscheck backup;

RMAN> delete noprompt expired backup;

RMAN> backup incremental level 0 database;

RMAN> backup current controlfile plus archivelog force;

RMAN> delete noprompt obsolete;

Then, I would like to find the highest SCN to use for the "until SCN" during a later recovery

as follows (basically using the maximum V$BACKUP_DATAFILE.CHECKPOINT_CHANGE#

of the most recent backed up datafile):

SQL> select MAX(B.CHECKPOINT_CHANGE#)

FROM V$BACKUP_DATAFILE B, V$DATAFILE D,

( SELECT file#, MAX(COMPLETION_TIME) COMPLETION_TIME

   FROM V$BACKUP_DATAFILE WHERE FILE# in

   ( SELECT file# FROM V$DATAFILE)

   GROUP BY file# ) Q

WHERE B.file# = D.file#

AND B.file# = Q.file#

AND B.COMPLETION_TIME = Q.COMPLETION_TIME;

However, this SCN is sometimes too low causing RMAN to report no backup found (RMAN-06023)

when I perform a restore/recover as follows:

RMAN> run {

  set until scn (SCN_#_FROM_ABOVE);

  restore database;

  recover database;

}

If I don't use the "until scn" clause, I get the following error message:

RMAN-06054 with an SCN # higher than my SCN.

If I use this higher SCN in my "until SCN" clause, my recovery succeeds.

I'm wondering if you can help me in finding the right SCN?

(I would prefer to extract an SCN and use "until SCN" rather than "until cancel" during the recovery.)

Thanks!

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 20 2014
Added on Apr 16 2014
5 comments
42,737 views