rman
oracle@r06pc04:~$ rlwrap rman target /
Recovery Manager: Release 11.1.0.6.0 - Production on Thu Jan 29 13:14:37 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1204950473)
RMAN> backup database;
blöcke herausfinden
SQL> select FILE_ID, BLOCK_ID, blocks from dba_extents where SEGMENT_NAME=upper('large_table');
in welchem file liegen die Blöcke
SQL> select name from V$DATAFILE where file#=4;
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/orcl/users01.dbf
Block demolieren
oracle@r06pc04:~$ dd if=/dev/zero of=/u01/app/oracle/oradata/orcl/users01.dbf seek=38681 bs=8k count=1 conv=notrunc
cache flushen
SQL> alter system flush buffer_cache;
SQL> select count(*) from bla.large_table;
select count(*) from bla.large_table
*
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 38681)
ORA-01110: data file 4: '/u01/app/oracle/oradata/orcl/users01.dbf'
Lösung
rman> backup validate tablespace users;
rman> list failures;
rman> advise failure;
rman> repair failure;
RMAN> recover datafile 4 block 38681;
Komplettes Recover
RMAN> backup as copy format '/home/oracle/control.ctl' current controlfile;
RMAN> backup database ;
Databank zerstören, dann
oracle@r06pc04:~$ sql+
SQL*Plus: Release 11.1.0.6.0 - Production on Thu Jan 29 15:26:46 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
ORA-00205: error in identifying control file, check alert log for more info
oracle@r06pc04:~$ rlwrap rman target /
Recovery Manager: Release 11.1.0.6.0 - Production on Thu Jan 29 15:27:45 2009
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ORCL (not mounted)
RMAN> list failure
st of Database Failures
=========================
Failure ID Priority Status Time Detected Summary
---------- -------- --------- ------------- -------
291 CRITICAL OPEN 29-JAN-09 Control file /u01/app/oracle/oradata/orcl/control01.ctl is missing
288 CRITICAL OPEN 29-JAN-09 Control file /u01/app/oracle/oradata/orcl/control02.ctl is missing
285 CRITICAL OPEN 29-JAN-09 Control file /u01/app/oracle/oradata/orcl/control03.ctl is missing
142 HIGH OPEN 29-JAN-09 Datafile 4: '/u01/app/oracle/oradata/orcl/users01.dbf' contains one or more corrupt blocks
wenn kein autobackup aktiviert ist
RMAN> restore controlfile from '/home/oracle/control.ctl';