RMAN: Data Recovery Advisor – Datafile corrompido
O Data Recovery Advisor do Oracle Database 11g também se saiu bem ao se deparar com um datafile corrompido.
Desta vez confiei mais no Advisor e utilizei a opção NOPROMPT, ou seja, disse a ele: “faça o que achar melhor”.
Vou tentar simular uma corrupção de bloco para ver o que ele faz. Espero que sugira uma reparação de bloco ao invés de um restore / recover completo…
[oracle@labdb ~]$ echo "Socorro, estou corrompendo..." >> /u01/app/oradata/ORCL/example01.dbf
[oracle@labdb ~]$ rman CATALOG=RMAN_USER/RMAN_USER@ORCL TARGET /
Recovery Manager: Release 11.1.0.7.0 - Production on Wed Jul 29 10:58:51 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1217465568)
connected to recovery catalog database
RMAN> LIST FAILURE;
no failures found that match specification
RMAN> VALIDATE DATABASE CHECK LOGICAL;
Starting validate at 29-JUL-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=180 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=184 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00003 name=/u01/app/oradata/ORCL/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oradata/ORCL/users01.dbf
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of validate command on ORA_DISK_1 channel at 07/29/2009 10:59:38
ORA-01122: database file 5 failed verification check
ORA-01110: data file 5: '/u01/app/oradata/ORCL/example01.dbf'
ORA-01565: error in identifying file '/u01/app/oradata/ORCL/example01.dbf'
ORA-27046: file size is not a multiple of logical block size
Additional information: 1
RMAN> LIST FAILURE;
List of Database Failures
=========================
Failure ID Priority Status Time Detected Summary
---------- -------- --------- ------------- -------
11949 HIGH OPEN 29-JUL-09 One or more non-system datafiles are corrupt
RMAN> ADVISE FAILURE;
List of Database Failures
=========================
Failure ID Priority Status Time Detected Summary
---------- -------- --------- ------------- -------
11949 HIGH OPEN 29-JUL-09 One or more non-system datafiles are corrupt
analyzing automatic repair options; this may take some time
using channel ORA_DISK_1
using channel ORA_DISK_2
analyzing automatic repair options complete
Mandatory Manual Actions
========================
no manual actions available
Optional Manual Actions
=======================
1. If a standby database is available, then consider a Data Guard switchover or failover
Automated Repair Options
========================
Option Repair Description
------ ------------------
1 Restore and recover datafile 5
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/diag/rdbms/orcl/ORCL/hm/reco_2779338466.hm
RMAN> REPAIR FAILURE NOPROMPT;
Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/diag/rdbms/orcl/ORCL/hm/reco_2779338466.hm
contents of repair script:
# restore and recover datafile
sql 'alter database datafile 5 offline';
restore datafile 5;
recover datafile 5;
sql 'alter database datafile 5 online';
executing repair script
sql statement: alter database datafile 5 offline
Starting restore at 29-JUL-09
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oradata/ORCL/example01.dbf
channel ORA_DISK_1: reading from backup piece /u02/backup/ORCL_20090728_87_1
channel ORA_DISK_1: piece handle=/u02/backup/ORCL_20090728_87_1 tag=TAG20090728T102901
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 29-JUL-09
Starting recover at 29-JUL-09
using channel ORA_DISK_1
using channel ORA_DISK_2
starting media recovery
archived log for thread 1 with sequence 202 is already on disk as file /u01/archives/1_202_689684835.dbf
archived log for thread 1 with sequence 203 is already on disk as file /u01/archives/1_203_689684835.dbf
archived log for thread 1 with sequence 204 is already on disk as file /u01/archives/1_204_689684835.dbf
archived log for thread 1 with sequence 205 is already on disk as file /u01/archives/1_205_689684835.dbf
archived log file name=/u01/archives/1_202_689684835.dbf thread=1 sequence=202
archived log file name=/u01/archives/1_203_689684835.dbf thread=1 sequence=203
media recovery complete, elapsed time: 00:00:10
Finished recover at 29-JUL-09
sql statement: alter database datafile 5 online
repair failure complete
RMAN> EXIT;
Recovery Manager complete.
[oracle@labdb ~]$