행위

오라클 rman 복구 시나리오

DB CAFE

1 복구 시나리오

  1. 운영중 컨트롤 파일 삭제
  2. 비정상 종료
  3. RMAN 으로 Control File Restore
  4. recover database
  5. DB open

1.1 운영중 컨트롤 파일 삭제 (client & sysdba)

SQL> select name from v$controlfile;

NAME
--------------------------------------------------------------------------------
/home/oracle/oradata/testdb/control01.ctl
/home/oracle/oradata/testdb/control02.ctl
/home/oracle/oradata/testdb/control03.ctl
SQL> !rm -fr /home/oracle/oradata/testdb/control0*

1.2 비정상 종료

SQL> shutdown abort
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area  419430400 bytes
Fixed Size                  1219760 bytes
Variable Size             163578704 bytes
Database Buffers          251658240 bytes
Redo Buffers                2973696 bytes

ORA-00205: error in identifying control file, check alert log for more info
SQL>


1.3 RMAN 으로 Control File Restore ( client )

$ rman target / catalog rcuser/rcuser@rcserver

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Apr 4 19:47:12 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: testdb (not mounted)  // nomount 상태이다.
connected to recovery catalog database

RMAN> restore controlfile;

Starting restore at 04-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: reading from backup piece /home/oracle/flash_recovery_area/TESTDB/backupset/2012_04_04/o1_mf_ncsnf_TAG20120404T192926_7qr8z1w1_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/flash_recovery_area/TESTDB/backupset/2012_04_04/o1_mf_ncsnf_TAG20120404T192926_7qr8z1w1_.bkp tag=TAG20120404T192926
channel ORA_DISK_1: restore complete, elapsed time: 00:00:09
output filename=/home/oracle/oradata/testdb/control01.ctl
output filename=/home/oracle/oradata/testdb/control02.ctl
output filename=/home/oracle/oradata/testdb/control03.ctl
Finished restore at 04-APR-12

RMAN>  alter database mount;
database mounted
released channel: ORA_DISK_1

1.4 recover database

RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 04/04/2012 19:52:47
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
  • 컨트롤 파일을 restore 를 했지만 recovery 과정을 하지 않았기 때문에 open 이 안된다.

1.4.1 recover database

RMAN> recover database;

Starting recover at 04-APR-12
Starting implicit crosscheck backup at 04-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=154 devtype=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 04-APR-12
Starting implicit crosscheck copy at 04-APR-12
using channel ORA_DISK_1
Crosschecked 1 objects
Finished implicit crosscheck copy at 04-APR-12

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /home/oracle/flash_recovery_area/TESTDB/backupset/2012_04_04/o1_mf_ncsnf_TAG20120404T192926_7qr8z1w1_.bkp
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 5 is already on disk as file /home/oracle/oradata/testdb/redo01.log
archive log filename=/home/oracle/oradata/testdb/redo01.log thread=1 sequence=5
media recovery complete, elapsed time: 00:00:05
Finished recover at 04-APR-12

1.5 database open

  1. open 을 시도한다.
  2. resetlogs 옵션으로 open을 해야 한다.
RMAN> alter database open resetlogs;

database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete