2014. 11. 5. 19:10

1개의 멤버가 삭제되는 장애 발생


SYS>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.

Database opened.


log.sql 파일 내용
SYS>!vi log.sql
set line 200
col group# for 999
col mb for 999
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"
FROM v$logfile a,v$log b
where a.group#=b.group#
order by 1,2
/



SYS>!vi log.sql


SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   57 CURRENT  NO

     1 /data/temp7/redo01_b.log                         5   57 CURRENT  NO

     2 /data/temp7/redo02_a.log                         5   56 INACTIVE YES

     2 /data/temp7/redo02_b.log                         5   56 INACTIVE YES


redo01_a.log 삭제
[oracle@localhost ~]$ rm -f /data/temp7/redo01_a.log
[oracle@localhost ~]$ ls -al /data/temp7/*.log
-rw-r----- 1 oracle oinstall 5243392 Nov  6 02:49 /data/temp7/redo01_b.log
-rw-r----- 1 oracle oinstall 5243392 Nov  6 02:46 /data/temp7/redo02_a.log
-rw-r----- 1 oracle oinstall 5243392 Nov  6 02:46 /data/temp7/redo02_b.log

[oracle@localhost ~]$ exit
exit

SYS>alter system switch logfile;

System altered.

SYS>/

System altered.

SYS>/

System altered.

SYS>/

System altered.

파일을 지웠지만 있다고 나옴
SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5   61 CURRENT  NO
     1 /data/temp7/redo01_b.log                         5   61 CURRENT  NO
     2 /data/temp7/redo02_a.log                         5   60 INACTIVE YES
     2 /data/temp7/redo02_b.log                         5   60 INACTIVE YES

정확한 장애내용은 alert log 파일을 열어 확인

SYS>!

[oracle@localhost ~]$ vi  $ORACLE_BASE/diag/rdbms/testdb/testdb/trace/alert_testdb.log
...생략

Errors in file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_arc1_7763.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: '/data/temp7/redo01_a.log'

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

...생략

장애가 확인 된 멤버는 삭제 후 다시 생성하면 됨
SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5   61 CURRENT  NO
     1 /data/temp7/redo01_b.log                         5   61 CURRENT  NO
     2 /data/temp7/redo02_a.log                         5   60 INACTIVE YES
     2 /data/temp7/redo02_b.log                         5   60 INACTIVE YES

SYS>alter system switch logfile;

System altered.

SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5   61 ACTIVE   YES
     1 /data/temp7/redo01_b.log                         5   61 ACTIVE   YES
     2 /data/temp7/redo02_a.log                         5   62 CURRENT  NO
     2 /data/temp7/redo02_b.log                         5   62 CURRENT  NO


SYS>alter database drop logfile member
  2  '/data/temp7/redo01_a.log';

Database altered.

SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_b.log                         5   61 ACTIVE   YES
     2 /data/temp7/redo02_a.log                         5   62 CURRENT  NO
     2 /data/temp7/redo02_b.log                         5   62 CURRENT  NO

SYS>alter database add logfile member

  2  '/data/temp7/redo01_a.log' to group 1;


Database altered.


SYS>@log


GROUP# MEMBER                                          MB SEQ# STATUS   ARC

------ --------------------------------------------- ---- ---- -------- -----

     1 /data/temp7/redo01_a.log                         5   61 INACTIVE YES

     1 /data/temp7/redo01_b.log                         5   61 INACTIVE YES

     2 /data/temp7/redo02_a.log                         5   62 CURRENT  NO

     2 /data/temp7/redo02_b.log                         5   62 CURRENT  NO





'DB > oralce' 카테고리의 다른 글

리두로그 장애3  (0) 2014.11.06
리두로그 장애2  (0) 2014.11.06
리두로그마이너 - 정리 덜됨...엉망임;;  (0) 2014.11.05
컨트롤 파일복구 3-1  (0) 2014.11.04
컨트롤 파일 복구 3  (0) 2014.11.04
Posted by 성장하는yw
2014. 11. 5. 11:54

 supplemental 기능의 활성화 여부 확인

SYS>select supplemental_log_data_min from v$database;

비활성화 상태

SUPPLEME

--------

NO


활성화상태로 변경


SYS>alter database add supplemental log data;


Database altered.


SYS>select supplemental_log_data_min from v$database;


SUPPLEME

--------

YES


활성화->비활성화로 변경


SYS>alter database drop supplemental log data;


Database altered.



SYS>select supplemental_log_data_min from v$database;


SUPPLEME

--------

NO


이 기능은 DB 전체를 대상으로 적용할 수 있고,혹은 특정테이블만 적용가능

특정테이블만 적용하기

SYS>alter table scott.emp add supplemental log data (all) columns;

Table altered.
 
이 기능을 사용할 경우 리두로그 생성양이 많아지므로 아카이브 로그 모드를 사용할 때는
아카이브 용량을 충분하게 주고 사용해야 함 

log miner 활용하기
- drop table 정보 찾기

SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5    3 CURRENT  NO
     1 /data/temp7/redo01_b.log                         5    3 CURRENT  NO
     2 /data/temp7/redo02_a.log                         5    2 INACTIVE YES
     2 /data/temp7/redo02_b.log                         5    2 INACTIVE YES

SYS>select supplemental_log_data_min from v$database;


SUPPLEME

--------

NO



SYS>alter database add supplemental log data;


Database altered.


활성화 상태에서 실습
SYS>select supplemental_log_data_min from v$database;

SUPPLEME
--------
YES

새로운 테이블 생성 후 데이터 입력, 삭제하기
SYS>create table scott.test1 (no number);

Table created.

SYS>insert into scott.test1 values(1);

1 row created.


SYS>commit;

Commit complete.

SYS>drop table scott.test1 purge;

Table dropped.

SYS>@log

GROUP# MEMBER                                          MB SEQ# STATUS   ARC
------ --------------------------------------------- ---- ---- -------- -----
     1 /data/temp7/redo01_a.log                         5    3 CURRENT  NO
     1 /data/temp7/redo01_b.log                         5    3 CURRENT  NO
     2 /data/temp7/redo02_a.log                         5    2 INACTIVE YES
     2 /data/temp7/redo02_b.log                         5    2 INACTIVE YES

테이블이 생성되고 데이터 입력, 삭제 된 내용이 1번 그룹에 들어가 있음을 current 로 확인할 수 있음

로그 딕셔너리 생성
방법
1 online  
2
3

db 종료 후 파라미터 파일의 딕셔너리 파일 경로 지정
SYS>shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

[oracle@localhost ~]$ mkdir /data/logminer
파일에 아래 내용 추가
[oracle@localhost ~]$ vi $ORACLE_HOME/dbs/inittestdb.ora
utl_file_dir=/data/logminer 

db시작

SYS>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.
Database opened.

딕셔너리 생성
SYS>exec dbms_logmnr_d.build(dictionary_filename=>'dict.dbt',-
> dictionary_location=>'/app/oracle/logminer');
log miner에 분석할 로그를 추가

딕셔너리 생성시 경로를 변경하고 싶으면 위와 같은 명령어를 그대로 치고, 
경로만 바꾸어 주면 됨
SYS>exec dbms_logmnr_d.build(dictionary_filename=>'dict.dat', dictionary_location=>'/data/logminer');
PL/SQL procedure successfully completed.



PL/SQL procedure successfully completed.


SYS>exec dbms_logmnr.add_logfile('/data/temp7/redo01_a.log',1); 

PL/SQL procedure successfully completed.

분석시 add_logfilelsl('분석할 리두 경로',숫자옵션)
1 신규생성
2 파일삭제
3 추가등록

2번 그룹에 로그파일을 추가로 등록함

SYS>exec dbms_logmnr.add_logfile('/data/temp7/redo01_a.log',1);

PL/SQL procedure successfully completed.

SYS>exec dbms_logmnr.add_logfile('/data/temp7/redo02_a.log',3);

PL/SQL procedure successfully completed.


등록한 리두로그마이너 삭제할 때

SYS>exec dbms_logmnr.add_logfile('/data/temp7/redo02_b.log',2);

PL/SQL procedure successfully completed.


그룹이 있으면 그 그룹 중에 멤버 하나만 등록하면 리두마이너가 등록이 된다.
한 그룹에 어차피 여러 멤버가 있어서 등록하려고 하면 복사본이라고 에러뜸
그룹당 하나만 리두로그마이너 등록할 수 있음
 
ERROR at line 1:
ORA-01289: cannot add duplicate logfile /data/temp7/redo01_b.log
ORA-06512: at "SYS.DBMS_LOGMNR", line 68
ORA-06512: at line 1


확인

SYS>set line 200
SYS>col db_name for a15
SYS>col filename for a50
SYS>select db_name, filename from v$logmnr_logs;

DB_NAME         FILENAME
--------------- --------------------------------------------------
TESTDB          /data/temp7/redo01_a.log
TESTDB          /data/temp7/redo02_a.log

*대량의 아카이브 리두 로그파일을 분석해야 할 경우 일일이 수동으로 등록하기에 시간이 오래 걸리므로
아래와 같이 스크립트를 생생해서 등록 작업 설정을 쉽게 할 수 있음
[oracle@localhost ~]$ vi ar.sh
for
for i in $(ls /data/arc2);
for i in $(ls 아카이브가 있는 현재경로);
 do echo "exec dbms_logmnr.add_logfile('아카이브 파일이 있는 현재경로/$i',3);" >> /home/oracle/arch.sql;
done;

wq!

[oracle@localhost ~]$ sh ar.sh
파일을 열어보면 명령어가 생성된 것을 확인 할 수 있음 
[oracle@localhost ~]$ vi /home/oracle/arch.sql
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_10_b5ldx374_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_1_b5lgngbh_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_29_b5l414vm_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_2_b5mxx2on_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_3_b5n7wdy1_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_6_b5l00zkp_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_7_b5l0373g_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_8_b5l03lhl_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_8_b5lboj3h_.arc',3);
exec dbms_logmnr.add_logfile('/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_9_b5lboo35_.arc',3);
~
~
~
"~/arch.sql" 10L, 1192C                                       1,1           All


주의!!! 테스트 환경을 만들때, 오라클 설치 파일경로인 /app/oracle 에 남은 용량이 많이 없어서 위와 같이 

작업을 하게 되면 나중에 리두로그마이너가 많이 생겨서 용량이 부족하다는 에러가 생길수도 있음. 

그래서 나는 아카이브 경로를 용량이 많은 다른 경로로 이동해 주겠다.

pfile을 사용하는 경우


[oracle@localhost ~]$ vi $ORACLE_HOME/dbs/inittestdb.ora


#아카이브 로그 파일 저장경로와 이름 지정

log_archive_dest_1='location=/data/arc1'

log_archive_dest_2='location=/data/arc2'

log_archive_format=%s_%t_%r.arc #아카이브 로그파일 이름지정#

:wq!

11g 환경에서 오라클은 기본으로 4G의 용량을 주고 아카이브 파일을 저장한다
하지만 내가 파일을 만들어서 주는 것은 내 마음대로 용량을 줄 수 있음
두 개의 파일은 다중화가 되서 아카이브 파일이 같이 들어감

확인방법

SYS>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.

Database opened.

SYS>alter system switch logfile;


System altered.


SYS>alter system switch logfile;


System altered.


[oracle@localhost arc1]$ ls

4_1_862809266.arc  5_1_862809266.arc

[oracle@localhost arc2]$ ls

4_1_862809266.arc  5_1_862809266.arc


위 파일의 명령을 실행시켜주면 됨

SYS>@/app/oracle/arch.sql 




[oracle@localhost ~]$ vi ar.sh

for i in $(ls /data/arc1);

 do echo "exec dbms_logmnr.add_logfile('/data/arc1/$i',3);" >> /home/oracle/arch.sql;

done;

wq!

[oracle@localhost ~]$ sh ar.sh

[oracle@localhost ~]$ vi /home/oracle/arch.sql

exec dbms_logmnr.add_logfile('/data/arc1/4_1_862809266.arc',3);

exec dbms_logmnr.add_logfile('/data/arc1/5_1_862809266.arc',3);


SYS>@/home/oracle/arch.sql

PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.

로그마이너를 시작해서 log를 분석한 후 결과 조회



---------------------

157


SYS>select supplemental_log_data_min from v$database;


SUPPLEME

--------

YES


SYS>create table scott.test2(no number, name varchar2(10));


Table created.


SYS>insert into scott.test2 values(1,'AAA');


1 row created.


SYS>insert into scott.test2 values(2,'BBB');


1 row created.


SYS>insert into scott.test2 values(3,'CCC');


1 row created.


SYS>commit;


Commit complete.


SYS>select * from scott.test2;


        NO NAME

---------- --------------------------------------------------

         1 AAA

         2 BBB

         3 CCC


SYS>update scott.test2 set name='DDD';


3 rows updated.


SYS>select * from scott.test2;


        NO NAME

---------- --------------------------------------------------

         1 DDD

         2 DDD

         3 DDD


SYS>commit;


Commit complete.


SYS>show parameter utl


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

create_stored_outlines               string

utl_file_dir                         string      /data/logminer

SYS>exec dbms_logmnr_d.build(dictionary_filename=>'/dict2.dat',dictionary_location=>'/data/logminer');


PL/SQL procedure successfully completed.




SYS>exec dbms_logmnr.start_logmnr(dictfilename=>'/data/logminer/dict2.dat');


PL/SQL procedure successfully completed.


SYS>col username for a10

SYS>col operation for a10

SYS>col sql_redo for a70

SYS>set pagesize 50

SYS>alter session set nls_date_format='yyyy-mm-dd:hh24:mi:ss';


Session altered.


SYS>select timestamp, username, operation, sql_redo

  2  from v$logmnr_contents

  3  where seg_name='TEST2';


TIMESTAMP           USERNAME   OPERATION  SQL_REDO

------------------- ---------- ---------- ----------------------------------------------------------------------

2014-11-06:02:19:14 SYS        DDL        create table scott.test2(no number, name varchar2(10));

2014-11-06:02:19:47 SYS        INSERT     insert into "SCOTT"."TEST2"("NO","NAME") values ('1','AAA');

2014-11-06:02:20:08 SYS        INSERT     insert into "SCOTT"."TEST2"("NO","NAME") values ('2','BBB');

2014-11-06:02:21:23 SYS        INSERT     insert into "SCOTT"."TEST2"("NO","NAME") values ('3','CCC');

2014-11-06:02:21:44 SYS        UPDATE     update "SCOTT"."TEST2" set "NAME" = 'DDD' where "NAME" = 'AAA' and ROW

                                          ID = 'AAASm+AAEAAAAMnAAA';


2014-11-06:02:21:44 SYS        UPDATE     update "SCOTT"."TEST2" set "NAME" = 'DDD' where "NAME" = 'BBB' and ROW

                                          ID = 'AAASm+AAEAAAAMnAAB';


2014-11-06:02:21:44 SYS        UPDATE     update "SCOTT"."TEST2" set "NAME" = 'DDD' where "NAME" = 'CCC' and ROW

                                          ID = 'AAASm+AAEAAAAMnAAC';



7 rows selected.



리두로그 마이너는 세션별로 볼 수 있다. 
세션창을 끄고 나오거나 셧다운 다른 창에서는 그 해당하는 리두로그 마이너의 결과를 볼 수 없다. 
심지어... 창을 끄고 다시 접속하면 로그파일도 다 등록해줘야함..;;


'DB > oralce' 카테고리의 다른 글

리두로그 장애2  (0) 2014.11.06
리두로그 장애1  (0) 2014.11.05
컨트롤 파일복구 3-1  (0) 2014.11.04
컨트롤 파일 복구 3  (0) 2014.11.04
컨트롤 파일복구 2  (0) 2014.11.04
Posted by 성장하는yw
2014. 11. 4. 20:42

redo log file까지 손상이 있을 경우 resetlogs 모드로 재생성

SYS>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-01122: database file 1 failed verification check

ORA-01110: data file 1: '/data/temp7/system01.dbf'

ORA-01207: file is more recent than control file - old control file



SYS>alter database backup controlfile to trace as '/app/oracle/back.sql';


Database altered.


SYS>shut immediate

ORA-01109: database not open



Database dismounted.

ORACLE instance shut down.

'DB > oralce' 카테고리의 다른 글

리두로그 장애1  (0) 2014.11.05
리두로그마이너 - 정리 덜됨...엉망임;;  (0) 2014.11.05
컨트롤 파일 복구 3  (0) 2014.11.04
컨트롤 파일복구 2  (0) 2014.11.04
컨트롤 파일 복구1  (0) 2014.11.04
Posted by 성장하는yw
2014. 11. 4. 19:01

정상적인 DB 에서 old control file error 에러 발생시키기


SYS>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.

Database opened.


SYS>alter system switch logfile;


System altered.


SYS>alter system checkpoint;


System altered.


SYS>shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS>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-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


에러의 원인

- 컨트롤 파일 정보가 저장된 시점이 데이터파일의 정보저장 시점보다 예전 내용이기 때문


문제 해결 방법

1. 백업 데이터파일과 아카이브 리두로그파일을 사용 using backup controlfile 옵션으로 recovery 하는 방법

2. 1의 방법이 되지 않으면 컨트롤파일을 재생성 해야 함

     - 현재 리두로그 파일에 손상이 없을 경우 : noresetlogs 모드로 재생성

     - 현재 리두고르 파일에 손상이 있을 경우 : resetlogs 모드로 재생성



나의 경우는 리두로그 파일에 손상이 없을 경우임


nomount 상태에서 컨트롤 파일을 재생성하는 명령어를 입력하면 됨, 

but 그 명령어가 너무 길어서 외우기가 힘듬

현재 운영 중인 서버에서 재생성용 스크립트를 만들어 생성하는 방법으로 실습할 예정임 


컨트롤 파일을 재생성하는 스크립트는 현재 올드 컨트롤 파일로부터 trace 해서 만들게 됨

이 방법은 현재 컨트롤 파일의 정보를 사용해서 재생성하는 것이므로 mount상태에서 수행해야 함


현재 상태 확인

SYS>select status from v$instance;


STATUS

------------

MOUNTED


컨트롤 파일 재생성 스크립트 만들기
SYS>alter database backup controlfile to trace as '/app/oracle/re11.sql';

Database altered.

SYS>shutdown immediate
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.

SYS>!
[oracle@localhost ~]$ vi /app/oracle/re11.sql
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="testdb"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE

--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
--     Set #1. NORESETLOGS case 
--  
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" NORESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/app/oracle/oradata/testdb/redo01_a.log',
    '/app/oracle/oradata/testdb/redo01_b.log'
  ) SIZE 5M BLOCKSIZE 512,
  GROUP 2 (
    '/app/oracle/oradata/testdb/redo02_a.log',
    '/app/oracle/oradata/testdb/redo02_b.log'
  ) SIZE 5M 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
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/app/oracle/oradata/testdb/temp01.dbf' REUSE;
-- End of tempfile additions.
--
--     Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.

-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
--  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "TESTDB" RESETLOGS  ARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 (
    '/app/oracle/oradata/testdb/redo01_a.log',
    '/app/oracle/oradata/testdb/redo01_b.log'
  ) SIZE 5M BLOCKSIZE 512,
  GROUP 2 (
    '/app/oracle/oradata/testdb/redo02_a.log',
    '/app/oracle/oradata/testdb/redo02_b.log'
  ) SIZE 5M 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
;

-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/app/oracle/fast_recovery_area/TESTDB/archivelog/2014_11_05/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE

-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;

-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/app/oracle/oradata/testdb/temp01.dbf' REUSE;
-- End of tempfile additions.
--

이 파일 사용 -- 부분은 주석이므로 모두 지우고, 
노리셋모드는 :set nu 해서 59-87줄만 남기고 다 지울 것.
리셋모드는 112-154줄 안에 주석은 삭제하기 

각 파일의 경로는 상황에 맞게 수정해서 스크립트를 돌림

각 경로의 정보는 컨트롤 파일에서 가져오는 정보임! 

[oracle@localhost ~]$ vi /app/oracle/re11.sql
  1 STARTUP NOMOUNT
  2 CREATE CONTROLFILE REUSE DATABASE "TESTDB" NORESETLOGS  ARCHIVELOG
  3     MAXLOGFILES 16
  4     MAXLOGMEMBERS 3
  5     MAXDATAFILES 100
  6     MAXINSTANCES 8
  7     MAXLOGHISTORY 292
  8 LOGFILE
  9   GROUP 1 (
 10     '/data/temp7/redo01_a.log',
 11     '/data/temp7/redo01_b.log'
 12   ) SIZE 5M BLOCKSIZE 512,
 13   GROUP 2 (
 14     '/data/temp7/redo02_a.log',
 15     '/data/temp7/redo02_b.log'
 16   ) SIZE 5M BLOCKSIZE 512
 17 -- STANDBY LOGFILE
 18 DATAFILE
 19   '/data/temp7/system01.dbf',
 20   '/data/temp7/sysaux01.dbf',
 21   '/data/temp7/undotbs01.dbf',
 22   '/data/temp7/users01.dbf',
 23   '/data/temp7/example01.dbf'
 24 CHARACTER SET KO16MSWIN949
 25 ;
~
~
~
:wq!

컨트롤 파일을 재생성하기 위해 데이터베이스를 shutdown 상태로 해놓고 스크립트를 실행함
SYS>shutdown
ORA-01012: not logged on

파라미터파일의 컨트롤 파일의 경로에 생김
SYS>@/app/oracle/re11.sql
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

Control file created.

SYS>alter database open;
Database altered.

SYS>select name from v$controlfile;

NAME
--------------------------------------------------
/data/temp7/control01.ctl
/data/temp7/control02.ctl
/data/temp7/control03.ctl



스크립트 모드로 컨트롤 파일을 재생성할 때의 주의 사항
1. DB가 resetlogs mode 로 open 되는지 
    noresetlogs mode로 open 되는지 정확히 구분할 것

2. 스크립트 안에 공백이 있으면 생성도중 에러생김
    (10g 경우에 공백이 있으니 주의할 것)

3. noresetlogs 모드 일 경우 스크립트 내부의 redo log file이 전부 해당 경로에 있어야만 함

4. resetlogs 모드 일 때 스크립트 내부의 redo log file 은 실제 파일이 없어도 resetlog로 open될 때 재생성 됨

5. 두 모드 공통적으로 데이터 파일은 반드시 스크립트 내부의 경로에 실제 존재 해야함

6. control file의 생성 위치는 파라미터 파일에 지정된 경로 


'DB > oralce' 카테고리의 다른 글

리두로그마이너 - 정리 덜됨...엉망임;;  (0) 2014.11.05
컨트롤 파일복구 3-1  (0) 2014.11.04
컨트롤 파일복구 2  (0) 2014.11.04
컨트롤 파일 복구1  (0) 2014.11.04
시점복구시 주의할 사항  (0) 2014.11.04
Posted by 성장하는yw
2014. 11. 4. 17:36

SYS>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

ORA-00214: control file '/data/temp7/control01.ctl' version 1782 inconsistent with file '/data/temp7/control02.ctl' version 1767


모든 컨트롤 파일끼리는 정보가 동일해야하는데 

컨트롤 파일끼리 정보가 달라서 생기는 version error임


SYS>!

[oracle@localhost ~]$ cp /data/temp7/control01.ctl /data/temp7/control02.ctl

[oracle@localhost ~]$ cp /data/temp7/control01.ctl /data/temp7/control03.ctl

[oracle@localhost ~]$ exit


SYS>alter database mount;

Database altered.


SYS>alter database open;
Database altered.

SYS>select name from v$controlfile;

NAME
--------------------------------------------------
/data/temp7/control01.ctl
/data/temp7/control02.ctl
/data/temp7/control03.ctl


해결방법

- 버전이 높은 것(최신으로) 복사해서 컨트롤파일2, 3을 동일하게 복사함

   만일 낮은 버전으로 복사하게 되면 old controlfile error 발생함

'DB > oralce' 카테고리의 다른 글

컨트롤 파일복구 3-1  (0) 2014.11.04
컨트롤 파일 복구 3  (0) 2014.11.04
컨트롤 파일 복구1  (0) 2014.11.04
시점복구시 주의할 사항  (0) 2014.11.04
ora-01190  (0) 2014.11.04
Posted by 성장하는yw
2014. 11. 4. 17:22

SYS>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

ORA-00205: error in identifying control file, check alert log for more info


에러 뜨는 이유 컨트롤 파일의 경로와 실제 컨트롤 파일이 서로 맞지 않을 때,

경로는 있지만, 파일이 없는 경우 위와 같은 에러가 생김

그러면 경로를 수정해주거나, 파일을 추가 혹은 삭제해서 같도록 만들어주면 startup 이 정상적으로 됨


나와 같은 경우


실제 경로

파일명 : $ORACLE_HOME/dbs/inittestdb.ora (파라미터파일, pfile) 

...생략

*.control_files='/data/temp7/control01.ctl','/data/temp7/control02.ctl','/data/temp7/control03'

...생략



실제 컨트롤 파일 조회

SYS>select name from v$controlfile;


NAME

--------------------------------------------------

/data/temp7/control01.ctl


os 실제 경로에 파일 확인


[oracle@localhost temp7]$ ls

control01.ctl  redo01_b.log  sysaux01.dbf  undotbs01.dbf

example01.dbf  redo02_a.log  system01.dbf  users01.dbf

redo01_a.log   redo02_b.log  temp01.dbf


[oracle@localhost ~]$ cp /data/temp7/control01.ctl /data/temp7/control02.ctl
[oracle@localhost ~]$ cp /data/temp7/control01.ctl /data/temp7/control03.ctl 


해결방법 :

1. 경로에서 사용하지 않는 경로를 삭제

2. 실제(사용중인) 컨트롤 파일을 경로처럼 다중화(복사)를 해줌

3. 경로에 오타가 있거나 파일 이름에 오타가 있어도 이러한 에러가 뜸!!!!!!!!!!!!



'DB > oralce' 카테고리의 다른 글

컨트롤 파일 복구 3  (0) 2014.11.04
컨트롤 파일복구 2  (0) 2014.11.04
시점복구시 주의할 사항  (0) 2014.11.04
ora-01190  (0) 2014.11.04
archive log mode 아카이브 로그 모드 장애 복구  (0) 2014.11.03
Posted by 성장하는yw
2014. 11. 4. 11:43

- 내가 한 실수

시점복구를 할 때, 

오라클의 날짜와 시간을 보고 

시점복구를 해야한다. 


윈도우의 시간과 오라클의 시간이 다르기 때문에

특히 주의를 해야한다. !!


윈도우 시간으로 복구하려고 했다가

시점 복구할 때 그래서 삽질함 


- 시점복구 명령어

recover until time '2014-11-01:07:17:55';


- 현재 시간보는 쿼리문

SQL> select to_char(sysdate,'yyyy-mm-dd:hh24:mi:ss') from dual;


TO_CHAR(SYSDATE,'YY

-------------------

2014-11-01:07:17:56



- alert_testdb.log의 시간 형태

/app/oracle/diag/rdbms/testdb/testdb/trace/alert_testdb.log 


Sat Nov 01 06:53:25 2014

SMCO started with pid=28, OS id=22285

Sat Nov 01 06:55:24 2014

drop tablespace  ts_new including contents and datafiles



'DB > oralce' 카테고리의 다른 글

컨트롤 파일복구 2  (0) 2014.11.04
컨트롤 파일 복구1  (0) 2014.11.04
ora-01190  (0) 2014.11.04
archive log mode 아카이브 로그 모드 장애 복구  (0) 2014.11.03
recovery 이론 및 dump파일 내용  (0) 2014.11.01
Posted by 성장하는yw
2014. 11. 4. 11:21

백업 복구시 에러 생김 ㅠ


Database dismounted.

ORACLE instance shut down.


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 open;

alter database open

*

ERROR at line 1:

ORA-01190: control file or data file 1 is from before the last RESETLOGS

ORA-01110: data file 1: '/data/temp6/system01.dbf'



SQL> recover tablespace system;

ORA-00283: recovery session canceled due to errors

ORA-19909: datafile 1 belongs to an orphan incarnation

ORA-01110: data file 1: '/data/temp6/system01.dbf'



SQL> recover database;

ORA-00283: recovery session canceled due to errors

ORA-19909: datafile 1 belongs to an orphan incarnation

ORA-01110: data file 1: '/data/temp6/system01.dbf'



컨트롤 파일과 데이터 파일이 

리셋로그즈의 시점이 다른 파일을 가지고 와서 

복구 명령어로 실행하고

오픈 하려고 하면 이런 에러가 생긴다. 


리셋로그즈의 여부에 따라 하나는 아마 리셋로그즈전, 하나는 후 


리셋로그즈의 시점이 맞지 않는 컨트롤, 데이터 파일을 가지고 오면 복구 명령어도 먹지 않는다.


결국 close 백업으로 받아놓았던 파일로 모두 덮어쓰고 다시 DB 생성해서 복원해주었다.


'DB > oralce' 카테고리의 다른 글

컨트롤 파일 복구1  (0) 2014.11.04
시점복구시 주의할 사항  (0) 2014.11.04
archive log mode 아카이브 로그 모드 장애 복구  (0) 2014.11.03
recovery 이론 및 dump파일 내용  (0) 2014.11.01
오라클이 시작되는 원리  (0) 2014.10.31
Posted by 성장하는yw
2014. 11. 3. 16:18

1. DB를 archive log mode로 시작


startup mount;


alter database archivelog;


alter database open;


create tablespace test2 

datafile '/app/oracle/oradata/testdb/test02.dbf' size 5M;


2. 정상 종료 후 백업 수행

(모드 변경 후에는 항상 전체 백업을 할 것)


select name from v$datafile;


select name from v$controlfile;


select member from v$logfile;


shutdown immediate;


!cp /app/oracle/oradata/testdb/* /data/backup/close/


startup


3. 장애를 발생시키고 복구 진행


create table scott.tt750 (no number) tablespace test2;


insert into scott.tt750 values (1);


commit;


select * from scott.tt750;


4. 장애 발생 확인


!rm -rf /app/oracle/oradata/testdb/test02.dbf


!ls /app/oracle/oradata/testdb/test02.dbf


alter tablespace test2 offline;


alter tablespacae test2 online;

에러발생


 5. 백업으로부터 삭제 된 데이터 파일 복원 후 복구 


!cp /data/backup/close/test02.dbf /app/oracle/oradata/testdb/


alter database test2 online;

에러발생


recover tablespace test2;


alter tablespace test2 onlie;


select * from scott.tt750;


db 정지 후 복구(offline 안되는 tablespace)

1 system tablespace 에 연습용 테이블 생성


create table scott.tt800(no number) tablespace system;


insert into scott.tt800 values (1);


commit;


select * from scott.tt800;


2. system tablespace 삭제 후 db 종료


!rm /app/oracle/oradata/testdb/system01.dbf


alter tablespace system offline;

에러


shutdown immediate;


startup;

에러


3. 백업 파일에서 system01.dbf를 복원 한 후 복구


!cp /data/backup/close/system01.dbf /app/oracle/oradata/testdb/


recover tablespace system;


alter database open;


select * from scott.tt800;


백업 파일이 없는 상태에서의 복구


이 방법으로 생성되지 않는 파일들이 있으므로 주의해야 함! 평소에 백업을 잘 시켜놓을 것 


1. 장애발생


!vi dd.sql

conn / as sysdba


set line 200

col tablespace_name for a10

col file_name for a50

col mb for 999

select tablespace_name, byres/1024/1024/ MB, file_name

from dba_data_files

/

:wq!


@dd


!rm -f /app/oracle/oradata/testdb/test02.dbf


!ls /app/oracle/oradata/testdb/test02.dbf

그런파일이나 디렉토리 없음


2. 테스트용 테이블을 생성 후 데이터를 입력

create table scott.tt810 (no number) tablespace test2;


insert into scott.tt810 values(1);


commit;


select * from scott.tt810;


alter teblespace test2 offline;


alter tablespace test2 online;

에러


select * from scott.tt810;

에러


3. 파일을 생성해서 복구 수행


@dd


alter database create datafile

'/app/oracle/oradata/testdb/test02.dbf'

as '/home/oracle/test01.dbf';


recover tablespace test2;


alter tablespace test2 online;


select * from scott.tt810;



'DB > oralce' 카테고리의 다른 글

시점복구시 주의할 사항  (0) 2014.11.04
ora-01190  (0) 2014.11.04
recovery 이론 및 dump파일 내용  (0) 2014.11.01
오라클이 시작되는 원리  (0) 2014.10.31
오라클 실습시 용량부족으로 디스크 붙이는 방법  (0) 2014.10.31
Posted by 성장하는yw
2014. 11. 1. 01:58

dump file이 저장될 장소를 확인하는 명령어


SYS>show parameter user_dump_dest;


NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

user_dump_dest                       string      /app/oracle/diag/rdbms/testdb/testdb/trace



위 trace 경로에는 많은 파일이 있어서 생성되어도 찾기가 어려움

그래서 구분하기 쉽게 identifier을 추가한 후 dump를 수행함


SYS>alter session set tracefile_identifier='AAA';

Session altered.


SYS>oradebug setmypid;

Statement processed.


SYS>oradebug dump controlf 3;

Statement processed.



SYS>!

[oracle@localhost ~]$ cd /app/oracle/diag/rdbms/testdb/testdb/trace/

[oracle@localhost trace]$ ls -lSh *AAA*

-rw-r----- 1 oracle oinstall 44K Nov  1 00:33 testdb_ora_4412_AAA.trc

-rw-r----- 1 oracle oinstall 169 Nov  1 00:33 testdb_ora_4412_AAA.trm


컨트롤 파일 dump가 완성됨

968줄이나 됨.

복구와 관련된 내용만 살펴보자.



[oracle@localhost trace]$ vi testdb_ora_4412_AAA.trc

Trace file /app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_4412_AAA.trc

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production

With the Partitioning option

ORACLE_HOME = /app/oracle/product/11g

System name:    Linux

Node name:      localhost.localdomain

Release:        2.6.18-238.el5

Version:        #1 SMP Tue Jan 4 15:24:05 EST 2011

Machine:        i686

VM name:        VMWare Version: 6

Instance name: testdb

Redo thread mounted by this instance: 1

Oracle process number: 19

Unix process pid: 4412, image: oracle@localhost.localdomain (TNS V1-V3)


... 중간 생략 ...


*** 2014-11-01 00:22:07.177

*** SESSION ID:(1.5) 2014-11-01 00:22:07.177

*** CLIENT ID:() 2014-11-01 00:22:07.177

*** SERVICE NAME:(SYS$USERS) 2014-11-01 00:22:07.177

*** MODULE NAME:(sqlplus@localhost.localdomain (TNS V1-V3)) 2014-11-01 00:22:07.177

*** ACTION NAME:() 2014-11-01 00:22:07.177


***************************************************************************

DATABASE ENTRY

***************************************************************************

 (size = 316, compat size = 316, section max = 1, section in-use = 1,

  last-recid= 0, old-recno = 0, last-recno = 0)

 (extent = 1, blkno = 1, numrecs = 1)

 09/27/2014 13:35:14

 DB Name "TESTDB"                     DATABASE NAME 임

 Database flags = 0x00404001 0x00001200

 Controlfile Creation Timestamp  09/27/2014 13:35:15

 Incmplt recovery scn: 0x0000.00000000

 Resetlogs scn: 0x0000.000bc19f Resetlogs Timestamp  09/27/2014 13:35:17

 Prior resetlogs scn: 0x0000.00000001 Prior resetlogs Timestamp  09/05/2010 15:39:48

 Redo Version: compatible=0xb200000

 #Data files = 5, #Online files = 5

 Database checkpoint: Thread=1 scn: 0x0000.0014161e   DATABASE 전체의 Chekcpoint SCN

 Threads: #Enabled=1, #Open=1, Head=1, Tail=1

 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000

 

... 중간 생략 ...


***************************************************************************
LOG FILE RECORDS 복구에 필요한 Redo Log File 관련 내용
***************************************************************************
 (size = 72, compat size = 72, section max = 16, section in-use = 3,
  last-recid= 3, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 10, numrecs = 16)
LOG FILE #1:
  name #3: /app/oracle/oradata/testdb/redo01.log     1번 그룹의 파일 경로
 Thread 1 redo log links: forward: 2 backward: 0
 siz: 0x19000 seq: 0x00000016 hws: 0xd bsz: 512 nab: 0x18247 flg: 0x1 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00132247
 Low scn: 0x0000.00137883 10/26/2014 16:59:37
 Next scn: 0x0000.00139a51 10/26/2014 21:04:30
LOG FILE #2:
  name #2: /app/oracle/oradata/testdb/redo02.log        2번 그룹의 파일 경로
 Thread 1 redo log links: forward: 3 backward: 1
 siz: 0x19000 seq: 0x00000017 hws: 0xd bsz: 512 nab: 0x108a8 flg: 0x1 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00137883
 Low scn: 0x0000.00139a51 10/26/2014 21:04:30
 Next scn: 0x0000.0014161d 10/31/2014 23:27:36
LOG FILE #3:
  name #1: /app/oracle/oradata/testdb/redo03.log        3번 그룹의 파일 경로
 Thread 1 redo log links: forward: 0 backward: 2
 siz: 0x19000 seq: 0x00000018 hws: 0x2 bsz: 512 nab: 0xffffffff flg: 0x8 dup: 1
 Archive links: fwrd: 0 back: 0 Prev scn: 0x0000.00139a51
 Low scn: 0x0000.0014161d 10/31/2014 23:27:36
 Next scn: 0xffff.ffffffff 01/01/1988 00:00:00


***************************************************************************
DATA FILE RECORDS        Data file 관련 내용
***************************************************************************
 (size = 520, compat size = 520, section max = 100, section in-use = 5,
  last-recid= 38, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 11, numrecs = 100)
DATA FILE #1:
  name #7: /app/oracle/oradata/testdb/system01.dbf
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
 tablespace 0, index=1 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:139 scn: 0x0000.0014161e 10/31/2014 23:27:36
 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19
 Creation Checkpointed at scn:  0x0000.00000007 09/05/2010 15:39:53
 thread:0 rba:(0x0.0.0)



데이터 파일안에는 두가지 scn이 있음


ckeckpoint cnt : 현재 데이터 파일에 저장 되어 있는 scn 번호
stop scn : 추가로 작업이 진행될 때 추가되는 scn을 의미

현재까지 저장완료된 scn은 몇 번인지 알 수 있지만,
신규로 추가되는 scn은 현재 작업 중이기 때문에 몇 번까지 들어올지 모름

-> 오라클 DB가 open 상태이면, stop scn을 임시로 무한대(0xffff.fffffff)로 설정해둠
    DB 정상종료가되거나 OFFLINE  되는 경우에 
    checkpoint 를 발생시켜 checkpoint scn / stop scn을 동일하게 만들고 해당 데이터 파일을 닫음

만약에 운영 중 DB가 장애가 생겨서 shutdown abort 된 상황
- checkpoint scn / stop scn의 값이 동기화 되지 않은 상황에서 종료


... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000

 aux_file is NOT DEFINED

 Plugged readony: NO

 Plugin scnscn: 0x0000.00000000

 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Online move state: 0

DATA FILE #2:

  name #6: /app/oracle/oradata/testdb/sysaux01.dbf

creation size=0 block size=8192 status=0xe head=6 tail=6 dup=1

 tablespace 1, index=2 krfil=2 prev_file=0

 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00

 Checkpoint cnt:139 scn: 0x0000.0014161e 10/31/2014 23:27:36

 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19

 Creation Checkpointed at scn:  0x0000.00000883 09/05/2010 15:39:57

 thread:0 rba:(0x0.0.0)

 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000


... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000

 aux_file is NOT DEFINED

 Plugged readony: NO

 Plugin scnscn: 0x0000.00000000

 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Online move state: 0

DATA FILE #3:

  name #5: /app/oracle/oradata/testdb/undotbs01.dbf

creation size=0 block size=8192 status=0xe head=5 tail=5 dup=1

 tablespace 2, index=3 krfil=3 prev_file=0

 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00

 Checkpoint cnt:67 scn: 0x0000.0014161e 10/31/2014 23:27:36

 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19

 Creation Checkpointed at scn:  0x0000.000bb6b4 09/05/2010 16:17:54

 thread:0 rba:(0x0.0.0)

 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000


... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000
 aux_file is NOT DEFINED
 Plugged readony: NO
 Plugin scnscn: 0x0000.00000000
 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00
 Online move state: 0
DATA FILE #4:
  name #4: /app/oracle/oradata/testdb/users01.dbf
creation size=0 block size=8192 status=0xe head=4 tail=4 dup=1
 tablespace 4, index=4 krfil=4 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:138 scn: 0x0000.0014161e 10/31/2014 23:27:36
 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19
 Creation Checkpointed at scn:  0x0000.000049c6 09/05/2010 15:40:06
 thread:0 rba:(0x0.0.0)
 enabled  threads:  00000000 00000000 00000000 00000000 00000000 00000000

... 중간 생략 ...


 Hot Backup end marker scn: 0x0000.00000000

 aux_file is NOT DEFINED

 Plugged readony: NO

 Plugin scnscn: 0x0000.00000000

 Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign creation scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988 00:00:00

 Online move state: 0

DATA FILE #5:

  name #9: /app/oracle/oradata/testdb/example01.dbf

creation size=12800 block size=8192 status=0xe head=9 tail=9 dup=1

 tablespace 6, index=6 krfil=5 prev_file=0

 unrecoverable scn: 0x0000.00141a59 10/31/2014 23:27:50

 Checkpoint cnt:63 scn: 0x0000.0014161e 10/31/2014 23:27:36

 Stop scn: 0xffff.ffffffff 10/27/2014 03:12:19

 Creation Checkpointed at scn:  0x0000.000c2efc 09/27/2014 13:37:19

 thread:1 rba:(0x1.b3fa.10)

 enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000


... 중간 생략 ...


***************************************************************************
TEMP FILE RECORDS
***************************************************************************
 (size = 56, compat size = 56, section max = 100, section in-use = 1,
  last-recid= 10, old-recno = 0, last-recno = 0)
 (extent = 1, blkno = 90, numrecs = 100)
TEMP FILE #1: External File #201
  name #8: /app/oracle/oradata/testdb/temp01.dbf
creation size=2560 block size=8192 status=0x1e head=8 tail=8 dup=1
 tablespace 3, index=5 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.000bc288 09/27/2014 13:35:35




'DB > oralce' 카테고리의 다른 글

ora-01190  (0) 2014.11.04
archive log mode 아카이브 로그 모드 장애 복구  (0) 2014.11.03
오라클이 시작되는 원리  (0) 2014.10.31
오라클 실습시 용량부족으로 디스크 붙이는 방법  (0) 2014.10.31
backup  (0) 2014.10.30
Posted by 성장하는yw