Thursday, December 27, 2012

RMAN-20052: invalid datafile create SCN

I ran last week into a bug in rman. Some backup's didn't run anymore.
The error was

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03015: error occurred in stored script arch_backup
RMAN-03002: failure of sql command at 12/24/2012 11:10:08
RMAN-03014: implicit resync of recovery catalog failed
RMAN-03009: failure of full resync command on default channel at 12/24/2012 11:10:08
RMAN-20052: invalid datafile create SCN

There is a bug written for this.
Resync Catalog returns RMAN-20052: invalid datafile create SCN error [ID 343213.1]

The solution that is given missed 1 step.
They suggest you should unregister the database and then register the database.
When more backups are in the controlfile than in the catalog you will wipe information with this action.

How to check this

1. Look what the oldest backup entry is in the controlfile.
   start rman
   rman> connect target;
   rman> list backup of summary;

   look for the oldest backup entry.

2.check what the oldest backup entry is in the catalog
            sqlplus owner_rmn@rman_catalog
select incr_level, min(to_char(completion_time,'DD-MM-YYYY/HH24:mi:ss')) as end_time_backup
from owner_rmn.bs where status='A'
and db_key in (select db_key from owner_rmn.dbinc where db_name = UPPER('&dbnaam') )
group by incr_level;
è Look what the oldest backup entry is.
 
3. Compare these entries,
    if the catalog contains older backup entries than the control file
    then action 3a
    else action 3b.

Action 3a:
Buy time by making archive backup and full backup connected to the rman catalog only.
The solution is to make insert commando’s before the unregister, based on the current catalog info to re-insert the backupsets you will lose with the unregister and register action.

Action 3b:
Else: do an unregister and a register action:
SQL> select 'EXECUTE dbms_rcvcat.unregisterdatabase(' || db_key||','||dbid||');' from rc_database where  name = '&dbname';
è You will be asked for the database name and you will execute the outcome of the query.
exit

<SID of the database, thus on the host were the database resides>
rman target / catalog owner_rmn@rman_catalog
register database;
show all;
è Check if everything is ok

That's it.

No comments:

Post a Comment