프린트 하기

 

OS환경 : Oracle Linux 6.8 (64bit)

 

DB 환경 : Oracle Database 11.2.0.4

 

방법 : 최악의 복구 시나리오에 대한 해결방법(SCN이 모두 틀림)

SCN이 틀렸을 경우에 복구하는 방법

 

정말 위급한 복구 상황에 닥쳤을 경우에 유용함

일반적인 복구의 개념이 아니라..

어거지로 어떻게든 복구해서 올려야 하는 상황에 사용해야함

꼭 정말 위험한 상황에서 사용해야지

일반적인 복구 상황에서 사용하시면 안됨

 

아래에서.. 복구 작업이 끝난이후

데이터 export후 DB재생성후 import 하는 것이 권장됨

그리고 tempfile 도 꼭 추가해야함

undo도 깨뜨리고 하니 새로 생성해야함

 

 

최악의 복구시나리오시에.. 그래도 해야 할 것은.. system tablespace는 무조건 백업해두어야함

system tablespace가 깨지면 'dul' 유틸을 통해서 블록을 읽으는 복구도 불가능하다고함

system tablespace의 bootstrap이 깨지면 너무 오래된 백업이라면 object를 생성한 dictionary 정보가 없으니 당연히 못씀

 

 

아래에서도 마지막에 만든 k4 라는 테이블은 데이터는 있는데

system datafile을 먼저 cp 백업한뒤 테이블만든 경우

테이블은 dictionary 정보에 없는 일이 발생할 수도 있음

 

 

히든 파라미터 설명

_corrupted_rollback_segments=true

데이터베이스의 open시 Active한 rollback segment를 통해 Rolling Backward 과정을 수행하게 되는데 이 Rolling Backward 과정을 진행하지 않게함 또한 active한 rollback segment와 undo tablespace를 삭제할 수 있도록 해줌

 

_offline_rollback_segments 

강제로 rollback segment를 offline 시킴(_corrupted~, _offline) 파라미터는 같이 사용함

 

_allow_resetlogs_corruption=true

redo log 의 한계범위 내에서 데이터파일의 SCN이 틀어져 있거나 또는 recover시에 archive를 찾지 못해서 fail났을 경우, 즉 current redo log를 통해서 복구가 불가능할 경우, 억지로 current redo log를 reset log 시키고 open하는 파라미터

 

 

ORA- 10501 event를 통해서 adjust scn은 아래와 같은 레벨이 깨졌을 경우 레벨을 올려가면서 복구하는 방법

1
2
3
4
5
6
7
8
9
1050100000"periodically check selected heap"
// *Cause:
// *Action:
// Level: 0x01 PGA
// 0x02 SGA
// 0x04 UGA
// 0x08 current call
// 0x10 user call
// 0x20 large allocation pool

 

 

시나리오

*복구 작업 시 datafile 이 깨질 수 있으니 꼭 백업 해놓고 복구 작업을 진행 해야함

테스트용 sql 파일 생성

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ vi kkk.sql
create table k1 tablespace users as select * from dba_segments;
insert into k1 select * from k1;
commit;
create table k2 tablespace users as select * from dba_objects;
insert into k2 select * from k2;
insert into k1 select * from k1;
commit;
create table k3 tablespace users as select * from dba_extents;
insert into k3 select * from k3;
commit;
 
$ vi kkk2.sql
insert into k1 select * from k1;
insert into k2 select * from k2;
insert into k3 select * from k3;
commit;

 

 

데이터파일 백업용 경로 생성

1
2
$ cd /oracle/app/oracle/oradata/ORCL11
$ mkdir -p ../bak

 

 

트랜잭션이 있는 상태에서 cp로 백업(동시에)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
세션1
SQL> @kkk
@kkk2
@kkk2
@kkk2
@kkk2
@kkk2
@kkk2
@kkk2
 
세션2
SQL> !cp -av /oracle/app/oracle/oradata/ORCL11/*.dbf /oracle/app/oracle/oradata/bak/
SQL> alter database backup controlfile to '/oracle/app/oracle/oradata/bak/control01.ctl';
SQL> !cp -av /oracle/app/oracle/oradata/bak/control01.ctl /oracle/app/oracle/oradata/bak/control02.ctl;
 
SQL> create table k4 tablespace users as select * from dba_extents;

 

 

추후 사용할 undo segment 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
SQL>
select segment_name, initial_extent, next_extent, max_extents, rssize, extents, xacts
from dba_rollback_segs a, v$rollstat b
where a.segment_id = b.usn;
 
SEGMENT_NAME               INITIAL_EXTENT NEXT_EXTENT MAX_EXTENTS      RSSIZE    EXTENTS     XACTS
------------------------------ -------------- ----------- ----------- ---------- ---------- ----------
SYSTEM                       114688        57344    32765      385024      6         0
_SYSSMU1_3054177303$               131072        65536    32765     9560064     11         0
_SYSSMU2_843045112$               131072        65536    32765     8511488     10         0
_SYSSMU3_909977529$               131072        65536    32765     9560064     11         0
_SYSSMU4_1351237644$               131072        65536    32765     5365760      7         0
_SYSSMU5_1648443204$               131072        65536    32765     6414336      8         0
_SYSSMU6_431751772$               131072        65536    32765    13819904     16         0
_SYSSMU7_2719377503$               131072        65536    32765     9560064     11         0
_SYSSMU8_3554541062$               131072        65536    32765     9560064     11         0
_SYSSMU9_3485266800$               131072        65536    32765     8511488     10         0
_SYSSMU10_3518116208$               131072        65536    32765    12705792     14         0
 
11 rows selected.

 

 

장애 발생

archive도 없는 상태로 가정하기 위해 아카이브 경로 변경

1
2
3
4
5
6
7
8
9
10
SQL> archive log list
Database log mode           Archive Mode
Automatic archival           Enabled
Archive destination           /oracle/app/oracle/arch
Oldest online log sequence     4
Next log sequence to archive   6
Current log sequence           6
 
$ cd /oracle/app/oracle/
$ mv arch archbak

 

 

cp로 백업한 것을 restore함(datafile, controlfile만 존재, redo log는 없음)

1
2
3
$ cd /oracle/app/oracle/oradata
$ mv ORCL11/ ORCL11old
$ mv bak/ ORCL11

 

 

abort 후 startup

1
2
3
4
5
6
7
8
9
10
11
12
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
 
Total System Global Area 2137886720 bytes
Fixed Size            2254952 bytes
Variable Size         1476396952 bytes
Database Buffers      654311424 bytes
Redo Buffers            4923392 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

db 가 제대로 기동되지 않음

 

 

복구 시도

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
SQL> recover database using backup controlfile;
ORA-00279change 970150 generated at 01/27/2021 19:55:26 needed for thread 1
ORA-00289: suggestion : /oracle/app/oracle/arch1_20_1061688887.arc
ORA-00280change 970150 for thread 1 is in sequence #20
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto <-- [auto 입력]
ORA-00308: cannot open archived log '/oracle/app/oracle/arch1_20_1061688887.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
 
 
ORA-00308: cannot open archived log '/oracle/app/oracle/arch1_20_1061688887.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

아카이브로그를 찾을수 없어 복구되지않음

 

 

recover until cancel 로 시도

1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> recover database using backup controlfile until cancel;
ORA-00279change 970150 generated at 01/27/2021 19:55:26 needed for thread 1
ORA-00289: suggestion : /oracle/app/oracle/arch1_20_1061688887.arc
ORA-00280change 970150 for thread 1 is in sequence #20
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
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'/oracle/app/oracle/oradata/ORCL11/system01.dbf'
 
 
ORA-01112: media recovery not started

cancel도 안됨

 

 

open 시도

1
2
3
4
5
6
7
8
9
10
11
12
13
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
 
 
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'/oracle/app/oracle/oradata/ORCL11/system01.dbf'

일반 open, resetlogs open 둘다 실패함

 

 

해결방법 : 히든파라미터 적용

파라미터 파일 확인

1
2
3
4
5
SQL> show parameter spfile
 
NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
spfile                     string     /oracle/app/oracle/product/11.2.0/db_1/dbs/spfileORCL11.ora

현재 spfile 사용중

 

 

spfile 로 pfile 생성

1
2
3
SQL> create pfile from spfile;
 
File created.

 

 

spfile 이름 변경 후 pfile 수정(히든 파라미터 추가)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ cd $ORACLE_HOME/dbs
$ mv spfileORCL11.ora spfileORCL11.orabak
$ vi initORCL11.ora
*.audit_file_dest='/oracle/app/oracle/admin/ORCL11/adump'
*.audit_trail='OS'
*.compatible='11.2.0.4.0'
*.control_files='/oracle/app/oracle/oradata/ORCL11/control01.ctl','/oracle/app/oracle/oradata/ORCL11/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ORCL11'
*.db_securefile='IGNORE'
*.diagnostic_dest='/oracle/app/oracle'
*.local_listener=''
*.log_archive_dest=''
*.log_archive_dest_1='location=/oracle/app/oracle/arch'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.processes=500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=772
*.sga_max_size=2147483648
*.sga_target=1572864000
*.shared_pool_size=838860800
*.undo_tablespace='UNDOTBS1'
_allow_resetlogs_corruption=true
_corrupted_rollback_segments=true
_offline_rollback_segments=(_SYSSMU1_3054177303$,_SYSSMU2_843045112$,_SYSSMU3_909977529$,_SYSSMU4_1351237644$,_SYSSMU5_1648443204$,_SYSSMU6_431751772$,_SYSSMU7_2719377503$,_SYSSMU8_3554541062$,_SYSSMU9_3485266800$,_SYSSMU10_3518116208$)25~26번째 줄 내용 추가 후 저장

27번 째 줄에는 위에서 확인한 사용중인 undo segment 명을 넣어주면 됨

27번 째 줄 내용은 이번 테스트에서 안넣어도 복구 가능함을 확인함

(undo 사용량이 적어서 그런듯함)

 

 

*위 상황과는 다르게 이미 db가 내려간 경우 _offine_rollback_segments 에 넣을 undo segment 값 조회

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ cd {ORADATA경로}
$ strings system01.dbf | grep _SYSSMU | cut -d $ -1 | sort -u
22;HW5"G _SYSSMU1
22;HW5"G    _SYSSMU1
22;HW5"G    _SYSSMU2
22;HW5"G    _SYSSMU4
22;HW5"G    _SYSSMU5
22;HW5"G    _SYSSMU6
22;HW5"G    _SYSSMU7
22;HW5"G    _SYSSMU8
22;HW5"G    _SYSSMU9
    <9    ' and substr(drs.segment_name,1,7) != ''_SYSSMU''');
 and substr(drs.segment_name,1,7) != '_SYSSMU'
 and substr(drs.segment_name,1,7) != '_SYSSMU' 
    c;    ' and substr(drs.segment_name,1,7) != ''_SYSSMU'' ' ||
`Go_SYSSMU1
_SYSSMU10
_SYSSMU10_87671480
_SYSSMU1_3203565367
_SYSSMU2_691413377
_SYSSMU3|
_SYSSMU3_2268358915
_SYSSMU3l
_SYSSMU4_1937437311
_SYSSMU5_2591249612
_SYSSMU6_1535330677
_SYSSMU7_3330678596
_SYSSMU8_4231435866
_SYSSMU9_3486775302

 

 

컨트롤파일 트레이스 백업(컨트롤파일 구문 수정을 위해 백업용으로 2개 생성)

1
2
3
4
5
6
SQL> alter database backup controlfile to trace as '/home/oracle/recon.sql';
 
Database altered.
 
SQL> !cp -av /home/oracle/recon.sql /home/oracle/recon.sqlbak
`/home/oracle/recon.sql' -> `/home/oracle/recon.sqlbak'

 

 

컨트롤파일 생성구문 수정(REUSE, RESETLOGS, NOARCHIVELOG)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ vi /home/oracle/recon.sql
CREATE CONTROLFILE REUSE DATABASE "ORCL11" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 '/oracle/app/oracle/oradata/ORCL11/redo01.log'  SIZE 200M BLOCKSIZE 512,
  GROUP 2 '/oracle/app/oracle/oradata/ORCL11/redo02.log'  SIZE 200M BLOCKSIZE 512,
  GROUP 3 '/oracle/app/oracle/oradata/ORCL11/redo03.log'  SIZE 200M BLOCKSIZE 512
DATAFILE
  '/oracle/app/oracle/oradata/ORCL11/system01.dbf',
  '/oracle/app/oracle/oradata/ORCL11/sysaux01.dbf',
  '/oracle/app/oracle/oradata/ORCL11/undotbs01.dbf',
  '/oracle/app/oracle/oradata/ORCL11/users01.dbf'
CHARACTER SET KO16MSWIN949
;

 

 

db 종료 후 nomount 로 startup

1
2
3
4
5
6
7
8
9
10
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
 
Total System Global Area 2137886720 bytes
Fixed Size            2254952 bytes
Variable Size         1442842520 bytes
Database Buffers      687865856 bytes
Redo Buffers            4923392 bytes

 

 

컨트롤파일 재생성

1
2
3
SQL> @/home/oracle/recon.sql
 
Control file created.

 

 

recover until cancel 시도
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> recover database using backup controlfile until cancel;
ORA-00279change 970150 generated at 01/27/2021 19:55:26 needed for thread 1
ORA-00289: suggestion : /oracle/app/oracle/arch1_20_1061688887.arc
ORA-00280change 970150 for thread 1 is in sequence #20
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
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'/oracle/app/oracle/oradata/ORCL11/system01.dbf'
 
 
ORA-01112: media recovery not started

실패함

 

 

resetlogs로 open 시도

1
2
3
SQL> alter database open resetlogs;
 
Database altered.

정상적으로 open 됨

 

 

resetlogs 시점 alert log

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
$ cd /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace
$ tail -f alert_ORCL11.log
Thu Jan 28 01:17:37 2021
alter database open resetlogs
RESETLOGS is being done without consistancy checks. This may result
in a corrupted database. The database should be recreated.
RESETLOGS after incomplete recovery UNTIL CHANGE 970150
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1'/oracle/app/oracle/oradata/ORCL11/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 1 /oracle/app/oracle/oradata/ORCL11/redo01.log
Clearing online log 1 of thread 1 sequence number 0
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1'/oracle/app/oracle/oradata/ORCL11/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1'/oracle/app/oracle/oradata/ORCL11/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 1 complete
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1'/oracle/app/oracle/oradata/ORCL11/redo02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 2 /oracle/app/oracle/oradata/ORCL11/redo02.log
Clearing online log 2 of thread 1 sequence number 0
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1'/oracle/app/oracle/oradata/ORCL11/redo02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1'/oracle/app/oracle/oradata/ORCL11/redo02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 2 complete
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1'/oracle/app/oracle/oradata/ORCL11/redo03.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 3 /oracle/app/oracle/oradata/ORCL11/redo03.log
Clearing online log 3 of thread 1 sequence number 0
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1'/oracle/app/oracle/oradata/ORCL11/redo03.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_ora_26854.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1'/oracle/app/oracle/oradata/ORCL11/redo03.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Clearing online redo logfile 3 complete
Online log /oracle/app/oracle/oradata/ORCL11/redo01.log: Thread 1 Group 1 was previously cleared
Online log /oracle/app/oracle/oradata/ORCL11/redo02.log: Thread 1 Group 2 was previously cleared
Online log /oracle/app/oracle/oradata/ORCL11/redo03.log: Thread 1 Group 3 was previously cleared
Thu Jan 28 01:17:39 2021
Setting recovery target incarnation to 2
Initializing SCN for created control file
Database SCN compatibility initialized to 3
Warning - High Database SCN: Current SCN value is 970153, threshold SCN value is 0
If you have not previously reported this warning on this database, please notify Oracle Support so that additional diagnosis can be performed.
Thu Jan 28 01:17:39 2021
Assigning activation ID 14758882 (0xe133e2)
Thread 1 opened at log sequence 1
  Current log# 1 seq# 1 mem# 0/oracle/app/oracle/oradata/ORCL11/redo01.log
Successful open of redo thread 1
MTTR advisory is disabled because FAST_START_MTTR_TARGET is not set
Thu Jan 28 01:17:39 2021
SMON: enabling cache recovery
[26854] Successfully onlined Undo Tablespace 2.
Undo initialization finished serial:0 start:1639418780 end:1639418830 diff:50 (0 seconds)
Dictionary check beginning
Tablespace 'TEMP' #3 found in data dictionary,
but not in the controlfile. Adding to controlfile.
Dictionary check complete
Verifying file header compatibility for 11g tablespace encryption..
Verifying 11g file header compatibility for tablespace encryption completed
SMON: enabling tx recovery
*********************************************************************
WARNING: The following temporary tablespaces contain no files.
         This condition can occur when a backup controlfile has
         been restored.  It may be necessary to add files to these
         tablespaces.  That can be done using the SQL statement:
 
         ALTER TABLESPACE <tablespace_name> ADD TEMPFILE
 
         Alternatively, if these temporary tablespaces are no longer
         needed, then they can be dropped.
           Empty temporary tablespace: TEMP
*********************************************************************
Database Characterset is KO16MSWIN949
No Resource Manager plan active
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
Thu Jan 28 01:17:40 2021
QMNC started with pid=18, OS id=26866 
LOGSTDBY: Validating controlfile with logical metadata
LOGSTDBY: Validation complete
Completed: alter database open resetlogs
Thu Jan 28 01:17:40 2021
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_m000_26868.trc  (incident=535358):
ORA-00600: internal error code, arguments: [2662], [0], [970334], [0], [974260], [16777218], [], [], [], [], [], []
Incident details in: /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/incident/incdir_535358/ORCL11_m000_26868_i535358.trc
Thu Jan 28 01:17:40 2021
Errors in file /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/trace/ORCL11_m002_26872.trc  (incident=535374):
ORA-00600: internal error code, arguments: [2662], [0], [970334], [0], [974260], [16777218], [], [], [], [], [], []
Incident details in: /oracle/app/oracle/diag/rdbms/orcl11/ORCL11/incident/incdir_535374/ORCL11_m002_26872_i535374.trc

4번 째 줄에서 resetlogs 명령 입력

8~68번 째 줄까지 redo log 를 찾다가 실패함

70~73번 째 줄에서 redo 3개 생성

74~79번 째 줄에서 scn 동기화

82번 째 줄에서 로그스위치

87번 째 줄에서 cache recovery 

91~108번 째 줄에서 temp 없으니 생성하라는 메세지

117번 째 줄에서 resetlogs 로 open 완료

118~125번 째 줄에서 ORA-600 발생

 

 

*처음부터 히든파라미터 2개를 같이 사용하는것을 권장함

아래 히든 파라미터를 빼고 작업 시 추후 파라미터를 다시 추가해도 복구가 불가능함

pfile에 아래 파라미터를 넣지 않을 경우 resetlogs open 시 아래와 같은 메세지 발생함

_corrupted_rollback_segments=true

1
2
3
4
5
6
7
8
9
10
11
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [2662], [0], [997000], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [2662], [0], [996999], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [996997], [0], [1001165], [12583040], [], [], [], [], [], []
Process ID: 27596
Session ID: 16 Serial number: 1

ORA-00600 메세지와 함께 db가 강제 종료됨

 

 

히든파라미터를 1개만 쓰거나 위 방법으로 open 되지 않을 경우

DB재기동 및 controlfile , redo를 모두 삭제, controlfile 재생성

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SQL> startup nomount
ORACLE instance started.
 
Total System Global Area 2137886720 bytes
Fixed Size            2254952 bytes
Variable Size         1442842520 bytes
Database Buffers      687865856 bytes
Redo Buffers            4923392 bytes
 
$ cd /oracle/app/oracle/oradata/ORCL11
$ rm -rf *.ctl
$ rm -rf *.log
 
SQL> @/home/oracle/recon.sql
 
Control file created.

 

 

adjust_scn 1로 변경

1
2
3
SQL> alter session set events '10015 trace name adjust_scn level 1';
 
Session altered.

 

 

recover until cancel 시도

1
2
3
4
5
6
7
8
9
10
11
12
13
SQL> recover database using backup controlfile until cancel;
ORA-00279change 970150 generated at 01/27/2021 19:55:26 needed for thread 1
ORA-00289: suggestion : /oracle/app/oracle/arch1_20_1061688887.arc
ORA-00280change 970150 for thread 1 is in sequence #20
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
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'/oracle/app/oracle/oradata/ORCL11/system01.dbf'
 
ORA-01112: media recovery not started

실패함

 

 

resetlogs open 시도

1
2
3
4
5
6
7
8
9
10
11
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [2662], [0], [997004], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [2662], [0], [997003], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [997001], [0], [1001165], [12583040], [], [], [], [], [], []
Process ID: 27661
Session ID: 18 Serial number: 11

실패함

 

 

adjust_scn level을 늘려가면서 재시도

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
 
Total System Global Area 2137886720 bytes
Fixed Size            2254952 bytes
Variable Size         1442842520 bytes
Database Buffers      687865856 bytes
Redo Buffers            4923392 bytes
Database mounted.
 
SQL> alter session set events '10015 trace name adjust_scn level 2';
 
Session altered.

 

 

resetlogs open 시도

1
2
3
4
5
6
7
8
9
10
11
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [2662], [0], [997004], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [2662], [0], [997003], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [997001], [0], [1001165], [12583040], [], [], [], [], [], []
Process ID: 27661
Session ID: 18 Serial number: 11

adjust_scn level 3 까지 올려봤지만 안됨

 

 

pfile에 빼먹은 파라미터 다시 삽입 후

DB재기동 및 controlfile , redo를 모두 삭제, controlfile 재생성

_corrupted_rollback_segments=true

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SQL> startup nomount
ORACLE instance started.
 
Total System Global Area 2137886720 bytes
Fixed Size            2254952 bytes
Variable Size         1442842520 bytes
Database Buffers      687865856 bytes
Redo Buffers            4923392 bytes
 
$ cd /oracle/app/oracle/oradata/ORCL11
$ rm -rf *.ctl
$ rm -rf *.log
 
SQL> @/home/oracle/recon.sql
 
Control file created.

 

 

recover until cancel 시도
1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> recover database using backup controlfile until cancel;
ORA-00279change 997010 generated at 01/28/2021 0@:38:46 needed for thread 1
ORA-00289: suggestion : /oracle/app/oracle/arch1_1_1062988725.arc
ORA-00280change 997010 for thread 1 is in sequence #20
 
 
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
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'/oracle/app/oracle/oradata/ORCL11/system01.dbf'
 
 
ORA-01112: media recovery not started

실패함

 

 

resetlogs로 open 시도

1
2
3
4
5
6
7
8
9
10
11
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-00603: ORACLE server session terminated by fatal error
ORA-00600: internal error code, arguments: [2662], [0], [997004], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [2662], [0], [997003], [0], [1001165], [12583040], [], [], [], [], [], []
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [2662], [0], [997001], [0], [1001165], [12583040], [], [], [], [], [], []
Process ID: 27661
Session ID: 18 Serial number: 11

실패함

기존에 히든 파라미터 2개 사용시 성공했었지만

히든 파라미터 1개만 넣은 뒤 추후에 나머지 1개를 넣은 경우에는

계속 open 되지 못함

이미 데이터파일에 손상을 입은듯함

데이터파일 복구 시도 전 따로 백업을 해두거나 처음부터 히든파라미터 2개를 같이 사용하는것을 권장함

 

 

open 후 작업

temp tablespace 생성

recon.sqlbak 파일 확인 후 temp 생성 구문 카피 후 db에 실행

1
2
3
4
5
$ vi recon.sqlbak
SQL> ALTER TABLESPACE TEMP ADD TEMPFILE '/oracle/app/oracle/oradata/ORCL11/temp01.dbf'
SIZE 2048M REUSE AUTOEXTEND OFF;
 
Tablespace altered.

 

 

pfile 에서 히든 파라미터 제거

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$ cd $ORACLE_HOME/dbs
$ vi initORCL11.ora
*.audit_file_dest='/oracle/app/oracle/admin/ORCL11/adump'
*.audit_trail='OS'
*.compatible='11.2.0.4.0'
*.control_files='/oracle/app/oracle/oradata/ORCL11/control01.ctl','/oracle/app/oracle/oradata/ORCL11/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ORCL11'
*.db_securefile='IGNORE'
*.diagnostic_dest='/oracle/app/oracle'
*.local_listener=''
*.log_archive_dest=''
*.log_archive_dest_1='location=/oracle/app/oracle/arch'
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.processes=500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=772
*.sga_max_size=2147483648
*.sga_target=1572864000
*.shared_pool_size=838860800
*.undo_tablespace='UNDOTBS1'

히든 파라미터가 제거됨

 

pfile 이용해 spfile 생성

1
2
3
SQL> create spfile from pfile;
 
File created.

 

 

정상적으로 재기동 되는지 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
 
Total System Global Area 2137886720 bytes
Fixed Size            2254952 bytes
Variable Size         1442842520 bytes
Database Buffers      687865856 bytes
Redo Buffers            4923392 bytes
Database mounted.
Database opened.

 

 

datapump 로 db 전체 백업

오라클 11g R2 datapump db full 백업 https://positivemh.tistory.com/698

 

 

db 삭제 후 재생성

1
$ dbca

 

 

dbca gui 에서 delete database 후 create database

오라클 설치 가이드 참조 https://positivemh.tistory.com/category/ORACLE/Install

 

 

참조 : 

 

최악의 복구 시나리오에 대한 해결방법(SCN이 모두 틀림)

 

http://databaser.net/moniwiki/wiki.php/최악의복구시나리오에대한해결방법

https://positivemh.tistory.com/223

 

'ORACLE > Backup&Recover' 카테고리의 다른 글

hot backup 복구 시나리오1  (0) 2018.12.17
Oracle 12c R2 Clone DB 생성 및 복구 시나리오  (3) 2018.09.20
Oracle Block change tracking 기능  (0) 2018.05.24
RMAN CrossCheck 명령  (0) 2018.02.21
rman 복구 시나리오1  (0) 2018.02.08