Chap 16. Control File 장애 복구
1. Control File 관련 장애 해결하기
1) Parameter file 의 경로와 실제 파일 경로가 다른 경우
- 우선 장애 상황을 만들기 위해 DB를 종료한 후 parameter file 에 적혀 있는 3 개의 control file 중에 하나를 삭제해 보자.
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS> !
[oracle@chan ~]$ cat $ORACLE_HOME/dbs/inittestdb.ora | grep control_files
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl','/home/oracle/disk6/control03.ctl'
[oracle@chan ~]$
[oracle@chan ~]$ rm -f /home/oracle/disk6/control03.ctl
[oracle@chan ~]$
-- 다시 DB open
[oracle@chan ~]$ exit
exit
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
ORA-00205: error in identifying control file, check alert log for more info -- 장애 발생
SYS>
- alert_testdb.log 파일을 확인해서 장애상황 해결
SYS> !tail $ORACLE_BASE/diag/rdbms/testdb/testdb/trace/alert_testdb.log
Mon Aug 19 22:58:39 2013
ALTER DATABASE MOUNT
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/home/oracle/disk6/control03.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-205 signalled during: ALTER DATABASE MOUNT...
Mon Aug 19 22:58:39 2013
Checker run found 1 new persistent data failures
-- 위의 메세지 중 ORA-00202: control file: '/home/oracle/disk6/control03.ctl' 이런 부분이 보인다.
-- 해당 파일을 삭제했기 때문에 나오는 에러이다.
-- 해당 파일만 복사해 주고 다시 DB open 하면 끝!
SYS> select status from v$instance;
STATUS
------------------------
STARTED
SYS> !cp /home/oracle/disk4/control01.ctl /home/oracle/disk6/control03.ctl
SYS> alter database mount;
Database altered.
SYS> alter database open;
Database altered.
2) Control file 끼리 내용이 다른경우
- 다중화된 모든 control file 끼리는 정보가 동일해야 한다. 만약 정보가 달라서 발생하는 version error 가 생길때는 어떻게 해결해야 하는지 살펴보자.
- 우선 하나의 control file 의 정보를 다르게 만들어 보자
SYS> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
/home/oracle/disk6/control03.ctl
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !vi $ORACLE_HOME/dbs/inittestdb.ora
-- 아래 처럼 마지막 control file 을 주석처리 한 후 저장
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl'##,'/home/oracle/disk6/control03.ctl'
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Database mounted.
Database opened.
SYS>
SYS> select name from v$controlfile;
NAME
-------------------------------------------------------------------------------- /home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
-- control file 의 정보가 변경되게 checkpoint 를 여러번 일으켜보자.
SYS> alter system checkpoint;
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> /
System altered.
-- 주석처리 했던 control file 을 다시 사용하게 끔 변경
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !vi $ORACLE_HOME/dbs/inittestdb.ora
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl' ,'/home/oracle/disk6/control03.ctl'
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
ORA-00214: control file '/home/oracle/disk4/control01.ctl' version 865
inconsistent with file '/home/oracle/disk6/control03.ctl' version 846
-- 위의 에러를 보면, control01 의 버전은 865 인데, control03 의 버전은 846 이다.
-- 이럴 경우, 보통 번호가 큰 쪽이 최신 control file 이기 때문에 번호가 큰 파일로 덮어쓰면 된다.
SYS> !cp /home/oracle/disk4/control01.ctl /home/oracle/disk6/control03.ctl
SYS> alter database mount;
Database altered.
SYS> alter database open;
Database altered.
SYS> select name from v$controlfile;
NAME
-------------------------------------------------------------------------------- /home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
/home/oracle/disk6/control03.ctl
3) old control file / control file 삭제 된 경우 / incarnation 에러
- 편의를 위해 log와 data 파일을 조회하기 위한 sql 문을 미리 만들어 두자.
SYS> !vi data.sql
conn / as sysdba
set line 200
col tablespace_name for a10
col file_name for a50
col mb for 9999
select tablespace_name, bytes/1024/1024 MB, file_name from dba_data_files;
SYS> @data
Connected.
TABLESPACE MB FILE_NAME
---------- ----- --------------------------------------------------
USERS 5 /app/oracle/oradata/testdb/users01.dbf
UNDOTBS1 90 /app/oracle/oradata/testdb/undotbs01.dbf
SYSAUX 510 /app/oracle/oradata/testdb/sysaux01.dbf
SYSTEM 700 /app/oracle/oradata/testdb/system01.dbf
EXAMPLE 346 /app/oracle/oradata/testdb/example01.dbf
SYS> !vi log.sql
set line 200
col group# for 999
col mb for 9999
col member for a45
col seq# for 999
col status for a8
col arc for a5
select a.group#, a.member, b.bytes/1024/1024 MB, b.sequence# "SEQ#", b.status, b.archived "ARC", b.first_change# from v$logfile a, v$log b where a.group#=b.group# order by 1,2;
SYS> @log
GROUP# MEMBER MB SEQ# STATUS ARC FIRST_CHANGE#
------ --------------------------------------------- ----- ---- -------- ----- -------------
1 /app/oracle/oradata/testdb/redo01.log 50 4 INACTIVE NO 823608
2 /app/oracle/oradata/testdb/redo02.log 50 5 INACTIVE NO 841406
3 /app/oracle/oradata/testdb/redo03.log 50 6 CURRENT NO 859461
- 장애 상황 만들기 ▼
SYS> select name from v$controlfile;
NAME
------------------------------------
/home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
/home/oracle/disk6/control03.ctl
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !vi $ORACLE_HOME/dbs/inittestdb.ora
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl' ##,'/home/oracle/disk6/control03.ctl'
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Database mounted.
Database opened.
SYS>
SYS> select name from v$controlfile;
NAME
---------------------------------------------
/home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
-- 우선 다른 version 의 control file 을 만들기 위해 checkpoint
SYS> alter system checkpoint;
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !vi $ORACLE_HOME/dbs/inittestdb.ora
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl' ,'/home/oracle/disk6/control03.ctl'
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
ORA-00214: control file '/home/oracle/disk4/control01.ctl' version 898 inconsistent with file '/home/oracle/disk6/control03.ctl' version 879
-- 위의 에러를 보면 control01 과 control 03 의 version 이 다르다.
-- 이럴 때 위의 2) Control file 끼리 내용이 다른경우 처럼 해결을 할 때,
-- version 이 높은애를 복사하지 말고 낮은 애를 복사할 경우,
-- 어떤 에러가 나고 어떻게 처리하는지 살펴보자.
SYS> !cp /home/oracle/disk6/control03.ctl /home/oracle/disk4/control01.ctl
SYS> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00214: control file '/home/oracle/disk5/control02.ctl' version 898 inconsistent with file '/home/oracle/disk4/control01.ctl' version 879
-- 이 상황에서 다시 control01 (낮은 버전) 을 control02(높은버전) 로 복사
SYS> !cp /home/oracle/disk4/control01.ctl /home/oracle/disk5/control02.ctl
SYS> alter database mount;
Database altered.
-- 모든 control file 의 version 이 낮은 버전으로 다 동일하게 되어서 mount 는 되었다.
-- 이제 open 시켜보자.
SYS> alter database mount;
Database altered.
SYS> alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/app/oracle/oradata/testdb/system01.dbf'
ORA-01207: file is more recent than control file - old control file
-- old control file error 가 나왔다.
- 이 에러의 원인은 control file 의 checkpoint 가 data file 의 checkpoint 정보보다
- 더 예전 내용이기 때문이다.
- 보통 위의 장애 상황을 해결하기 위해서는 3가지 방법이 있을 수 있다.
[1] 현재 data file, redo log file 에 이상이 없을 경우 : 재생성, no resetlogs 로 복구
[2] 현재 data file, redo log file 에 이상이 있고, data backup 이 있을 경우 : using backup control 로 복구 (드문 경우임)
[3] 현재 data file, redo log file 에 이상이 있거나, data backup 이 없을 경우 : 재생성, resetlogs 로 복구
- 해결 방안 [1]: 현재 data file, redo log file에 이상이 없을 경우 (control file 재생성 + no resetlogs)
-- control file 을 재생성 하려면 no mount 상태에서 DB 를 재생성하는 명령어를 입력해야 하는데,
-- 그 명령어가 너무 길기 때문에 script 로 만들어서 생성하는 방법을 이용하자.
-- control file 재성성 script 를 만들기 위해서는 DB 가 mount 상태 이어야 한다.
SYS> select status from v$instance;
STATUS
--------
MOUNTED
SYS> alter database backup controlfile to trace as '/home/oracle/re.sql';
Database altered.
SYS> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SYS> !
[oracle@chan ~]$
-- /home/oracle/re.sql 파일을 열면 Set #1. NORESETLOGS case 과
-- Set #2. RESETLOGS case 부분으로 script 가 2 부분으로 나눠져 있다.
-- 여기서는 no resetlogs 를 사용할 것이므로, set #2 부분은 다 지우도록 하자.
-- 즉, 아래의 내용만 있으면 된다.
-- 주의 할 점은 LOGFILE 부분과 DATAFILE 부분은 정확해야 한다.
[oracle@chan ~]$ vi /home/oracle/re.sql
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" NORESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/app/oracle/oradata/testdb/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/app/oracle/oradata/testdb/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/app/oracle/oradata/testdb/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/app/oracle/oradata/testdb/system01.dbf',
'/app/oracle/oradata/testdb/sysaux01.dbf',
'/app/oracle/oradata/testdb/undotbs01.dbf',
'/app/oracle/oradata/testdb/users01.dbf',
'/app/oracle/oradata/testdb/example01.dbf'
CHARACTER SET KO16MSWIN949
;
[oracle@chan ~]$ exit
exit
SYS> @/home/oracle/re.sql
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Control file created.
SYS> alter database open;
Database altered.
SYS> select name from v$controlfile;
NAME
--------------------------------------
/home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
/home/oracle/disk6/control03.ctl
- 해결 방안 [2]: 현재 data file, redo log file 에 이상이 있고, data backup 이 있을 경우 (using backup control 로 복구)
-- 현재 상태를 전체 백업 수행
SYS> select name from v$datafile;
NAME
---------------------------------------------
/app/oracle/oradata/testdb/system01.dbf
/app/oracle/oradata/testdb/sysaux01.dbf
/app/oracle/oradata/testdb/undotbs01.dbf
/app/oracle/oradata/testdb/users01.dbf
/app/oracle/oradata/testdb/example01.dbf
SYS> select name from v$controlfile;
NAME
---------------------------------------------
/home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
/home/oracle/disk6/control03.ctl
SYS> select member from v$logfile;
MEMBER
---------------------------------------------
/app/oracle/oradata/testdb/redo03.log
/app/oracle/oradata/testdb/redo02.log
/app/oracle/oradata/testdb/redo01.log
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !
-- 미리 만들어 둔 /data/backup/close 폴더에 위의 파일들을 복사한다.
[oracle@chan ~]$ cp /app/oracle/oradata/testdb/*.dbf /data/backup/close/
[oracle@chan ~]$ cp /app/oracle/oradata/testdb/*.log /data/backup/close/
[oracle@chan ~]$ cp /home/oracle/disk4/*.ctl /data/backup/close/
[oracle@chan ~]$ cp /home/oracle/disk5/*.ctl /data/backup/close/
[oracle@chan ~]$ cp /home/oracle/disk6/*.ctl /data/backup/close/
-- 위의 장애 상황 만들기 를 참고해서 다시 장애 상황을 만든다.
[oracle@chan ~]$ vi $ORACLE_HOME/dbs/inittestdb.ora
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl' ##,'/home/oracle/disk6/control03.ctl'
[oracle@chan ~]$ exit
exit
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Database mounted.
Database opened.
SYS>
SYS> alter system checkpoint;
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> /
System altered.
SYS> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !
[oracle@chan ~]$ vi $ORACLE_HOME/dbs/inittestdb.ora
*.control_files='/home/oracle/disk4/control01.ctl','/home/oracle/disk5/control02.ctl' ,'/home/oracle/disk6/control03.ctl'
[oracle@chan ~]$ exit
exit
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
ORA-00214: control file '/home/oracle/disk4/control01.ctl' version 939
inconsistent with file '/home/oracle/disk6/control03.ctl' version 922
SYS> !cp /home/oracle/disk6/control03.ctl /home/oracle/disk4/control01.ctl
SYS> !cp /home/oracle/disk4/control01.ctl /home/oracle/disk5/control02.ctl
SYS> alter database mount;
Database altered.
SYS> alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 1 failed verification check
ORA-01110: data file 1: '/app/oracle/oradata/testdb/system01.dbf'
ORA-01207: file is more recent than control file - old control file
-- 다시 old control file 장애가 발생했다. 이제 백업 데이터를 가지고 복구해 보자.
SYS> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !cp /data/backup/close/*.dbf /app/oracle/oradata/testdb/ -- 데이터 파일만 복원
SYS> startup mount
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Database mounted.
SYS>
SYS> recover database until cancel using backup controlfile;
ORA-00279: change 866181 generated at 08/20/2013 00:39:18 needed for thread 1
ORA-00289: suggestion :
/app/oracle/fast_recovery_area/TESTDB/archivelog/2013_08_22/o1_mf_1_7_%u_.arc
ORA-00280: change 866181 for thread 1 is in sequence #7
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log
'/app/oracle/fast_recovery_area/TESTDB/archivelog/2013_08_22/o1_mf_1_7_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/app/oracle/fast_recovery_area/TESTDB/archivelog/2013_08_22/o1_mf_1_7_%u_.arc'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SYS> alter database open resetlogs;
Database altered.
SYS> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/home/oracle/disk4/control01.ctl
/home/oracle/disk5/control02.ctl
/home/oracle/disk6/control03.ctl
SYS> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/app/oracle/oradata/testdb/system01.dbf
/app/oracle/oradata/testdb/sysaux01.dbf
/app/oracle/oradata/testdb/undotbs01.dbf
/app/oracle/oradata/testdb/users01.dbf
/app/oracle/oradata/testdb/example01.dbf
SYS> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/app/oracle/oradata/testdb/redo03.log
/app/oracle/oradata/testdb/redo02.log
/app/oracle/oradata/testdb/redo01.log
- 해결 방안 [3]: 현재 data file, redo log file에 이상이 있고 백업 파일이 없을 경우 (control file 재생성 + resetlogs)
- 사용중이다가 비정상 종료된 경우 checkpoint 가 다른 data file 을 사용해서 긴급 복구 하는 경우를 살펴보자
-- 현재 상태 확인
SYS> @data
Connected.
TABLESPACE MB FILE_NAME
---------- ----- --------------------------------------------------
EXAMPLE 346 /app/oracle/oradata/testdb/example01.dbf
USERS 5 /app/oracle/oradata/testdb/users01.dbf
UNDOTBS1 90 /app/oracle/oradata/testdb/undotbs01.dbf
SYSAUX 510 /app/oracle/oradata/testdb/sysaux01.dbf
SYSTEM 700 /app/oracle/oradata/testdb/system01.dbf
SYS> @log
GROUP# MEMBER MB SEQ# STATUS ARC FIRST_CHANGE#
------ --------------------------------------------- ----- ---- -------- ----- -------------
1 /app/oracle/oradata/testdb/redo01.log 50 4 CURRENT NO 866631
2 /app/oracle/oradata/testdb/redo02.log 50 2 INACTIVE NO 866625
3 /app/oracle/oradata/testdb/redo03.log 50 3 INACTIVE NO 866628
-- 장애 상황 만들기
SYS> create table scott.test01 (no number);
Table created.
SYS> insert into scott.test01 values (1);
1 row created.
SYS> insert into scott.test01 values (2);
1 row created.
SYS> commit;
Commit complete.
SYS> shutdown abort;
ORACLE instance shut down.
SYS>
SYS> !rm -f /app/oracle/oradata/testdb/*.log
SYS> !rm -f /home/oracle/disk4/*.ctl
SYS> !rm -f /home/oracle/disk5/*.ctl
SYS> !rm -f /home/oracle/disk6/*.ctl
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
ORA-00205: error in identifying control file, check alert log for more info
-- 위의 [2] 번 case 에서 백업해 둔 (오래된) control file 복원
SYS> !cp /data/backup/close/control01.ctl /home/oracle/disk4/.
SYS> !cp /data/backup/close/control02.ctl /home/oracle/disk5/.
SYS> !cp /data/backup/close/control03.ctl /home/oracle/disk6/.
SYS> startup
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Database mounted.
ORA-01190: control file or data file 1 is from before the last RESETLOGS
ORA-01110: data file 1: '/app/oracle/oradata/testdb/system01.dbf' -- 장애 발생
-- control file 재생성 script. (resetlogs)
SYS> alter database backup controlfile to trace as '/home/oracle/re2.sql';
Database altered.
SYS> shutdown abort;
ORACLE instance shut down.
SYS> !vi /home/oracle/re2.sql
-- 아래 부분만 남기자
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/app/oracle/oradata/testdb/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/app/oracle/oradata/testdb/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/app/oracle/oradata/testdb/redo03.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/app/oracle/oradata/testdb/system01.dbf',
'/app/oracle/oradata/testdb/sysaux01.dbf',
'/app/oracle/oradata/testdb/undotbs01.dbf',
'/app/oracle/oradata/testdb/users01.dbf',
'/app/oracle/oradata/testdb/example01.dbf'
CHARACTER SET KO16MSWIN949
;
SYS> @/home/oracle/re2.sql
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Control file created.
SYS> 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/testdb/system01.dbf'
-- 위와 같은 경우의 에러는, DB가 종료 될 때 shutdown abort 로 비정상 종료되어
-- 데이터 파일끼리 checkpoint 정보가 동기화되지 않아서 resetlogs 로 open 할 수 없으니
-- 복구하라는 내용이다. 하지만 현재 모든 redo log 역시 삭제되어 복구할 수 없다.
-- 이럴 경우 강제로 data file 끼리 checkpoint 정보를 동기화시켜서 open 시키는
-- hidden parameter 를 사용해야 한다. 단, 이 parameter 는 위험하기 때문에 실무에선
-- 권장하지 않는다.
SYS> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SYS>
SYS> !vi $ORACLE_HOME/dbs/inittestdb.ora
-- 아래 부분 추가 후 저장
_allow_resetlogs_corruption=true
SYS> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1344616 bytes
Variable Size 260049816 bytes
Database Buffers 155189248 bytes
Redo Buffers 6086656 bytes
Database mounted.
SYS>
SYS> alter database open resetlogs;
Database altered.
SYS> select * from scott.test01;
select * from scott.test01
*
ERROR at line 1:
ORA-00942: table or view does not exist
-- DB 는 open 되었지만, 데이터는 복구되지 못했다.
2. Control file 를 재생성 해야 하는 대표적인 경우
1) control file 이 전부 사라졌을 경우
2) old control file 에러 발생 시
3) DB Name 을 변경하고 싶을 때
4) 최대 데이터 파일 갯수와 redo log 파일 갯수를 변경하고 싶을 때