< Redo Log File 장애 처리 순서도 >
Case 1. 1개의 member 가 삭제되는 장애가 발생하는 경우
(에러코드 : ORA-00313: open failed for members of log group....)
SQL> !rm -f /data/temp3/redo01.log <-- 멤버 삭제
SQL> !ls /data/temp3/redo01.log
ls: /data/temp3/redo01.log: 그런 파일이나 디렉토리가 없음
SQL> alter system switch logfile; <-- 로그스위치를 일으켜도 이상 없음
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO <-- 파일을 삭제했는데 조회가능
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
3 /data/temp3/redo03_b.log 5 24 INACTIVE YES
6 rows selected.
장애 내역을 보려면 alert log file 을 봐야 확인 할 수 있음
SQL> !
v[oracle@localhost ~]$ vi /app/oracle/diag/rdbms/testdb/testdb/trace/alert_testdb.log
Errors in file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_arc3_1063.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/data/temp3/redo01.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
멤버 하나가 지워져도 운영에는 문제가 없어서 alert log 파일에만 장애를 기록하고 운영중인 DB는 정상작동 됨
장애가 확인된 멤버는 삭제 한 후 다시 생성해주면 잘 돌아감
[oracle@localhost ~]$ exit
exit
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ------
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
3 /data/temp3/redo03_b.log 5 24 INACTIVE YES
6 rows selected.
SQL> alter database drop logfile member
2 '/data/temp3/redo03_b.log';
Database altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
SQL> alter database add logfile member
2 '/data/temp3/redo03_b.log' t group 3;
'/data/temp3/redo03_b.log' t group 3
*
ERROR at line 2:
ORA-00946: missing TO keyword
SQL> ed
Wrote file afiedt.buf
1 alter database add logfile member
2* '/data/temp3/redo03_b.log' to group 3
SQL> /
alter database add logfile member
*
ERROR at line 1:
ORA-00301: error in adding log file '/data/temp3/redo03_b.log' - file cannot be created
ORA-27038: created file already exists
Additional information: 1
SQL> ed
Wrote file afiedt.buf
1 alter database add logfile member
2* '/data/temp3/redo03_b.log' to group 3
SQL> alter database add logfile member
2 '/data/temp3/redo03_b.log' to group 3;
alter database add logfile member
*
ERROR at line 1:
ORA-00301: error in adding log file '/data/temp3/redo03_b.log' - file cannot be created
ORA-27038: created file already exists
Additional information: 1
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
삭제된 member 를 생성해주기 전에 해당 디렉토리가서 파일 지워야 함
SQL> !rm /data/temp3/redo03_b.log
SQL> alter database add logfile member '/data/temp3/redo03_b.log'to group 3;
Database altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
3 /data/temp3/redo03_b.log 5 24 INACTIVE YES
6 rows selected.
Case 2. archive 완료된 그룹이 지워진 후 DB Close 상태
( 에러코드 : ORA-00313: open failed for members of log group....)
current가 아닌 하나의 그룹이 삭제된 후 DB가 종료된 경우
DB를 시작하면 지워진 Redo Log 그룹 때문에 에러가 발생하며 DB가 켜지지 않음
그룹이 삭제전 Archive 에 데이터를 복사해 놓았다면 별 문제 없이 해당 그룹을 삭제하고 재생성 하는것으로 해결가능
step1. 현재 상태 확인
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ------
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
3 /data/temp3/redo03_b.log 5 24 INACTIVE YES
6 rows selected.
step2. redo log file 삭제 후 장애 확인
SQL> !rm /data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
ls: /data/temp3/redo03*: 그런 파일이나 디렉토리가 없음
SQL> shut immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
ORA-03113: end-of-file on communication channel <-- 강제로 종료되었다는 뜻
Process ID: 1762
Session ID: 1 Serial number: 5
SQL> !
[oracle@localhost ~]$ vi /app/oracle/diag/rdbms/testdb/testdb/trace/alert_testdb.log
alert log 파일에서 redo03 장애 부분 확인
[oracle@localhost ~]$ exit
exit
step3. 복구 후 OPEN
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Fri Oct 17 16:53:53 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 5 24 INACTIVE YES
3 /data/temp3/redo03_c.log 5 24 INACTIVE YES
6 rows selected.
삭제된 그룹3 이 archive 의 상태가 YES 이므로 데이터가 들어갔음. 이럴 경우는 해당 그룹삭제후 OPEN 하면됨
SQL> alter database drop logfile group 3;
Database altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
SQL> alter database open;
Database altered. <-- 제대로 OPEN 됬음
SQL> alter database add logfile group 3(
2 '/data/temp3/redo03.log',
3 '/data/temp3/redo03_b.log') size 50m;
Database altered. <-- 다시 그룹3 생성해줌 (MOUNT 에서 만들고 OPEN 해도 됨)
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 CURRENT NO
1 /data/temp3/redo01_b.log 5 25 CURRENT NO
2 /data/temp3/redo02.log 5 23 INACTIVE YES
2 /data/temp3/redo02_b.log 5 23 INACTIVE YES
3 /data/temp3/redo03.log 50 0 UNUSED YES
3 /data/temp3/redo03_b.log 50 0 UNUSED YES
6 rows selected.
Case 3. current 아닌 그룹 중 archive 안 된 그룹이 삭제되고 DB가 OPEN 상태일 경우
(에러코드 : ORA-00313: open failed for members of log group ....)
삭제된 그룹이 archive 되지 않은 경우.
서버 운영중 특정 그룹이 지워진 후 계속 log switch 가 발생하게 되면 DB가 archive hang 현상이 발생해 비정상 종료됨
step1. 현재상태 확인
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 25 INACTIVE YES
1 /data/temp3/redo01_b.log 5 25 INACTIVE YES
2 /data/temp3/redo02.log 5 27 CURRENT NO
2 /data/temp3/redo02_b.log 5 27 CURRENT NO
3 /data/temp3/redo03.log 50 26 INACTIVE YES
3 /data/temp3/redo03_b.log 50 26 INACTIVE YES
6 rows selected.
step2. 그룹 삭제 ( archive 완료된 그룹 3 을 삭제 )
SQL> !rm -f /data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
ls: /data/temp3/redo03*: 그런 파일이나 디렉토리가 없음
SQL> alter system switch logfile; <-- 로그스위치를 계속 발생시켜 hang 상태를 유발
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> / <-- hang 발생해서 대기상태 됨. ctrl + c 키로 작업 취소시킴
alter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 31 CURRENT NO
1 /data/temp3/redo01_b.log 5 31 CURRENT NO
2 /data/temp3/redo02.log 5 30 INACTIVE NO
2 /data/temp3/redo02_b.log 5 30 INACTIVE NO
3 /data/temp3/redo03.log 50 29 INACTIVE NO
3 /data/temp3/redo03_b.log 50 29 INACTIVE NO
6 rows selected.
위에서 arc 부분을 보면 전부 NO 상태임을 확인할 수 있다.
3번이 장애가 일어나서 차례로 아카이빙이 되지않았기 때문에 hang 이 일어난것
SQL> !
[oracle@localhost ~]$ vi /app/oracle/diag/rdbms/testdb/testdb/trace/alert_testdb.log
Fri Oct 17 17:14:20 2014
Errors in file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_arc3_1979.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/data/temp3/redo03_b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/data/temp3/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Case 4. Current 아닌 그룹 중 archive 안 된 그룹이 지워지고 DB Close 상태인 경우
[관련 에러코드]
ORA-00257 : archiver error. Connect internal only, until freed.
ORA-00313 : open failed for members of log group 2 of thread 1
ORA-00350 : log 2 of instance testdb (thread 1 ) needs to be archived
step1. 상태 확인
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 34 CURRENT NO
1 /data/temp3/redo01_b.log 5 34 CURRENT NO
2 /data/temp3/redo02.log 5 33 INACTIVE YES
2 /data/temp3/redo02_b.log 5 33 INACTIVE YES
3 /data/temp3/redo03.log 50 32 INACTIVE YES
3 /data/temp3/redo03_b.log 50 32 INACTIVE YES
6 rows selected.
step2. 장애 발생시킴
SQL> !rm -f /data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
ls: /data/temp3/redo03*: 그런 파일이나 디렉토리가 없음
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL>/ <-- hang 발생
[oracle@localhost ~]$ sqlplus scott/tiger <-- hang 상태로 다른 터미널 열어서 테스트
SQL*Plus: Release 11.2.0.2.0 Production on Fri Oct 17 17:33:32 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-00257: archiver error. Connect internal only, until freed. <-- 접속이 안됨
Enter user-name: sys/oracle as sysdba <-- 관리자 계정으로는 접속이 가능
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning option
SQL>
관리자 계정으로 에러를 해결해야 하기 때문에 다른 계정은 접속이 안됨
SQL> shutdown abort;
ORACLE instance shut down.
step3. 재시작 시키면 에러 발생하며 중단 됨
SQL> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
ORA-03113: end-of-file on communication channel <-- redo 문제로 강제 종료됨
Process ID: 2763
Session ID: 1 Serial number: 5
step4. 장애 확인후 복구
SQL> !
[oracle@localhost ~]$ vi /app/oracle/diag/rdbms/testdb/testdb/trace/alert_testdb.log <--alert log 열어서 장애확인
[oracle@localhost ~]$ sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Fri Oct 17 17:35:53 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
SQL> alter database drop logfile group 3;
alter database drop logfile group 3
*
ERROR at line 1:
ORA-00350: log 3 of instance testdb (thread 1) needs to be archived <-- 아카이브 안된 그룹은 삭제 할 수 없다함
ORA-00312: online log 3 thread 1: '/data/temp3/redo03.log'
ORA-00312: online log 3 thread 1: '/data/temp3/redo03_b.log'
SQL> alter database clear unarchived logfile group 3; <-- redo log file 을 drop 하고 재생성
Database altered.
SQL> alter database open;
Database altered.
SQL> !ls /data/temp3/redo03*
/data/temp3/redo03_b.log /data/temp3/redo03.log
SQL> @log;
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 37 INACTIVE YES
1 /data/temp3/redo01_b.log 5 37 INACTIVE YES
2 /data/temp3/redo02.log 5 36 INACTIVE YES
2 /data/temp3/redo02_b.log 5 36 INACTIVE YES
3 /data/temp3/redo03.log 50 38 CURRENT NO
3 /data/temp3/redo03_b.log 50 38 CURRENT NO
6 rows selected.
SQL>
Case 5. current 그룹이 삭제된 후 DB Open 상태
이 경우는 위에서 살펴본 case 3 과 같은 경우
Case 6. Current 그룹이 삭제된 경우 - Shut immediate 로 종료
[관련 에러 코드]
ORA-00313 : open failed for members of log group .....
ORA-03113 : end-of-file on communication channel.
Current 그룹이 삭제된 후 DB가 종료되었다면 정상 종료인지 비정상 종료인지에 따라 향후 재시작 할 때 문제가 될 수 있음
step1. 현재상태 확인
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 37 INACTIVE YES
1 /data/temp3/redo01_b.log 5 37 INACTIVE YES
2 /data/temp3/redo02.log 5 36 INACTIVE YES
2 /data/temp3/redo02_b.log 5 36 INACTIVE YES
3 /data/temp3/redo03.log 50 38 CURRENT NO
3 /data/temp3/redo03_b.log 50 38 CURRENT NO
6 rows selected.
step2. 데이터 입력 후 장애 발생
SQL> create table scott.tt200 (no number) tablespace users;
Table created.
SQL> insert into scott.tt200 values(1);
1 row created.
SQL> commit;
Commit complete.
테스트용 테이블 scott.tt200 을 생성한 후 1을 입력한 내용이 3번 그룹에 저장됨
step3. current 상태인 3번 그룹을 os 명령어로 삭제 한 후 재부팅
SQL> !rm -f /data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
ls: /data/temp3/redo03*: No such file or directory
SQL> shut immediate; <-- 정상 종료시킴
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
ORA-03113: end-of-file on communication channel <-- 강제로 종료 됨
Process ID: 3300
Session ID: 1 Serial number: 5
step4. alert log로 에러 메시지 확인
SQL> !vi $ORACLE_BASE/diag/rdbms/testdb/testdb/trace/alert_testdb.log
step5. 복구후 open
current 상태의 redo log group 이 삭제된 후 DB가 shutdown immediate로 종료 된 것입니다.
scott.tt200 을 생성후 1을 입력 후 commit 했기 때문에 shutdown immediate 했으면 해당 내용은 데이터 파일로 저장된 상태
그렇기 때문에 데이터는 복구 할 필요가 없고 redo log file 이 없어서 open 안되는 문제만 해결하면 됨
redo log 를 재생성 하는 resetlogs 옵션을 사용하기 위해 불완전 복구를 해야함
그래서 지금과 같은 상황에 불완전 복구 하기 위해 until cancel 옵션을 사용
SQL> startup mount
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
SQL> recover database until cancel;
Media recovery complete.
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.tt200;
NO
----------
1
Case 7. Current 그룹이 삭제된 후 shutdown abort 로 종료 (backup file 이 존재할 경우)
[관련 에러 코드]
ORA-00326: log begins at change ....
ORA-00283: recovery session canceled due to errors
step0. DB 종료후 전체 데이터베이스 백업
step1. Open 후 현재 상태 확인
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 INACTIVE YES
1 /data/temp3/redo01_b.log 5 4 INACTIVE YES
2 /data/temp3/redo02.log 5 5 CURRENT NO
2 /data/temp3/redo02_b.log 5 5 CURRENT NO
3 /data/temp3/redo03.log 50 3 INACTIVE YES
3 /data/temp3/redo03_b.log 50 3 INACTIVE YES
6 rows selected.
2번 그룹에 scott.tt600 테이블을 생성해서 데이터 1건을 입력
SQL> create table scott.tt600 (no number);
Table created.
SQL> insert into scott.tt600 values(1);
1 row created.
SQL> commit;
Commit complete. <-- 여기까지 2번 그룹에 저장
SQL> alter system switch logfile; <-- 로그 스위치 일으켜서 current 가 3번 그룹으로 바뀜
System altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 INACTIVE YES
1 /data/temp3/redo01_b.log 5 4 INACTIVE YES
2 /data/temp3/redo02.log 5 5 ACTIVE YES
2 /data/temp3/redo02_b.log 5 5 ACTIVE YES
3 /data/temp3/redo03.log 50 6 CURRENT NO
3 /data/temp3/redo03_b.log 50 6 CURRENT NO
6 rows selected.
3번 그룹에 데이터 입력
SQL> insert into scott.tt600 values(2);
1 row created.
SQL> commit;
Commit complete. <-- 여기까지 3번 그룹에 저장
SQL> alter system switch logfile; <-- 로그스위치 일으켜서 1번 그룹이 current
System altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 7 CURRENT NO
1 /data/temp3/redo01_b.log 5 7 CURRENT NO
2 /data/temp3/redo02.log 5 5 ACTIVE YES
2 /data/temp3/redo02_b.log 5 5 ACTIVE YES
3 /data/temp3/redo03.log 50 6 ACTIVE YES
3 /data/temp3/redo03_b.log 50 6 ACTIVE YES
6 rows selected.
SQL> insert into scott.tt600 values(3);
1 row created.
SQL> commit;
Commit complete. <-- 1번 그룹에 저장
SQL> select * from scott.tt600;
NO
----------
1 <-- 2번 그룹에 저장됨
2 <-- 3번 그룹에 저장됨
3 <-- 1번 그룹에 저장됨
현재 current 상태인 1번 그룹 삭제하는 장애 만듬
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 7 CURRENT NO
1 /data/temp3/redo01_b.log 5 7 CURRENT NO
2 /data/temp3/redo02.log 5 5 ACTIVE YES
2 /data/temp3/redo02_b.log 5 5 ACTIVE YES
3 /data/temp3/redo03.log 50 6 ACTIVE YES
3 /data/temp3/redo03_b.log 50 6 ACTIVE YES
6 rows selected.
SQL> !rm -f /data/temp3/redo01*
SQL> !ls /data/temp3/redo01*
ls: /data/temp3/redo01*: No such file or directory
SQL> shut abort;
ORACLE instance shut down.
SQL> !cp /data/backup/close/*.dbf /data/temp3/
step3. 복구하기
SQL> startup mount
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
SQL> recover database until cancel;
ORA-00279: change 1428687 generated at 10/17/2014 18:26:38 needed for thread 1
ORA-00289: suggestion : /data/arc2/1_1_861213720.arc
ORA-00280: change 1428687 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1429110 generated at 10/17/2014 18:45:57 needed for thread 1
ORA-00289: suggestion : /data/arc2/2_1_861213720.arc
ORA-00280: change 1429110 for thread 1 is in sequence #2
ORA-00278: log file '/data/arc2/1_1_861213720.arc' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1429113 generated at 10/17/2014 18:45:57 needed for thread 1
ORA-00289: suggestion : /data/arc2/3_1_861213720.arc
ORA-00280: change 1429113 for thread 1 is in sequence #3
ORA-00278: log file '/data/arc2/2_1_861213720.arc' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1429117 generated at 10/17/2014 18:46:00 needed for thread 1
ORA-00289: suggestion : /data/arc2/4_1_861213720.arc
ORA-00280: change 1429117 for thread 1 is in sequence #4
ORA-00278: log file '/data/arc2/3_1_861213720.arc' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1429120 generated at 10/17/2014 18:46:00 needed for thread 1
ORA-00289: suggestion : /data/arc2/5_1_861213720.arc
ORA-00280: change 1429120 for thread 1 is in sequence #5
ORA-00278: log file '/data/arc2/4_1_861213720.arc' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1429213 generated at 10/17/2014 18:46:51 needed for thread 1
ORA-00289: suggestion : /data/arc2/6_1_861213720.arc
ORA-00280: change 1429213 for thread 1 is in sequence #6
ORA-00278: log file '/data/arc2/5_1_861213720.arc' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00279: change 1429232 generated at 10/17/2014 18:47:37 needed for thread 1
ORA-00289: suggestion : /data/arc2/7_1_861213720.arc
ORA-00280: change 1429232 for thread 1 is in sequence #7
ORA-00278: log file '/data/arc2/6_1_861213720.arc' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '/data/arc2/7_1_861213720.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.tt600
2 ;
NO
----------
1
2
<-- 3번그룹은 데이터가 복구 안되었음
Case 8. - Current 그룹이 삭제되고 Shutdown abort 로 종료됨 (backup file 이나 archive log file 이 없을 경우)
[관련 에러 코드]
ORA-01547 : warning:RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-00308 : cannot open archived log ...
ORA-01194 : file 1 needs more recovery to be consistent
상황 1. 데이터를 모두 복구해내는 경우
step 1. no archive log mode 로 변경하기
SQL> shut immediate
SQL> startup mount
SQL> archive log list <-- archive 모드 확인하고 archive log mode일경우 noarchive log mode 로 변경
SQL> alter database noarchivelog ;
SQL> alter database open ;
step 2. 데이터 입력
SQL>@log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 CURRENT NO
1 /data/temp3/redo01_b.log 5 4 CURRENT NO
2 /data/temp3/redo02.log 5 2 INACTIVE NO
2 /data/temp3/redo02_b.log 5 2 INACTIVE NO
3 /data/temp3/redo03.log 50 3 INACTIVE NO
3 /data/temp3/redo03_b.log 50 3 INACTIVE NO
6 rows selected.
SQL> create table scott.tt650 ( no number ) ;
Table created.
SQL> insert into scott.tt650 values(1);
1 row created.
SQL> commit;
Commit complete. <--여기까지 1번 그룹에 저장
SQL> alter system switch logfile;
System altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 ACTIVE NO
1 /data/temp3/redo01_b.log 5 4 ACTIVE NO
2 /data/temp3/redo02.log 5 5 CURRENT NO
2 /data/temp3/redo02_b.log 5 5 CURRENT NO
3 /data/temp3/redo03.log 50 3 INACTIVE NO
3 /data/temp3/redo03_b.log 50 3 INACTIVE NO
6 rows selected.
SQL> insert into scott.tt650 values(2);
1 row created.
SQL> commit;
Commit complete. <--여기까지 2번 그룹에 저장
SQL> alter system switch logfile;
System altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 ACTIVE NO
1 /data/temp3/redo01_b.log 5 4 ACTIVE NO
2 /data/temp3/redo02.log 5 5 ACTIVE NO
2 /data/temp3/redo02_b.log 5 5 ACTIVE NO
3 /data/temp3/redo03.log 50 6 CURRENT NO
3 /data/temp3/redo03_b.log 50 6 CURRENT NO
6 rows selected.
SQL> insert into scott.tt650 values(3);
1 row created.
SQL> commit;
Commit complete. <--여기까지 3번 그룹에 저장
SQL> select * from scott.tt650;
NO
----------
1 <-- 1번 그룹에 저장
2 <-- 2번 그룹에 저장
3 <-- 3번 그룹에 저장
step 3. current 그룹이 삭제되는 장애 발생 후 강제 종료
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 7 INACTIVE NO
1 /data/temp3/redo01_b.log 5 7 INACTIVE NO
2 /data/temp3/redo02.log 5 8 INACTIVE NO
2 /data/temp3/redo02_b.log 5 8 INACTIVE NO
3 /data/temp3/redo03.log 50 9 CURRENT NO
3 /data/temp3/redo03_b.log 50 9 CURRENT NO
6 rows selected.
위에서 3번 그룹이 current 임이 확인 됨
SQL> !rm -f data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
/data/temp3/redo03_b.log /data/temp3/redo03.log
SQL> !rm -f /data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
ls: /data/temp3/redo03*: No such file or directory
SQL> shut abort
ORACLE instance shut down.
step 4. 복구
SQL> !vi $ORACLE_HOME/dbs/inittestdb.ora
기존 파라 미터 파일에 다음과 같은 파라미터 추가 : _allow_resetlogs_corruption=true
SQL> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/data/temp3/redo03_b.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/data/temp3/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
위와 같이 3번 그룹이 없어서 에러가 발생
SQL> recover database until cancel;
ORA-00279: change 1430366 generated at 10/17/2014 19:05:37 needed for thread 1
ORA-00289: suggestion : /data/arc2/9_1_861216772.arc
ORA-00280: change 1430366 for thread 1 is in sequence #9
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '/data/arc2/9_1_861216772.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/data/temp3/system01.dbf'
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.tt650;
NO
----------
1
2
3
복구가 된 이유는 로그스위치가 수차례 일어나면서 데이터가 데이터파일에 모두 저장이되어서 완전 복구 된 것
상황 2. current 에 저장된 데이터는 복구 못하는 경우
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 1 CURRENT NO
1 /data/temp3/redo01_b.log 5 1 CURRENT NO
2 /data/temp3/redo02.log 5 0 UNUSED YES
2 /data/temp3/redo02_b.log 5 0 UNUSED YES
3 /data/temp3/redo03.log 50 0 UNUSED YES
3 /data/temp3/redo03_b.log 50 0 UNUSED YES
6 rows selected.
SQL> create table scott.tt660 ( no number );
Table created.
SQL> insert into scott.tt660 values(1);
1 row created.
SQL> commit; <-- 여기까지 1번 그룹에 저장
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> insert into scott.tt660 values(2);
1 row created.
SQL> commit;
Commit complete. <-- 여기까지 2번 그룹에 저장
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 1 ACTIVE NO
1 /data/temp3/redo01_b.log 5 1 ACTIVE NO
2 /data/temp3/redo02.log 5 2 CURRENT NO
2 /data/temp3/redo02_b.log 5 2 CURRENT NO
3 /data/temp3/redo03.log 50 0 UNUSED YES
3 /data/temp3/redo03_b.log 50 0 UNUSED YES
6 rows selected.
SQL> alter system switch logfile;
System altered.
SQL> insert into scott.tt660 values(3);
1 row created.
SQL> commit;
Commit complete. <-- 여기까지 3번 그룹에 저장
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 1 ACTIVE NO
1 /data/temp3/redo01_b.log 5 1 ACTIVE NO
2 /data/temp3/redo02.log 5 2 ACTIVE NO
2 /data/temp3/redo02_b.log 5 2 ACTIVE NO
3 /data/temp3/redo03.log 50 3 CURRENT NO
3 /data/temp3/redo03_b.log 50 3 CURRENT NO
6 rows selected.
SQL> !rm /data/temp3/redo03*
SQL> !ls /data/temp3/redo03*
ls: /data/temp3/redo03*: No such file or directory
SQL> shut abort
ORACLE instance shut down.
SQL>! vi $ORACLE_HOME/dbs/inittestdb.ora
__allow_resetlogs_corruption=true 파라미터 추가
SQL> startup mount
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 293604248 bytes
Database Buffers 121634816 bytes
Redo Buffers 6086656 bytes
Database mounted.
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 1 ACTIVE NO
1 /data/temp3/redo01_b.log 5 1 ACTIVE NO
2 /data/temp3/redo02.log 5 2 ACTIVE NO
2 /data/temp3/redo02_b.log 5 2 ACTIVE NO
3 /data/temp3/redo03.log 50 3 CURRENT NO
3 /data/temp3/redo03_b.log 50 3 CURRENT NO
6 rows selected.
Case 9. 전체 Redo log file이 삭제된 경우 DB OPEN 상태 (archive log mode 에서 작업)
step1. 현재 상태 확인
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 1 CURRENT NO
1 /data/temp3/redo01_b.log 5 1 CURRENT NO
2 /data/temp3/redo02.log 5 0 UNUSED YES
2 /data/temp3/redo02_b.log 5 0 UNUSED YES
3 /data/temp3/redo03.log 50 0 UNUSED YES
3 /data/temp3/redo03_b.log 50 0 UNUSED YES
6 rows selected.
SQL> !rm -f /data/temp3/*.log
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> / <-- hang 발생 ctrl+c 눌러 취소
alter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 1 INACTIVE NO
1 /data/temp3/redo01_b.log 5 1 INACTIVE NO
2 /data/temp3/redo02.log 5 2 INACTIVE NO
2 /data/temp3/redo02_b.log 5 2 INACTIVE NO
3 /data/temp3/redo03.log 50 3 CURRENT NO
3 /data/temp3/redo03_b.log 50 3 CURRENT NO
6 rows selected.
1번 그룹이 seq 가 가장낮아서 1번 그룹 때문에 이후 모든 로그파일이 아카이빙 안되고 있어서 clear 해줌
SQL> alter database clear unarchived logfile group 1;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> / <-- hang 발생 ctrl+c 눌러 취소
alter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 CURRENT NO
1 /data/temp3/redo01_b.log 5 4 CURRENT NO
2 /data/temp3/redo02.log 5 2 INACTIVE NO
2 /data/temp3/redo02_b.log 5 2 INACTIVE NO
3 /data/temp3/redo03.log 50 3 ACTIVE NO
3 /data/temp3/redo03_b.log 50 3 ACTIVE NO
6 rows selected.
2번 그룹이 seq 가 가장낮아서 1번 그룹 때문에 이후 모든 로그파일이 아카이빙 안되고 있어서 clear 해줌
SQL> alter database clear unarchived logfile group 2;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> / <-- hang 발생 ctrl+c 눌러 취소
alter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> @log
6 ;
GROUP# MEMBER MB seq STATUS arc
------ --------------------------------------------- ---- ---------- -------- -----
1 /data/temp3/redo01.log 5 4 ACTIVE NO
1 /data/temp3/redo01_b.log 5 4 ACTIVE NO
2 /data/temp3/redo02.log 5 5 CURRENT NO
2 /data/temp3/redo02_b.log 5 5 CURRENT NO
3 /data/temp3/redo03.log 50 3 INACTIVE NO
3 /data/temp3/redo03_b.log 50 3 INACTIVE NO
6 rows selected.
3번 그룹이 seq 가 가장낮아서 1번 그룹 때문에 이후 모든 로그파일이 아카이빙 안되고 있어서 clear 해줌
SQL> alter database clear unarchived logfile group 3;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
Case 10. 전체 Redo log file 이 삭제된 경우 DB Close 상태 - 백업 있는 상태
DB가 shut immediate 상태로 종료되었을 경우 앞에서 확인한 Case 6 번의 경우와 동일하게 해결하면 된다.
그러나 shut abort 상태로 비정상 종료되었을 경우는 Case 7 번의 경우와 동일하게 복구하면 된다.
Case 11. 전체 Redo log file 이 삭제된 경우 DB Close 상태 - 백업 없는 상태
Case 8 방법과 복구방법이 동일
'오라클 > 백업/복구' 카테고리의 다른 글
Clone DB (0) | 2014.11.10 |
---|---|
sql loader (0) | 2014.11.10 |
데이터 이동하기 (0) | 2014.11.06 |
Log Miner 활용하기 (0) | 2014.11.05 |
control file, data file 연습문제 (0) | 2014.11.04 |
Control file 복구 (0) | 2014.11.04 |
Data file Recovery (불완전 복구) (0) | 2014.11.04 |