Oracle 설치/Oracle 10g RAC 구축

[Oracle 10g RAC 구축] 9. 데이터베이스 백업 및 복구

빵순이^^ 2010. 7. 3. 03:06

Oracle Recovery Manager(RMAN)을 이용하여 Oracle RAC 데이터베이스를 백업/복구하는 방법은 싱글 인스턴스 데이터베이스의 경우와 동일하다.


1. 전체 데이터베이스 백업 수행.


rac1-> rman nocatalog target /

RMAN> configure controlfile autobackup on;
RMAN> backup database plus archivelog delete input;

2. test_d 테이블스페이스에 mytable 테이블 생성


SQL> connect system/oracle@devdb2
SQL> create table mytable (col1 number) tablespace test_d;

3. t1 시점에 mytable에 첫 번째 레코드를 삽입.


SQL> !date
SQL> insert into mytable values (1);
SQL> commit;

4. t2 시점에 mytable에 두 번째 레코드를 삽입.


SQL> !date
SQL> insert into mytable values (2);
SQL> commit;

5. t3 시점에 mytable을 삭제


SQL> !date
SQL> drop table mytable;

6. test_d 테이블스페이스의 point-in-time 복구 수행.


보조 데이터베이스를 위한 보조 디렉토리를 생성한다.

rac1-> mkdir /u01/app/oracle/aux

RMAN에서 point-in-time 복구를 수행한다. 필자는 복구 시간을 mytable이 삭제되기 직전(t3)으로 시간으로 잡았다.
백업 복구 시점은 t1 혹은 t2 직전의 시점으로 설정해 복구해 볼수도 있다.

RMAN> recover tablespace test_d
until time "to_date('03-JUL-2010 02:15:47','DD-MON-YYYY HH24:MI:SS')"
auxiliary destination '/u01/app/oracle/aux';

RMAN> backup tablespace test_d;

복구 후 test_d 테이블스페이스를 online으로 변경한다.

RMAN> sql 'alter tablespace test_d online';

7. 복구 결과 검증


SQL> connect system/oracle@devdb2
SQL> select * from mytable;

해당 시점으로 mytable이 정상적으로 복구 되었음을 확인 할 수 있다. 복구 시점을 t2 시점 직전으로 복구했다면 COL1의 컬럼값은 1 만 보여질 것이다.