Thinking Out Loud

May 23, 2014

Rolling forward a standby database using RMAN Incremental Backup

Filed under: 11g,Dataguard,oracle — mdinh @ 10:24 pm

I am not going to post on how to roll forward standby database as it has been written in many blogs already.

Instead, I am going to share what I have learned how it may have been done incorrectly using the wrong SCN.

Typically, select current_scn from v$database should work until it doesn’t.

But why take the chance and why not do it right the first time.

In reviewing Steps to perform for Rolling forward a standby database using RMAN Incremental Backup. (Doc ID 836986.1)

SQL> select current_scn from v$database;

-- If no READ ONLY Tablespaces/datafiles in database use
-- Both should be the same
SQL> select min(fhscn) from x$kcvfh;
OR
SQL> select min(checkpoint_change#) from v$datafile_header;

-- If READ ONLY tablespaced/datafiles in database use
SQL> select min(f.fhscn) from x$kcvfh f, v$datafile d where f.hxfil =d.file# and d.enabled != 'READ ONLY';

In ideal situation the above 2 queries will return the almost same SCN.
However if there is huge difference its better to take backup using the SCN from second or third query (lesser SCN), as one of the datafile may be behind.

Here is a demo:

SYS@san> select current_scn from v$database;
----------------
1005703

SYS@san> select min(fhscn) from x$kcvfh;

MIN(FHSCN)
—————-
1004302

SYS@san> select min(checkpoint_change#) from v$datafile_header;

MIN(CHECKPOINT_CHANGE#)
———————–
1004302

SYS@san> select min(f.fhscn) from x$kcvfh f, v$datafile d where f.hxfil =d.file# and d.enabled != ‘READ ONLY';

MIN(F.FHSCN)
—————-
1004302

SYS@san>

About these ads

2 Comments »

    • Thanks. In reading the post, current_scn is 998647 and backup from scn is 987005 and there is no reference as to how 987005 was determined. Later saw the details was posted in the comment about x$kcvfh.

      Comment by mdinh — May 24, 2014 @ 1:20 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 302 other followers

%d bloggers like this: