Friday, September 12, 2014

Backup issue

1.- Check which is the wrong entry on control file. To find the row, connect to this database with sqlplus and execute:

SELECT * FROM V$BACKUP_DATAFILE WHERE CHECKPOINT_TIME IS NULL;
SELECT * FROM V$DATAFILE_COPY WHERE CHECKPOINT_TIME IS NULL;

2.- Check the handle of the backup or copy

SELECT * FROM V$BACKUP_DATAFILE WHERE CHECKPOINT_TIME IS NULL;
SELECT NAME,CREATION_TIME,CHECKPOINT_CHANGE#,COMPLETION_TIME
FROM V$DATAFILE_COPY WHERE CHECKPOINT_TIME IS NULL;

For control file copy, NAME will show the handle for deleting.

For control file backup we need to find the backup piece handle as follows:

SELECT * FROM V$BACKUP_SET
WHERE SET_STAMP=<SET_STAMP> AND SET_COUNT=<SET_COUNT>;
SELECT * FROM V$BACKUP_PIECE
WHERE SET_STAMP=<SET_STAMP> AND SET_COUNT=<SET_COUNT>;
Where <SET_STAMP> and <SET_COUNT> are from above query output
V$BACKUP_DATAFILE;


Once we know the wrong entry we have the following options to fix:

1.- Connect to RMAN without catalog and delete the backuppiece

2.- If deleting the backup or copy of the control file is not possible for whatever reason,. Then another option to fix the issue is reset the control file section. This willcleanup the whole control file section.

This will avoid the issue, but all the rows on v$backup_datafile or v$datafile_copy will be deleted. This means that the information regarding backups or file copies that won't be in RMAN catalog database will be lost.

The steps to follow are:

2.1 Connect to target database with sqlplus with SYS user as SYSDBA

sqlplus /nolog
sql>connect sys/<password> as sysdba
sql> select rownum-1, type from v$controlfile_record_section;
- and look for 'BACKUP DATAFILE'. or 'DATAFILE COPY' section

Then clear that section using -
sql>execute sys.dbms_backup_restore.resetCfileSection(<Section_id#>);

NOTE that this option might end up on ORA-600 in which case the section cannot be cleared

3.- Another option is to recreate the controlfile, in this case all the information in the controlfile that won't be in RMAN catalog will also be lost. The steps are in following MOS notes:

How to Recreate a Controlfile Doc ID <<735106.1>>
Recreating the Controlfile in RAC Doc ID <<118931.1>>

=============================================================================================

No comments:

Post a Comment