본문 바로가기
oracle/[Recovery] 기타

[Clone DB] clone db를 이용한 drop tablespace 복구

by #moonyz 2014. 11. 10.



[전제조건]

백업파일경로 : /data/backup/close/

운영서버 SID : testdb

복구서버 SID : clonedb

복구서버 파일경로 : /data/clone/


[작업순서]

1. 복구 서버용 파라미터 파일 생성 : 현재사용중인 parameter file을 복사하여 이름변경하고(initSID.ora) vi로 편집하여 내용수정

2. 백업 데이터 파일 복원 : 백업받아둔 *.dbf 파일을 복구서버 경로로 복원

3. 컨트롤 파일 재생성 스크립트 만들기 : alter database backup controlfile to trace as '스크립트생성할위치'

4. 컨트롤 파일 재생성 스크립트 실행 : SQL> @스크립트경로

5. 불완전 복구 시작 : recover database until time '복구시간' using backup controlfile;

6. 삭제된 data file 경로 수정 및 재생성 : alter database create datafile '기존경로' as '새로생성할경로'

7. 복구 재시도 -> 완료 recover database until time '복구시간' using backup controlfile;

8. clonedb에서 exp -> 운영서버로 exp : exp scott/tiger file=tt200 tables=tt200 / imp scott/tiger file=tt200 ignore=y



1. Full backup (close backup) 수행


2. Tablespace 생성 -> Table 생성 -> 데이터 입력 -> commit -> 데이터존재시간 확인 



3. 장애발생 : drop tablespace  -> log switch 발생시켜 archive log file 생성



4. alert log file 확인 -> drop tablespace 시간 확인



5. clonedb용으로 사용할 parameter file 복사



6. initclonedb.ora 파일을 vi로 수정하여 clonedb용 parameter file을 만들어줌



7. 복구서버용 디렉토리 생성 -> data file 복원



8. testdb로 접속하여 'control file 생성 스크립트' 실행

SQL > alter database backup controlfile to trace as '/app/oracle/re2.sql';



9. vi로 'control file 생성 스크립트' 열어서 수정



10. 'control file 생성 스크립트' 수정완료 화면



11. clonedb로 접속하여 'control file 생성 스크립트' 실행 -> control file 생성됨



12. 테이블이 존재했던 시간으로 recover -> 에러발생 : data file이 존재하지 않음

SQL > recover database until time '복구할시간' using backup controlfile;



13. datafile 조회해보면 존재하지 않는 datafile을 임의로 control file에 경로 추가됨 -> data file 경로 수정 및 생성

SQL > alter database create datafile '기존경로' as '생성할 경로';



14. 다시 복구 시도 -> DB open 후 -> 데이터 복구확인

SQL > recover database until time '복구할시간' using backup controlfile;

SQL > alter database open resetlogs;



15. 복구된 테이블 exp 수행

$ export ORACLE_SID=clondb

$ exp scott/tiger file=tt200 tables=tt200



16. exp수행하여 만든 dump file을 운영DB(testdb)로 와서 imp 수행

$ export ORACLE_SID=testdb

$ imp scott/tiger file=tt200 ignore=y



17. 운영DB(testdb)로 접속하여 복구된 테이블이 imp되었는지 확인



18. 복구 작업이 완료되면 clonedb를 바로 shutdown 시켜주는것이 좋음.


댓글