SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------
1 /app/oracle/oradata/jigi/redo01_a.log 51200 10 NO CURRENT 1059150 10-NOV-15
1 /app/oracle/oradata/jigi/redo01_b.log 51200 10 NO CURRENT 1059150 10-NOV-15
2 /app/oracle/oradata/jigi/redo02_a.log 51200 8 YES INACTIVE 1038768 10-NOV-15
2 /app/oracle/oradata/jigi/redo02_b.log 51200 8 YES INACTIVE 1038768 10-NOV-15
3 /app/oracle/oradata/jigi/redo03_a.log 51200 9 YES ACTIVE 1058781 10-NOV-15
3 /app/oracle/oradata/jigi/redo03_b.log 51200 9 YES ACTIVE 1058781 10-NOV-15
6 rows selected.
SQL> !rm -f /app/oracle/oradata/jigi/redo02_a.log
SQL> !ls /app/oracle/oradata/jigi/redo02_a.log
ls: cannot access /app/oracle/oradata/jigi/redo02_a.log: 그런 파일이나 디렉터리가 없습니다
SQL> alter system switch logfile
2 ;
System altered.
SQL> /
System altered.
SQL> /
/
System altered.
SQL>
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------
1 /app/oracle/oradata/jigi/redo01_a.log 51200 13 YES INACTIVE 1059319 10-NOV-15
1 /app/oracle/oradata/jigi/redo01_b.log 51200 13 YES INACTIVE 1059319 10-NOV-15
2 /app/oracle/oradata/jigi/redo02_a.log 51200 14 NO CURRENT 1059322 10-NOV-15
2 /app/oracle/oradata/jigi/redo02_b.log 51200 14 NO CURRENT 1059322 10-NOV-15
3 /app/oracle/oradata/jigi/redo03_a.log 51200 12 YES INACTIVE 1059316 10-NOV-15
3 /app/oracle/oradata/jigi/redo03_b.log 51200 12 YES INACTIVE 1059316 10-NOV-15
6 rows selected.
SQL> !vi /app/oracle/diag/rdbms/jigi/jigi/trace/alert_jigi.log
...
Archived Log entry 11 added for thread 1 sequence 11 ID 0x718bcb06 dest 1:
Archived Log entry 12 added for thread 1 sequence 11 ID 0x718bcb06 dest 2:
Tue Nov 10 20:42:21 2015
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_m000_2408.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/app/oracle/oradata/jigi/redo02_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Thread 1 cannot allocate new log, sequence 13
Checkpoint not complete
Current log# 3 seq# 12 mem# 0: /app/oracle/oradata/jigi/redo03_a.log
Current log# 3 seq# 12 mem# 1: /app/oracle/oradata/jigi/redo03_b.log
Checker run found 1 new persistent data failures
Thread 1 advanced to log sequence 13 (LGWR switch)
Current log# 1 seq# 13 mem# 0: /app/oracle/oradata/jigi/redo01_a.log
Current log# 1 seq# 13 mem# 1: /app/oracle/oradata/jigi/redo01_b.log
...
|
장애가 확인된 멤버는 삭제한 후 다시 생성 |
---|
{code:sql} |
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME
6 rows selected.
SQL> alter database drop logfile member '/app/oracle/oradata/jigi/redo02_a.log';
Database altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME
SQL> alter database add logfile member '/app/oracle/oradata/jigi/redo02_a.log' to group 2;
Database altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME
6 rows selected.
{code} |
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 14 YES INACTIVE 1059322 10-NOV-15 YES
2 /app/oracle/oradata/jigi/redo02_b.log 51200 14 YES INACTIVE 1059322 10-NOV-15 YES
3 /app/oracle/oradata/jigi/redo03_a.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
3 /app/oracle/oradata/jigi/redo03_b.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
6 rows selected.
SQL> !rm /app/oracle/oradata/jigi/redo02*
SQL> !ls /app/oracle/oradata/jigi/redo02*
ls: cannot access /app/oracle/oradata/jigi/redo02*: 그런 파일이나 디렉터리가 없습니다
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 494930440 bytes
Database Buffers 285212672 bytes
Redo Buffers 2637824 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 2959
Session ID: 1 Serial number: 5
SQL> !vi /app/oracle/diag/rdbms/jigi/jigi/trace/alert_jigi.log
...
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_lgwr_2873.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/app/oracle/oradata/jigi/redo02_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_lgwr_2873.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/app/oracle/oradata/jigi/redo02_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_ora_2959.trc:
ORA-00313: open failed for members of log group 1 of thread
ORA-00312: online log 2 thread 1: '/app/oracle/oradata/jigi/redo02_b.log'
ORA-00312: online log 2 thread 1: '/app/oracle/oradata/jigi/redo02_a.log'
USER (ospid: 2959): terminating the instance due to error 313
Tue Nov 10 21:34:26 2015
ARC1 started with pid=21, OS id=2963
Instance terminated by USER, pid = 2959
...
SQL> conn sys/oracle as sysdba
Connected to an idle instance.
SQL>
SQL> startup mount;
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 494930440 bytes
Database Buffers 285212672 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 14 YES INACTIVE 1059322 10-NOV-15 YES
2 /app/oracle/oradata/jigi/redo02_b.log 51200 14 YES INACTIVE 1059322 10-NOV-15 YES
3 /app/oracle/oradata/jigi/redo03_a.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
3 /app/oracle/oradata/jigi/redo03_b.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
6 rows selected.
SQL> alter database drop logfile group 2;
Database altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
3 /app/oracle/oradata/jigi/redo03_a.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
3 /app/oracle/oradata/jigi/redo03_b.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
SQL>
SQL> alter database open;
Database altered.
SQL> alter database add logfile group 2 ( '/app/oracle/oradata/jigi/redo02_a.log', '/app/oracle/oradata/jigi/redo02_b.log' ) size 50m;
Database altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 16 NO CURRENT 1059961 10-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 0 YES UNUSED 0 YES
2 /app/oracle/oradata/jigi/redo02_b.log 51200 0 YES UNUSED 0 YES
3 /app/oracle/oradata/jigi/redo03_a.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
3 /app/oracle/oradata/jigi/redo03_b.log 51200 15 YES INACTIVE 1059943 10-NOV-15 YES
6 rows selected.
SQL>
Step 1. 현재 상태 확인 |
---|
{code:sql} |
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
{code} | Step 2. 그룹 삭제 ( 현재 archive 완료된 1번 그룹을 삭제합니다. ) |
---|---|
{code:sql} |
SQL> !rm -f /app/oracle/oradata/jigi/redo01*
SQL> !ls /app/oracle/oradata/jigi/redo01*
ls: cannot access /app/oracle/oradata/jigi/redo01*: 그런 파일이나 디렉터리가 없습니다
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> / <-- 행 발생 Ctrl + C
^Calter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> !log
/bin/bash: log: command not found
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL>
{code} | Step 3. Alert log 확인 후 원인 파악 하기 |
---|---|
{code:sql} |
SQL> !vi /app/oracle/diag/rdbms/jigi/jigi/trace/alert_jigi.log
...
Tue Nov 10 22:53:25 2015
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_m000_4084.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/app/oracle/oradata/jigi/redo01_b.log' -- 1번 그룹이 계속 장애가 발생
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/app/oracle/oradata/jigi/redo01_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
...
{code} | Step 4. 장애 해결 |
---|---|
{code:sql} |
SQL> alter database clear unarchived logfile group 1;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
/
System altered.
SQL>
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL>
{code} * clear unarchived : drop 하고 신규로 add 해주는 역할 * 온라인 중에 문제 해결 가능 * 작업 이후 반드시 full backup 수행해야 합니다. ** archive log file이 중간에 비어버리기 때문에 그냥 넘어갔다가는 향후에 장애가 발생해 복구가 안되니 반드시 이 작업 후에는 전체 받힌 백업을 받아야 합니다. *** 11g는 여기까지하면 문제 해결 *** 10버전에서는 log switch가 발생하면 다시 archive hang이 발생합니다. ( page. 179 ) **** clear 작업 이후 drop 이후 add ( 10g ) |
Step 1. 현재 상태 확인 |
---|
{CODE:SQL} |
QL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL>
SQL>
SQL>
SQL>
SQL> !rm -f /app/oracle/oradata/jigi/redo03*
SQL> !ls /app/oracle/oradata/jigi/redo03*
ls: cannot access /app/oracle/oradata/jigi/redo03*: 그런 파일이나 디렉터리가 없습니다
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
/
System altered.
SQL>
System altered.
SQL> / <-- hang
{CODE} | 일반 계정 접속 에러 및 sys 로그인 복구 |
---|---|
{code:sql} |
SQL> conn scott/tiger
ERROR:
ORA-00257: archiver error. Connect internal only, until freed.
Warning: You are no longer connected to ORACLE.
SQL>
SQL> conn scott/tiger
ERROR:
ORA-00257: archiver error. Connect internal only, until freed.
SQL> conn scott/tiger
ERROR:
ORA-00257: archiver error. Connect internal only, until freed.
SQL>
SQL> conn sys/oracle as sysdba
Connected.
SQL>
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
{code} | Step 3. 재시작시키면 에러가 발생하면서 중단됩니다. |
---|---|
{code:sql} |
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 494930440 bytes
Database Buffers 285212672 bytes
Redo Buffers 2637824 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 3476
Session ID: 1 Serial number: 5
{code} | Step 4. 다른 터미널을 하나 더 열어서 Alert log에서 장애를 확인합니다. |
---|---|
{code:Sql} |
SQL> !vi /app/oracle/diag/rdbms/jigi/jigi/trace/alert_jigi.log
...
ARC0: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC0: STARTING ARCH PROCESSES
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_lgwr_3390.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_lgwr_3390.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_ora_3476.trc:
ORA-00313: open failed for members of log group 1 of thread
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
USER (ospid: 3476): terminating the instance due to error 313
Tue Nov 10 22:00:15 2015
ARC1 started with pid=21, OS id=3480
Instance terminated by USER, pid = 3476
..
{code} | Case 2의 경우에 해결했던 명령으로 시도 |
---|---|
{code:sql} |
SQL> conn sys/oracle as sysdba
Connected to an idle instance.
SQL>
SQL> startup mount;
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 494930440 bytes
Database Buffers 285212672 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> alter database drop logfile group 3;
alter database drop logfile group 3
*
ERROR at line 1:
ORA-00350: log 3 of instance jigi (thread 1) needs to be archived
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
SQL> alter database clear unarchived logfile group 3;
Database altered.
SQL>
SQL> alter database open;
Database altered.
SQL> !ls /app/oracle/oradata/jigi/redo03*
/app/oracle/oradata/jigi/redo03_a.log /app/oracle/oradata/jigi/redo03_b.log
SQL>
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
{code} * 파일이 자동으로 생성 * 이 명령으로 사용한 후에는 반드시 전체 Full Backup을 수행하길 권장 |
Step 1. 현재 상태 확인 |
---|
{code:sql} |
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL>
{code} | Step 2. 데이터 입력 후 장애 발생 |
---|---|
{code:sql} |
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.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL>
{code} | Step 3. Current 상태인 2번 그룹을 OS 명령어로 삭제한 후 재부팅합니다. |
---|---|
{code:sql} |
SQL> !rm -f /app/oracle/oradata/jigi/redo03*
SQL> !ls /app/oracle/oradata/jigi/redo03*
ls: cannot access /app/oracle/oradata/jigi/redo03*: 그런 파일이나 디렉터리가 없습니다
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 4509
Session ID: 1 Serial number: 5
{code} | Step 4. Alert log 의 에러 메세지를 확인 합니다. |
---|---|
{code:sql} |
SQL> !vi /app/oracle/diag/rdbms/jigi/jigi/trace/alert_jigi.log
...
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_lgwr_4424.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /app/oracle/diag/rdbms/jigi/jigi/trace/jigi_ora_4509.trc:
ORA-00313: open failed for members of log group 1 of thread
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
USER (ospid: 4509): terminating the instance due to error 313
Tue Nov 10 23:20:39 2015
ARC2 started with pid=22, OS id=4515
Instance terminated by USER, pid = 4509
...
{code} | Step 5. 복구 후 Open 합니다. |
---|---|
{code:sql} |
SQL> conn sys/oracle as sysdba
Connected to an idle instance.
SQL>
SQL> startup mount
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> recover database until cancel
Media recovery complete.
SQL>
SQL> alter database open resetlogs
2 ;
Database altered.
SQL> select * from scott.tt200;
NO
SQL>
* Shutdown immediate란 DB Buffer Cache에 있는 내용 중에서 Commit 완료된 내용은 데이터 파일로
전부 저장하고 Commit이 안 된 내용은 rollback한 후 종료 ( 복구 불필요 )
* Current 상태의 Redo log file이 없기 때문에 Open 이 되지 않습니다.
** Control File에는 명단이 있으나 실제 파일이 없는 Redo log를 재생성시키는 RESETLOGS 옵션을 사용하는 것입니다.
*** 문제는 RESETLOGS 옵션은 불완전 복구를 수행했을 경우만 쓸 수 있다는 ?입니다.
**** 분완전 복구 옵션 중에 until cancel 옵션을 쓰며 됩니다. ( 설명 뒤장 )
h3. Case 7 - Current 그룹이 삭제된 후 Shutdown abort로 종료 ( Backup file이 존재할 경우 )
* Archive log mode 일 경우를 가정하고 진행 ( Noarchive log mode : 복구 불가능 )
* ORA-00326:log begins at change...
* ORA-00283:recovery session canceled due to errors
h3. page. 192 그림
!2015-11-07_02.PNG!
* SCN 106번 작업이 Current Redo Log File에 저장되어 있음
* Full export + archive log + redo log를 Current가 지워지기 직전까지인 SCN 105번 까지 복구
|| Step 0. DB 종료 후 전체 데이터베이스를 full backup을 수행하세요 ||
|{code:sql}
SQL> select name from v$datafile;
NAME
----------------------------------------
/app/oracle/oradata/jigi/system01.dbf
/app/oracle/oradata/jigi/sysaux01.dbf
/app/oracle/oradata/jigi/undotbs01.dbf
/app/oracle/oradata/jigi/users01.dbf
/app/oracle/oradata/jigi/example01.dbf
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> !cp /app/oracle/oradata/jigi/*.dbf /app/oracle/oradata
|
Step 1. Open 후 현재 상태 확인 |
---|
{code:Sql} |
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
Database opened.
SQL>
SQL> !ls /app/oracle/oradata
example01.dbf jigi sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf users01.dbf
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> create table scott.tt600 ( no number );
Table created.
SQL> insert into scott.tt600 values( 1 );
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> insert into scott.tt600 values( 2 );
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> insert into scott.tt600 values( 3 );
1 row created.
SQL> commit;
Commit complete.
SQL> sleect * from scott.tt600;
SP2-0734: unknown command beginning "sleect * f..." - rest of line ignored.
SQL> select * from scott.tt600;
NO
{code} | Step 2. Current group 삭제 후 shutdown abort 시킴. |
---|---|
{code:Sql} SQL> @log |
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
SQL> !rm -f /app/oracle/oradata/jigi/redo01*
SQL> !ls /app/oracle/oradata/jigi/redo01*
ls: cannot access /app/oracle/oradata/jigi/redo01*: 그런 파일이나 디렉터리가 없습니다
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
SQL> !ls /app/oracle/oradata/*.dbf
/app/oracle/oradata/example01.dbf /app/oracle/oradata/system01.dbf /app/oracle/oradata/undotbs01.dbf
/app/oracle/oradata/sysaux01.dbf /app/oracle/oradata/temp01.dbf /app/oracle/oradata/users01.dbf
{code} | Step 3. 복구 하기 |
---|---|
{code:Sql} |
SQL> !cp /app/oracle/oradata/*.dbf /app/oracle/oradata/jigi/
SQL> SQL>
SQL>
SQL> startup mount;
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> recover database;
ORA-00283: recovery session canceled due to errors
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/app/oracle/oradata/jigi/redo01_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 1 thread 1: '/app/oracle/oradata/jigi/redo01_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> recover database until cancel;
ORA-00279: change 1143390 generated at 11/12/2015 21:06:37 needed for thread 1
ORA-00289: suggestion : /home/data/arc2/arch_1_4_895611083.arc
ORA-00280: change 1143390 for thread 1 is in sequence #4
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
^C^C
SQL>
SQL>
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.tt600;
NO
{code} |
Step 1. No Archive Log Mode 로 변경하기 |
---|
{code:sql} |
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount;
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/data/arc2
Oldest online log sequence 1
Next log sequence to archive 1
Current log sequence 1
SQL>
SQL> alter database noarchivelog;
Database altered.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /home/data/arc2
Oldest online log sequence 1
Current log sequence 1
SQL>
SQL> alter database open;
Database altered.
SQL>
{code} | Step 2. 데이터 입력 |
---|---|
{code:sql} |
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
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.
SQL> alter system switch logfile;
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> insert into scott.tt650 values( 2 );
1 row created.
SQL> commit;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> insert into scott.tt650 values( 3 );
1 row created.
SQL> commit;
Commit complete.
SQL> select * from scott.tt650;
NO
{code} | Step 4. 복구 |
---|---|
{code:sql} |
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> !rm -f /app/oracle/oradata/jigi/redo03*
SQL> !ls /app/oracle/oradata/jigi/redo03*
ls: cannot access /app/oracle/oradata/jigi/redo03*: 그런 파일이나 디렉터리가 없습니다
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
SQL> !ls /$ORACLE_HOME/dbs/*
//app/oracle/product/11g/dbs/hc_jigi.dat //app/oracle/product/11g/dbs/lkJIGI //app/oracle/product/11g/dbs/spfilejigi_20151108.ora
//app/oracle/product/11g/dbs/init.ora //app/oracle/product/11g/dbs/orapwjigi
//app/oracle/product/11g/dbs/initjigi.ora //app/oracle/product/11g/dbs/spfilejigi.ora
SQL>
SQL> !vi /app/oracle/product/11g/dbs/initjigi.ora
SQL>
SQL> -- _allow_resetlogs_corruption=true
SQL>
SQL> startup
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_b.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00312: online log 3 thread 1: '/app/oracle/oradata/jigi/redo03_a.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> recover database until cancel;
ORA-00279: change 1149845 generated at 11/12/2015 22:49:05 needed for thread 1
ORA-00289: suggestion : /home/data/arc2/arch_1_6_895613121.arc
ORA-00280: change 1149845 for thread 1 is in sequence #6
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '/home/data/arc2/arch_1_6_895613121.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 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: '/app/oracle/oradata/jigi/system01.dbf'
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/app/oracle/oradata/jigi/system01.dbf'
SQL> recover database until cancel;
ORA-00279: change 1149845 generated at 11/12/2015 22:49:05 needed for thread 1
ORA-00289: suggestion : /home/data/arc2/arch_1_6_895613121.arc
ORA-00280: change 1149845 for thread 1 is in sequence #6
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
ORA-00308: cannot open archived log '/home/data/arc2/arch_1_6_895613121.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 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: '/app/oracle/oradata/jigi/system01.dbf'
SQL> show parameter spfile;
NAME TYPE VALUE
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 473958920 bytes
Database Buffers 306184192 bytes
Redo Buffers 2637824 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.tt650;
NO
SQL>
{code} * 체크 포인트가 발생했기 때문에 데이터가 데이터파일에 모두 저장되었기 때문입니다. |
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 1 NO CURRENT 1149846 12-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 1 NO CURRENT 1149846 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 0 YES UNUSED 0 YES
2 /app/oracle/oradata/jigi/redo02_b.log 51200 0 YES UNUSED 0 YES
3 /app/oracle/oradata/jigi/redo03_a.log 51200 0 YES UNUSED 0 YES
3 /app/oracle/oradata/jigi/redo03_b.log 51200 0 YES UNUSED 0 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;
Commit complete.
SQL> alter system switch logfile;
System altered.
SQL> insert into scott.tt660 values( 2 );
1 row created.
SQL> commit;
Commit complete.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 1 NO ACTIVE 1149846 12-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 1 NO ACTIVE 1149846 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 2 NO CURRENT 1150194 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_b.log 51200 2 NO CURRENT 1150194 12-NOV-15 NO
3 /app/oracle/oradata/jigi/redo03_a.log 51200 0 YES UNUSED 0 YES
3 /app/oracle/oradata/jigi/redo03_b.log 51200 0 YES UNUSED 0 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.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 1 NO ACTIVE 1149846 12-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 1 NO ACTIVE 1149846 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 2 NO ACTIVE 1150194 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_b.log 51200 2 NO ACTIVE 1150194 12-NOV-15 NO
3 /app/oracle/oradata/jigi/redo03_a.log 51200 3 NO CURRENT 1150216 12-NOV-15 NO
3 /app/oracle/oradata/jigi/redo03_b.log 51200 3 NO CURRENT 1150216 12-NOV-15 NO
6 rows selected.
SQL> !rm -f /app/oracle/oradata/jigi/redo03*
SQL> !ls /app/oracle/oradata/jigi/redo03*
ls: cannot access /app/oracle/oradata/jigi/redo03*: 그런 파일이나 디렉터리가 없습니다
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
SQL> !vi /app/oracle/product/11g/dbs/initjigi.ora
SQL> -- _allow_resetlogs_corruption=true
SQL>
SQL> startup mount pfile=/app/oracle/product/11g/dbs/initjigi.ora
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 473958920 bytes
Database Buffers 306184192 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
---------- --------------------------------------------- ---------- ---------- --- ---------------- ------------- ------------ ---
1 /app/oracle/oradata/jigi/redo01_a.log 51200 1 NO ACTIVE 1149846 12-NOV-15 NO
1 /app/oracle/oradata/jigi/redo01_b.log 51200 1 NO ACTIVE 1149846 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_a.log 51200 2 NO ACTIVE 1150194 12-NOV-15 NO
2 /app/oracle/oradata/jigi/redo02_b.log 51200 2 NO ACTIVE 1150194 12-NOV-15 NO
3 /app/oracle/oradata/jigi/redo03_a.log 51200 3 NO CURRENT 1150216 12-NOV-15 NO
3 /app/oracle/oradata/jigi/redo03_b.log 51200 3 NO CURRENT 1150216 12-NOV-15 NO
6 rows selected.
SQL> recover database until cancel;
ORA-00279: change 1149849 generated at 11/12/2015 22:59:21 needed for thread 1
ORA-00289: suggestion : /home/data/arc2/arch_1_1_895618740.arc
ORA-00280: change 1149849 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/app/oracle/oradata/jigi/redo01_a.log
ORA-00279: change 1150194 generated at 11/12/2015 23:04:41 needed for thread 1
ORA-00289: suggestion : /home/data/arc2/arch_1_2_895618740.arc
ORA-00280: change 1150194 for thread 1 is in sequence #2
ORA-00278: log file '/app/oracle/oradata/jigi/redo01_a.log' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/app/oracle/oradata/jigi/redo02_a.log
ORA-00279: change 1150216 generated at 11/12/2015 23:05:17 needed for thread 1
ORA-00289: suggestion : /home/data/arc2/arch_1_3_895618740.arc
ORA-00280: change 1150216 for thread 1 is in sequence #3
ORA-00278: log file '/app/oracle/oradata/jigi/redo02_a.log' no longer needed for this recovery
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
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: '/app/oracle/oradata/jigi/system01.dbf'
ORA-01112: media recovery not started
SQL> alter database open resetlogs;
Database altered.
SQL> select * from scott.tt660;
NO
----------
1
2
SQL>
Step 1. 현재 상태 확인 |
---|
{code:sql} |
SQL> startup mount
ORACLE instance started.
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /home/data/arc2
Oldest online log sequence 1
Current log sequence 1
SQL>
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-00265: instance recovery required, cannot set ARCHIVELOG mode
SQL> alter database open;
Database altered.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2217464 bytes
Variable Size 499124744 bytes
Database Buffers 281018368 bytes
Redo Buffers 2637824 bytes
Database mounted.
SQL>
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/data/arc2
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL>
SQL> show parameter pfile
NAME TYPE VALUE
Database altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL>
SQL> select status from v$instance;
STATUS
SQL>
SQL> !rm /app/oracle/oradata/jigi/redo*.log
SQL> !ls /app/oracle/oradata/jigi/redo*.log
ls: cannot access /app/oracle/oradata/jigi/redo*.log: 그런 파일이나 디렉터리가 없습니다
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
^Calter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> alter database clear unarchived logfile group 3;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> alter database clear unarchived logfile group 2;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL> alter system switch logfile;
^Calter system switch logfile
*
ERROR at line 1:
ORA-01013: user requested cancel of current operation
SQL> alter database clear unarchived logfile group 1;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> @log
GROUP# MEMBER MB SEQ ARC STATUS FIRST_CHANGE# FIRST_TIME ARC
6 rows selected.
SQL>
{code} |