Skip to Main Content

Oracle Database Discussions

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 can I determine what is the minimum SCN number I need to restore up to.

user526627Mar 16 2009 — edited Mar 16 2009
Say if I have a full database backup, I know I have file inconsistency, but I want to know what is the minimum time or SCN number a need to roll forward to in order to be able to open the database?

For example: I do a database restore.

restore database ;

RMAN> sql 'alter database open read only';

sql statement: alter database open read only
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of sql command on default channel at 03/16/2009 15:00:04
RMAN-11003: failure during parse/execution of SQL statement: alter database open read only
ORA-16004: backup database requires recovery
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/oradata/p1/system01.dbf'

I need need to apply archive log files. All references I find for ORA-00194 state the solution is to "apply more logs until the file is consistent " But "HOW MANY LOGS", or more apporaite up to what time or SCN? How does one determine what TIME or SCN is required to get all file consistent?

I thought this query might provide the answer, but it doesn't

select max(checkpoint_change#)
from v$datafile_header
;
MAX(CHECKPOINT_CHANGE#)
-----------------------
7985876903

--It applies a bit more redo, but not enough to make my datafiles consistent.

recover database until SCN=7985876903 ;

Starting recover at 03/16/09 15:04:54
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
using channel ORA_DISK_4
using channel ORA_DISK_5
using channel ORA_DISK_6
using channel ORA_DISK_7
using channel ORA_DISK_8

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=18436
channel ORA_DISK_1: reading from backup piece /temp-oracle/backup/hot/p1/20090315/hourly.arch_P1_47353_681538638_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/temp-oracle/backup/hot/p1/20090315/hourly.arch_P1_47353_681538638_1 tag=TAG20090315T041716
channel ORA_DISK_1: restore complete, elapsed time: 00:02:26
archive log filename=/u01/app/oracle/flash_recovery_area/P1/archivelog/2009_03_16/o1_mf_1_18436_4vxd81yc_.arc thread=1 se quence=18436
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/u01/oradata/p1/system01.dbf'


I've discover I need to apply archive logs until this query reports all datafiles as FUZZY=NO , but this only works by guessing at some time periord to roll forward to, then checking the FUZZY column, and try again. Is there a way to know, I have to roll forward to a specific SNC in order for all my datafiles to be consistent?

select file#
, status
, checkpoint_change#
, checkpoint_time
, FUZZY
, RECOVER
,LAST_DEALLOC_SCN
from v$datafile_header
order by checkpoint_time
;

Thanks,
Jason
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 13 2009
Added on Mar 16 2009
2 comments
3,291 views