본문 바로가기

오라클 백업/복구

RAC Backup과 OCR file 관리



OCR file

Oracel Cluster Repository 

Cluster의 정보를 담고 있는 파일

윈도에서는 레지스트리 같은 역할로, RAC 상의 모든 노드들에 대한 정보와 모든 자원들에 대한 정보가 저장되어 있음

장애가 발생하면 RAC 전체가 중단되기 때문에 관리 잘~ 해야함!


특징

소유자는 기본적으로 root (경우에 따라서는 oracle 사용자가 될수도 있다)

4시간마다, 매일마다, 매주마다 자동으로 백업 수행


상태확인 방법

$ ocrcheck

OCR 상태 확인 방법

$ORA_CRS_HOME/bin/ocrcheck <<



$ ocrconfig -showbackup

자동 백업 경로 확인

그 경로로 가서 보면 있음


------

자동백업으로 복원은 나중에 생기면 하기

계속 안생기네염


현재 노드의 오라클 클러스터웨어 (Oracle Clusterware) Stop

# crsctl stop crs

백업 리스트 확인 후 파일 복원

# ocrconfig -showbackup

복원명령어는 ocrconfig -restore 백업파일경로


cluvfy명령어로 복원되었는지 확인할 수 있다.

# cluvfy comp ocr -n all

--> root 계정으로 실행시 에러 발생

You must NOT be logged in as root (uid=0) when running /home/oracle/product/10g/crs/bin/cluvfy.

그래서 oracle로 하면 확인 가능하다. 이유는,, 모르겠음

혹시 다른 에러가 생긴다면 ssh문제 일수 도 있음 루트계정으로도 돌려줘야 한다

$ cluvfy comp ocr -n all


현재 노드의 오라클 클러스터웨어 (Oracle Clusterware) Start

# crsctl star crs


------


OCR file 수동 Backup



]# crsctl stop crs

ocrconfig -export 명령어를 통해서 수동으로 OCR file 백업 수행

# ocrconfig -export /home/oracle/ocr

PROT-2: Export file already exists

# ocrconfig -export /home/oracle/ocr/backup03.ocr

# crsctl start crs



OCR file Recovery


# crsctl stop crs


ocrconfig -import 명령어를 통해서 해당 백업 경로에서 복구 수행

# ocrconfig -import /home/oracle/ocr/backup03.ocr

# cluvfy comp ocr -n all

You must NOT be logged in as root (uid=0) when running /home/oracle/product/10g/crs/bin/cluvfy.

# su - oracle

$ cluvfy comp ocr -n all


$ su -

# crsctl start crs







Archive Log Mode 로 변경하는 방법


양쪽 노드 shutdown immdiate

한쪽 노드만 mount

alter system set log_archive_dest_1='location=/data/arc1' ;

alter system set log_archive_dest_2='location=/data/arc2' ;

alter database archivelog 

alter database open 

archive log list로 확인

나머지 노드에서는  mount -> alter system 단계만 해주면 됨







RAW DEVICE 백업


1) Hot Backup

해당 테이블스페이스 begin backup

dd 명령어로 복사 --> dd if=원본경로 of=복사본경로 bs=8k

해당 테이블스페이스 end backup


SQL> alter tablespace system begin backup ;

SQL> ! dd if=/dev/raw/raw6 of=/data/backup/open/raw6_systme bs=8k

SQL> alter tablespace system end backup ;


SQL> ! ls /data/backup/open

raw6_systme


SQL> alter tablespace undotbs1 begin backup ;

SQL> ! dd if=/dev/raw/raw8 of=/data/backup/open/raw8_undotbs1 bs=8k

SQL> alter tablespace undotbs1 end backup ;



2) Cold Backup

양쪽 노드 모두 shutdown immediate ; 한 후

dd 명령어로 복사


[oracle@rac1 ~]$ dd if=/dev/raw/raw6 of=/data/backup/close/raw6_system bs=8k

[oracle@rac1 ~]$ dd if=/dev/raw/raw7 of=/data/backup/close/raw7_sysaux bs=8k



즉, 기존 파일 시스템에서의 백업과 원리는 동일함, dd 명령어만 다를 뿐.