ORACLE/TroubleShooting2013. 6. 23. 21:33
반응형

1. 덤프

  

  덤프 : 일회성으로 그 순간의 상태정보를 가집니다. 

  트레이스 : 10046, 10053 등의 이벤트를 걸게 되면 순간의 상태(immediate) 또는 

  세션이 close될때까지의 정보(trace name context forever) 를 trace로 

  남깁니다.

  참고로 udump 에 없다고 해서 고민하지 말구요. bdump를 찾아보세요. 

  background process를 이용해서 dump를 뜨는 경우에는 bdump에 나오겠죠.

 

2. 문제발생시 덤프 뜨는 방법 

  문제발생 세션에 대한 10046 event, truss output, errorstack dump 

  OS engineer의 system state dump 

  system state dump 2~3회 

  hang analyze dump 2~3회 

  system state dump 1~2회 

  hang analyze dump 1~2회

 

3. 에러스택 뜨기(꼭 수행할 때마다 exit나와서 다시 서버에 접속해서 뜰 것) 

  oradebug setospid XX 

  oradebug unlimit 

  oradebug dump errorstack 3 

  oradebug tracefile_name

 

  또는

  alter system set max_dump_file_size=unlimited;

  alter session set tracefile_identifier='error1';

  alter session set events 'immediate trace name errorstack level 3'; 

 

4. hanganalyze, systemstate dump 뜨기(꼭 수행할 때마다 exit나와서 다시 서버에 접속해서 뜰 것) 

  - systemstate dump는 database의 전반적인 hang이나 slow performance상황에 요구된다.

    또한 데이터베이스 문제가 발생해서 재기동할 때에 , 추후 분석을 위해서 재기동 전에

    적절한 systemstate dump를 확보한다.

    보통 system state dump는 3~5분 간격으로 3번 수행을 권장하는데, 이 때 매번

    새로운 접속을 해야 각각이 각각 다른 파일명으로 생성된다.

    같은 세션에서 3번 수행하면, 한 파일에 이어서 생성된다.

  - hanganalyze dump는 마찬가지로 hang이나 slow performance 상황에 사용된다.

    그러나 hanganalyze dump는 리소스(latch/eueueue등등)을 점유하는 blocker를

    보여주므로 , 이 blocker를 정리함으로 문제 해결에 접근할 수 있다.

    

  oradebug setmypid 

  oradebug unlimit 

  oradebug hanganalyze 4 

  

  oradebug setmypid

  oradebug unlimit

  oradebug dump systemstate 10 

  

  또는

  alter system set max_dump_file_size=unlimited;

  alter session set tracefile_identifier='sys1';

  alter session set events 'immediate trace name systemstate level 10';

  

  alter system set max_dump_file_size=unlimited;

  alter session set tracefile_identifier='hang1';

  alter session set events 'immediate trace name hanganalyze level 4';

  

5. oradebug로 event 걸기(10046 event는 sql 트레이스 정보, 10053은 optimizer에 대한 트레이스 정보) 

  oradebug setospid XX 

  oradebug unlimit 

  oradebug event 10046 trace name context forever, level 12; 

  oradebug event 10053 trace name context forever, level 1; 

  oradebug tracefile_name 

  oradebug event 10046 trace name context off; 

  oradebug event 10053 trace name context off;

 

6. 문제가 있는 세션의 process state dump 뜨기 

  oradebug setospid <process ID> 

  oradebug unlimit 

  oradebug dump processstate 10

 

7. 특정 event가 발생할 경우에heap dump 뜨기 ( 4031 에러의 경우 )

  init 파라미터에 event name 하나에 trace name을 여러개를 사용  할 경우 ; 를 붙임

  init 파라미터에 여러개 event를 붙일 경우 : 을 사용함

     

  event = "4031 trace name heapdump level 1;name errorstack level 3"

  또는 sqlplus에서 

  alter session set events '4031 trace name heapdump level 1

                      ;name errorstack level 3';     

  

8. 연속적으로 event를 붙어 넣기

   init 파라미터 

     event="10015 trace name context forever"

     event="10046 trace name context forever, level 4"

   또는

     event="10015 trace name context forever:

            10046 trace name context forever, level 4"

   

   sqlplus 에서   

    alter session set events '10015 trace name context forever:

               10046 trace name context forever, level 4';

           

9. alter session 명령으로 자신 세션에  event걸기(session 이 logout할때까지 수행됨) 

   alter session set timed_statistics=true; 

   alter session set max_dump_file_size=unlimited; 

   alter session set tracefile_identifier='10046evnt1'; 

   alter session set events '10046 trace name context forever , level 12'; 

   alter session set events '10053 trace name context forever , level 1'; 

   alter session set events '10046 trace name context off'; 

   alter session set events '10053 trace name context off';

 

10. 전체 시스템에 event 걸기

   alter system set timed_statistics=true; 

   alter system set max_dump_file_size=unlimited; 

   alter system set tracefile_identifier='10046evnt1'; 

   alter system set events '10046 trace name context forever , level 12'; 

   alter system set events '10053 trace name context forever , level 1'; 

   alter system set events '10046 trace name context off'; 

   alter system set events '10053 trace name context off';

 

11. alter session 명령으로 ORA-4031 에러에 대한 event 걸기(immediate로 즉각 떨어지도록) 

   alter session set max_dump_file_size=unlimited; 

   alter session set tracefile_identifier='4031evnt1'; 

   alter session set events '04031 trace name errorstack level 3'; 

   alter session set events '04031 trace name systemstate level 10';

 

12. sqlplus 로 접속이 불가능할 경우 백그라운드 프로세스의 systemstate 덤프 뜨기 

 위험한 명령임, 서비스 중엔 사용금지, 문제 발생으로 DB를 내리기전에 수행

   OS debuger를 사용하면 특정 process에게 특정 function을 호출하도록 할 수 

   있습니다. 이러한 점을 이용하면 ORACLE에서 systemstate dump를 요청할 때 

   사용하는 ksudss function을 호출할 수 있으며, 절차는 아래와 같습니다. 

   cf> dbx -> 유닉스에서 사용

       gdb -> 리눅스에서 사용

   

   1) 먼저 attach할 ORACLE process에 대한 OS PID를 알아 둡니다. 

       (여기서는 PMON process를 예를 들었습니다.) 

   $ ps -ef | grep $ORACLE_SID | grep pmon 

      aprdbms 1432 1 0 23:14:50 ? 0:00 ora_pmon_APR920U6 

   2) Pmon process에 debuger를 사용하여 attach합니다. 

      $gdb $ORACLE_HOME/bin/oracle 1432 

   3) Ksudss function을 호출합니다. 

      gdb) call ksudss (10) 

   4) Pmon은 ksudss를 호출하여 systemstate dump를 받게 됩니다. 

      attach한 process가 ksudss function call 요청을 받아 들이기 위해서는 

      system call을 수행 중에 있지 않아야 합니다. 

  

13. Tracing Oracle Process 를 통해서 서버 프로세스 트레이스 확인

  - os에서 어떻게 처리하고 있는지를 확인할 경우 사용

  - DB를 내릴 것이 아니라면 background 프로세스에 실행하지 말것

  - db가 내려갈 수 있으므로 프로세스에 대한 OS trace를 남기고자 할 경우에

    세션을 죽이기 전에 수행하기

  - where에 나온 부분에서 읽는 방법은 거꾸로 올라가며 읽어야 함

    

  $dbx -a (프로세스id) 또는 gdb $ORACLE_HOME/bin/oracle 11270

   (dbx) where

   (dbx) detach

  

  - 예>

       PROD:/opt/oracle/product/9.2.0/network/admin$script dbx.log

       Script started, file is dbx.log

       PROD:/opt/oracle/product/9.2.0/network/admin$gdb $ORACLE_HOME/bin/oracle 11270

       GNU gdb Red Hat Linux (5.3.90-0.20030710.40rh)

       Copyright 2003 Free Software Foundation, Inc.

       (gdb) where

       #0  0xb71836e1 in fsync () from /lib/i686/libpthread.so.0

       #1  0x09826f33 in skgfcfi ()

       #2  0x082bf561 in ksfdcls ()

       #3  0x08b669ea in kcflckf ()

       #4  0x08b66bc3 in kcflbi ()

       #5  0x00000003 in ?? ()

       #6  0x0ae0bb44 in ?? ()

       #7  0x00000010 in ?? ()

       #8  0x565fa0cc in ?? ()

       #9  0x00080002 in ?? ()

       (gdb) detach

       ctrl+c

       $ script off

       

14. truss 남기기(db를 내리기 전에 OS에서 수행, 평상시 사용 금지) note 110888.1

 (1) hp-ux 의 경우 

   $ tusc -afpo <output file> <pid> <executable>

 (2) AIX 5L 

   $ truss -aefo <output file> <executable>

 (3) LINUX

   $ strace -fo <output file> <executable>

 (4) solaris

   $ truss -aefo <output file> <executable>

    예) truss -o truss.txt -p (process pid)

      truss -p (process id)

  

 (5) sqlplus통해서 db기동시 에러가 날 경우(예를들어 ORA-27302 failure occured at skgxpvaddr9

      truss를 이용해서 sqlplus 에 접속후를 truss 남기기

      linux의 경우 strace -o truss.log sqlplus '/as sysdba' 이 명령으로 들어가기

    - 

     $truss -o truss.log -fae sqlplus '/as sysdba'

     sql> startup

     ORA-27302 failure occured at skgxpvaddr9

     ...

     $cat truss.log

15. 네트워크에 대한 클라이언트 trace 남기기

 - 클라이언트에서 sqlnet.ora 파일에서

   trace_level_client=16

   trace_directory_client=c:\temp (윈도우)

   log_directory_client=/tmp  (유닉스)

   

16. dump, error , stack의 종류 및 최대 레벨

   10046 event sql trace 남기기, level 12

   10053 event 프로세스가 수행한 쿼리의 optimizer에 대한 정보, level 1

   hanganalyze 시스템 hang이 걸렸을 경우 dump, level 4

   errorstack 시스템 특정 에러 발생에 대해서 간단한 에러 정보 dump, level 3

   systemstate dump 전체 시스템 상태에 대한 dump, level 10

   heapdump 메모리 에러 발생시 heap영역에 대한 dump, level 3

  

17. event 종류

   10046 sql trace 남기기, level 12는 bind변수 및 plan, tuning statistics 까지 출력

   10053 optimizer에 대한 정보까지 출력, level 1 이 최대

   10015 rollback segment를 분석 및 사용중지 하도록 하는 event

   10233 index opereation 에서 corrupted index block을 skip하기

   10061 disable SMON from cleaning temp segment(smon프로세스가 extent정리를 안하도록 설정)

   10510 turn off SMON check to offline pending offline rollback segment

   10511 turn off SMON check to cleanup undo dictionary

 

18. 10390 parallel execution 

10390, 00000, "Trace parallel query slave execution"

// *Cause:

// *Action:  set this event only under the supervision of Oracle development.

//           trace level is a bitfield

//

//  LEVEL        ACTION

//---------------------------------------------------------------------------

//  0x0001       slave-side execution messages

//  0x0002       coordinator-side execution messages

//  0x0004       slave context state changes

//  0x0008       slave rowid range bind variables and xty

//

//  0x0010       slave fetched rows as enqueued to TQ

//  0x0020       coordinator wait reply handling

//  0x0040       coordinator wait message buffering

//  0x0080       slave dump timing

//

//  0x0100       coordinator dump timing

//  0x0200       slave dump allocation file numbers

//  0x0400       terse format for debug dumps

//  0x0800       Trace CRI random sampling

//

//  0x1000       Trace signals

//  0x2000       Trace PX granule operations

//  0x4000       Force compilation by slave 0

/

 


1. 10046 trace

2. v$ps_sesstat

3. systemstate dump

4. wait.sql

에 추가해서, 다음 정보도 있으면 분석에 큰 도움이 될 것입니다.

5. parallel query parent process (QC process) 및 그 child process (slave process)들에 대해 truss o

utput을 좀 받아주세요. slave process에 대해서는 적어도 3~4 개 정도는 truss를 받아주세요.

방법:

----

% truss -aef -o truss.out.<<qc_pid>> -p <<qc_pid>>

% truss -aed -o truss.out.<<slave_p id>> -p <<slave_pid>>

6. event 10390를 설정하여 둡니다.

방법:

-----

init parameter 화일에,

event = "10390 trace name context forever, level 1166"

 

 

* tuning point - parallel_execution_message_size

parallel_execution_message_size - QC 와 PQ slaves 들간의 message buffer에 대한 크기를 조정하는 

parameter로 이 값이 크면 parallel execution에 대한 속도가 증가될 수 있

으나 memory 사용량은 증가하게 됩니다. 또한 경험적으로 이 값은 2K에서 4K나 8K 로 증가 시켰을 때 속도 개선이 10% 내외로 되었

으며 그 이상은 크게 변화가 없었습니다. 이 값을 변경하게 되면 large pool의 사용량이 증가 될 수 있으므로 peek time에 v$s

gastat를 monitoring하여 large pool의 free space가 부족하지 않은지 확인하여 보시기 바랍니다.

Ref. oralce 8i tuning manual 

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

PARALLEL_EXECUTION_MESSAGE_SIZE

The recommended value for PARALLEL_EXECUTION_MESSAGE_SIZE is 4KB. If PARALLEL_AUTOMATIC_TUNING is TRUE, the default is 4KB. If PARALLEL_AUTOMATIC_T

UNING is FALSE, the default is slightly greater than 2KB.

The PARALLEL_EXECUTION_MESSAGE_SIZE parameter specifies the upper limit for the size of parallel exe

cution messages. The default value is operating system specific and this value s

hould be adequate for most applications. Larger values for PARALLEL_EXECUTION_ME

SSAGE_SIZE require larger values for LARGE_POOL_SIZE or SHARED_POOL_SIZE, depend

ing on whether you've enabled parallel automatic tuning.

While you may experience significantly improved response time by increasing the value for PARALLEL_EX

ECUTION_ MESSAGE_SIZE, memory use also drastically increases. For example, if yo

u double the value for PARALLEL_EXECUTION_ MESSAGE_SIZE, parallel execution requ

ires a message source pool that is twice as large.

Therefore, if you set PARALLEL_AUTOMATIC_TUNING to FALSE, then you must adjust the SHARED_POOL_SIZE to acco

mmodate parallel execution messages. If you have set PARALLEL_AUTOMATIC_TUNING t

o TRUE, but have set LARGE_POOL_SIZE manually, then you must adjust the LARGE_PO

OL_SIZE to accommodate parallel execution messages.

 



반응형
Posted by [PineTree]
ORACLE/11G2012. 5. 11. 10:54
반응형
OTN펌
  • 목적 :
    Oracle 11g 부터 Alert.log 와 trace file 은 새로운 형식으로 생성이 되며, 이는 ADR (Automatic Diagnotic Repository) 에 생성이 된다.
    본 문서에서는 Database 에 심각한 에러가 발생한 경우, ADRCI 명령어를 이용하여 에러를 확인하고 관련된 alert.log 및 trace file 을 오라클 고객지원센터로 전송하는 방법에 대해서 설명한다.

  • IPS 사용법 :
    ORACLE 11g 는 problem (Database 에서 발생한 에러코드)과 incident (에러가 발생한 기록)에 관련된 trace file 들을 자동으로 수집해주는 기능을 제공한다.
    이 기능을 IPS (Incident Packaging Service) 라고 하며, 인터페이스로 GUI 환경과 ADRCI command 를 제공한다.
    Database 에 발생한 모든 심각한 에러들은 각각의 incident 를 생성한다.
    IPS 를 통해서 생성된 압축 파일은 에러에 대한 alert.log file, 모든 trace file 과 진단 정보를 포함하고 있기 때문에, 해당 error 에 대한 정보수집을 간편히 수행할 수 있다.

    Database 의 에러 확인 및 관련 file을 오라클 고객지원센터로 전송하는 방법 :

    1. Database 에서 발생한 심각한 에러 발생

    SQL> select * from atab;
    select * from atab
    *
    ERROR at line 1:
    ORA-01578: ORACLE data block corrupted (file # 6, block # 11)
    ORA-01110: data file 6: '/opt/oracle/oradata/db11g/tt.dbf'

    2. ADR과 Alert.log 에서 에러를 확인한다.

    ADR에서 에러를 확인하기 위하여 11g 환경의 OS prompt에서 adrci를 실행한다.

    %] adrci

    ADR 홈 경로를 확인한다.

    adrci> show home
    --> 모든 ADR HOME 을 보여준다. 확인하고자 하는 ADR HOME 을 지정한다.

    adrci> set homepath <ADR HOME>

    에러 코드를 problem 이라고 하며, 이를 확인하기 위해서 다음을 실행한다.

    adrci> show problem

    ADR Home = /opt/oracle/diag/rdbms/db11g/db11g:
    *************************************************************************
    PROBLEM_ID PROBLEM_KEY LAST_INCIDENT LASTINC_TIME
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    1 ORA 1578 18104 2009-06-01 22:06:19.501207 +10:00
    1 rows fetched

    Database 에 문제가 되고 있는 에러 코드를 확인할 수 있다.
    이 중, 분석이 필요한 에러코드에 대하여 압축파일을 생성할 수 있다.

    3. 분석이 필요한 에러의 발생 기록을 확인한다.

    에러의 발생 기록들은 Incident 라고 하며, 모든 incident 는 Alert.log 에 기록된다.
    각각의 incident 는 유일한 incident ID 를 가진다.

    ADR 에서 'show incident' 명령을 수행하여 에러 발생 기록을 확인할 수가 있으며,
    에러에 대한 problem key를 확인하기 위해서는 'show problem' 을 수행한다.

    adrci> show incident -p "problem_key='ORA 1578'"

    ADR Home = /opt/oracle/diag/rdbms/db11g/db11g:
    *************************************************************************
    INCIDENT_ID PROBLEM_KEY CREATE_TIME
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    18147 ORA 1578 2009-06-01 22:02:08.805002 +10:00

    동일한 problem에 대한 incidnet는 여러 건이 발생할 수 있다.

    4. IPS (incident packaging service) 를 수행하여 alert.log , trace file 및 diag 정보에 대한 압축 파일 생성.

    압축 파일을 생성하기 위해서는 특정 경로를 포함한 'IPS pack' 명령을 사용한다.
    다음의 예는 incident 관련 file들을 /tmp directory 에 압축 파일로 생성하는 방법이다.

    adrci> ips pack incident 18147 in /tmp
    Generated package 9 in file /tmp/ORA1578_20090602113045_COM_1.zip, mode complete

    IPS pack 의 예제)

    ips pack problem 100 in /tmp
    -- problem id 100 에 관련된 trace file 들을 /tmp directory 에 압축파일로 생성한다.

    ips pack incident 6439 in /tmp
    -- incident id 6439 에 관련된 trace file 들을 /tmp directory 에 압축파일로 생성한다.

    ips pack problemkey "ORA 1578"
    -- problem_key 'ORA 1578' 를 가지는 모든 problem 에 관련된 trace file 들을 현재 directory 에 압축파일로 생성한다.

    ips pack seconds 8
    -- 최근 8 초 이내에 발생한 incident 에 대한 압축 파일을 생성한다.

    ips pack time '2007-05-01 10:00:00.00' to '2007-05-01 23:00:00.00'
    -- 특정 시간대의 incident 에 대한 압축파일을 생성한다.

    'IPS pack' 명령은 'IPC create' 와 'IPS generage' 명령을 일괄적으로 수행할 수 있는 명령이다.

    이와 같이 생성된 압축 파일을 SR (service request)을 통해 오라클 고객지원센터로 전송하면 된다.

    동영상 참조 :
    IPS package 를 생성하는 방법 (동영상 자료 02:30)
    (My Oracle Support 접속 필요)

    참고자료 :
    DOC ID : 443529.1
    11g Quick Steps to Package and Send Critical Error Diagnostic Information to Support (Video)

    DOC ID: 738732.1
    ADR Different Methods to Create IPS Package

  •  
     

    추가적으로 trace file정리시

    adrci>purge -age 30

    하면 됩니다.

     

    반응형

    'ORACLE > 11G' 카테고리의 다른 글

    11g: 스케줄러 유지 관리 작업 또는 자동작업 (문서 ID 1534329.1)  (0) 2014.06.14
    oracle 11g에 추가된 파티션  (0) 2013.08.20
    ADR  (0) 2013.05.19
    기준선 및 개선된 계획  (0) 2009.08.25
    Oracle Advanced Compression  (0) 2009.04.02
    Posted by [PineTree]
    ORACLE/TUNING2011. 10. 21. 17:26
    반응형

    sqlplus를 이용하여 sysdba 계정에서 아래의 파일을 실행합니다.


    SQL> @dbmsutil.sql <== ORACLE_HOME\rdbms\admin 에 파일이 존재함
    SQL> @prvtutil.plb <== ORACLE_HOME\rdbms\admin 에 파일이 존재함

    SQL> grant execute on dbms_system to system;


    - DBMS_SYSTEM.set_sql_trace_in_session(sid, serial#, TRUE)
    지정된 session에 대해 SQL trace를 실행하여 user_dump_dest parameter에 지정된 위치에 trace file이 생성된다.

    - DBMS_SYSTEM.set_sql_trace_in_session(sid, serial#, FALSE)
    지정된 session에 대한 SQL trace를 해제한다.

    [예제] system user에서 scott user를 지정하여 SQL trace 생성하기.

    sqlplus system/manager

    SQL> select sid, serial#
    from v$session
    where username = 'SCOTT';

    SID SERIAL#
    --------- ---------
    8 12

    SQL> exec sys.dbms_system.set_sql_trace_in_session(8, 12, TRUE);

    -> scott user에 대한 SQL trace가 실행된다.

    SQL> exec sys.dbms_system.set_sql_trace_in_session(8, 12, FALSE);

    -> scott user에 걸린 SQL trace가 해제된다.


    ==> 위와 같이 trace 처리된 내역은 DBMS가 설치된 server의 user_dump_dest 경로에 trc 파일로 생성됩니다.

    이렇게 해서 생성된 trace 파일을 TKPROF를 이용하여 가독이 용이한 형태로 내용을 변환하여 확인하면 됩니다.

    ex) tkprof '원본파일' '변환파일' [option] sys=no aggregate=no explain=계정ID/계정PWD
    --> tkprof C:\oracle\admin\orcl\udump\orcl_ora_3012.trc c:\test.text sys=no aggregate=no explain=scott/tiger


    반응형

    'ORACLE > TUNING' 카테고리의 다른 글

    SHARED POOL SIZE의 계산방법  (0) 2011.11.23
    OWI를 활용한 shared pool 진단 및 튜닝  (0) 2011.11.23
    SQL TRACE  (0) 2011.10.21
    [SQL튜닝] 오라클 CPU 많이 차지하는 쿼리 찾기  (0) 2011.03.28
    DBMS_XPLAN - 2.포맷 설정하기  (0) 2010.05.24
    Posted by [PineTree]
    ORACLE/TUNING2011. 10. 21. 17:23
    반응형

    SQL 튜닝, 대기현상(내부 매커니즘)을 분석 할때 사용하는 툴

    즉, 개발환경에서 문제없이 수행 되는 SQL 문장이 운영환경에서 느린 성능을 보이는 경우 SQL Trace 를 이용하면 원인 분석이 가능하다.

    10046 이벤트를 사용하며 4가지 레벨로 제어 한다

    LEVEL 1 : SQL 문장의 실행정보(Parse, Execute, Fetch 단계와 Row source operation 결과)만을 제공한다

    LEVEL 4 : LEVEL 1 + 바인드 변수값을 제공한다

    LEVEL 8 : LEVEL 1 + 대기정보를 제공한다

    LEVEL 12 : LEVEL 4 + LEVEL 8, 즉 SQL 문장의 실행정보와 바인드 변수 값, 대기정보를 제공한다

    현재 세션 Trace

    SQL> ALTER SESSION SET sql_trace=TRUE; -- trace file 시작
    SQL> ALTER SESSION SET sql_trace=FALSE; -- trace file 종료

    SQL> ALTER SESSION SET EVENTS '10046 trace name context forever, level 12';
    SQL> ALTER SESSION SET EVENTS '10046 trace name context off';

    다른 세션 Trace

    - dbms_system 사용

    SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => TRUE);
    SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => FALSE);

    SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>TRUE); --sql trace 입장
    SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>FALSE);

    SQL> EXEC DBMS_SYSTEM.set_ev(si=>123, se=>1234, ev=>10046, le=>8, nm=>' '); -- 이벤트 입장

    SQL> EXEC DBMS_SYSTEM.set_ev(si=>123, se=>1234, ev=>10046, le=>0, nm=>' '); -- nm은 name이다.

    --SQL> exec dbms_system.set_ev(7, 10, 65535, 10, 'controlf');
    --SQL> exec dbms_system.set_ev(8,1056,65535,10,'PROCESSSTATE');

    - oradebug 사용

    SQL> CONN sys/password AS SYSDBA; --반드시 sysdba 권한 유저로 실행
    (SQL> ORADEBUG SETMYPID; -- Debug current session.)

    or
    SQL> ORADEBUG SETOSPID 1234; -- Debug session with the specified OS process.

    or
    SQL> ORADEBUG SETORAPID 123456; -- Debug session with the specified Oracle process ID.

    SQL> ORADEBUG unlimit; -- Trace file 크기제한 無

    SQL> ORADEBUG EVENT 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12;
    SQL> ORADEBUG TRACEFILE_NAME; -- Display the current trace file.

    /u01/app/oracle/product/10.2.0/db_1/rdbms/log/dhdb_ora_10803.trc
    SQL> ORADEBUG EVENT 10046 TRACE NAME CONTEXT OFF;

    10g 부터 SQL Trace 로 캡쳐 불가능한 작업을 dbms_monitor 패키지를 사용하여 Client ID, Service/Module/Action 등을 Trace 할 수 있다

    이때, 여러 개의 세션에 대한 Trace 파일이 생성되며, trcsess 툴을 이용해 하나의 Trace 파일로 만들 수 있다

    exec dbms_monitor.client_id_trace_enable(client_id=>'12345', waites=>true, binds=>true);

    exec dbms_monitor.serv_mod_act_trace_enable(123456);

    exec dbms_monitor.session_trace_enable(1234567);

    또한, dbms_monitor 패키지를 이용하면 세션이 아닌 Client ID 나 Service/Module/Action 명을 기준으로 통계정보(Statistics)를 수집 할 수 있다

    client_id_stat_enable, serv_mod_act_stat_enable 을 통해 수집된 정보는 V$CLIENT_STATS, V$SERV_MOD_ACT_STATS 뷰를 통해 관찰 가능하다

    cf.alter session set events 'immediate trace name controlf level 10; --> 이 경우는 event 번호가 없으므로 name으로 trace를 생성한다.

    =====================================================

    출처 및 참고자료 : Advanced Oracle Wait Interface in 10g

    =====================================================

    special thank's to eddy


    반응형
    Posted by [PineTree]
    ORACLE/ADMIN2011. 5. 2. 21:38
    반응형
    TECH: SQL*Net V2 on Unix - A Quick Guide to Setting Up Client Side Tracing [ID 16564.1]


    Modified 20-OCT-2005 Type REFERENCE Status PUBLISHED
    
    ( For a more detailed discussion of SQL*Net V2 tracing see Note:16658.1 )
    
    Client Tracing
    ~~~~~~~~~~~~~~
    1) Set the environment variable TNS_ADMIN to the directory where the 
       tnsnames.ora and listener.ora files exist.
    
       The default location is $ORACLE_HOME/network/admin. Set $TNS_ADMIN to this
       if it is not set. This ENSURES you know which files you are using.
    
    2) Start the listener:          lsnrctl
                                    > set password <password>
                                    > start
    
       Note any errors. If you do not have a password set then ignore the 
       set password command.
    
    3) If the listener started, start the database.
    
    4) Create a file in $HOME called .sqlnet.ora and add the lines:
    
            trace_level_client= 16
            trace_file_client=client
            trace_directory_client= /tmp            (or similar)
            trace_unique_client=true
    
    5) Try to connect from SQL*Plus thus:
    
            sqlplus username/password@alias
    
       or
            sqlplus username/password
    
       substituting a suitable alias.
    
    6) If you get an error we may need to see the client trace file
       /tmp/client_<PID>.trc where <PID> is the process ID of the 
       client process (*1).
       This will be quite large so it is best to FAX or EMAIL it.
    
    *1 Note: On earlier versions of SQL*Net the filename may NOT have
             the process ID appended to it.
    
    
    Listener Tracing:
    ~~~~~~~~~~~~~~~~~
    
    1) Edit your $TNS_ADMIN/listener.ora file and add the lines:
    
            TRACE_LEVEL_LISTENER     = 16    
            TRACE_DIRECTORY_LISTENER = /tmp
            TRACE_FILE_LISTENER      = "listener"   
    
    2) Stop and restart the listener:
    
            lsnrctl stop
            lsnrctl start
    
       Output should go to /tmp/listener.trc
    


    반응형
    Posted by [PineTree]
    ORACLE/ADMIN2011. 5. 2. 21:36
    반응형

    In this Document
      Goal
      Solution
         Launch the Net Manager utility
         Enabling Oracle Net Client / Server tracing (or both).
          Enabling Oracle SQLNet Listener tracing.
         Cyclic Tracing
         Tracing Kerberos
         Tracing Externel Procedures (Extproc)
         Tnsping Trace
         Enabling Dynamic Listener Tracing
         Only for 11g
      References


    Applies to:

    Oracle Net Services - Version: 9.2.0.1.0 to 10.2.0.2.0
    Information in this document applies to any platform.

    Goal

    This document covers how to use Oracle Net Manager tool to enable Oracle SQLNet Client, Server, Listener, Kerberos and External Procedure tracing.  It also includes how to control the size and amount of trace files produced and steps to start dynamic listener tracing.

    Solution

    Launch the Net Manager utility

     

    Windows : Go to Start button, select the Oracle Home on which we are going to generate the tracing for. Net Manager is located under 'Configuration and Migration Tools' of the Oracle Home menu.

    Unix : The tool can also be started remotely from a Microsoft Windows system with the help a terminal emulation software. You need to ensure this software is up and running first.  Ensure that the $DISPLAY, $ORACLE_HOME, and $PATH environment variables are properly set. The Net Manager tool is started by the command "netmgr".

    [oracle@testnet ~]$ export DISPLAY=152.69.172.167:0.0
    [oracle@testnet ~]$ . ora10gr2.env
    The environment settings are performed for 10gr2 home
    [oracle@testnet bin]$ pwd
    /u01/ora10gr2/bin
    [oracle@testnet ~]$ netmgr

     

    After launching the Net Manager, the location of the network configuration files shown in the top of the Net Manager window.  Ensure this is the expected location. If it is not, you have TNS_ADMIN environment variable set, which is pointing the session towards a different location.

     

    Enabling Oracle Net Client / Server tracing (or both).

     

    A. Click on Profiles in the left panel. The right panel of Net Manager will now show more details.

    B. Select General from drop down menu on the right panel of the Net Manager.

    C. Select Tracing tab in the right panel. Client Information and Server Information is now seen.

    D. Select the required Trace Level. Oracle Support usually requests level SUPPORT (also known as level 16). It is optional to provide a value for the Trace Directory and Trace File. If you do,  ensure that the directory exists and that the owner of the Oracle software is able to write to that directory. The default location for the trace files is the $ORACLE_HOME/network/trace directory. Default name is CLI.TRC

    The Unique Trace File Name option for the Client Information section, will make unique trace files for every connection. Without this option selected, all client tracing goes into the one file.  If running Microsoft Windows, always set this parameter or there is the potential that the trace file with the error will be overwritten.  The Server does not have this parameter available.

    E. If tracing is to be done on the Server and the connection model is Shared Server, then the Instance will have to be restarted for the Dispatchers to pick up the changes to the SQLNET.ORA file.

    The SQLNET.ORA will now look like the following :

    TRACE_LEVEL_CLIENT = SUPPORT
    TRACE_UNIQUE_CLIENT = on
    TRACE_LEVEL_SERVER = SUPPORT
    TRACE_DIRECTORY_CLIENT = C:\TEMP
    TRACE_FILE_CLIENT = CLIENT
    TRACE_DIRECTORY_SERVER = C:\TEMP
    TRACE_FILE_SERVER = SERVER
    TRACE_TIMESTAMP_ CLIENT = ON
    Note:If tracing is to be done on the Server and the connection model is Shared Server(MTS), then the Instance will have to be restarted for the Dispatchers to pick up the changes to the SQLNET.ORA file.

     Enabling Oracle SQLNet Listener tracing.

    A. In the left panel of the Net Manager, select Listeners view.

    B. Select the Listener you want to trace. Once selected the right hand panel will show more details.

    C. Select General Parameters from the drop down button, in the right hand panel.

    D. Select Logging & Tracing tab.

    E. Click the Tracing Enabled radio button and select Trace Level. SUPPORT level is normally requested by Oracle Support.

    Select a directory for the trace to be generated.

    G. Listener will need to be restarted or reloaded to enable or disable tracing.
     

    Note: Stopping a Listener does not effect existing connections.

     

    The LISTENER.ORA will now have the following lines.

    TRACE_FILE_LISTENER = LISTENER.TRC
    TRACE_DIRECTORY_LISTENER = C:\TEMP
    TRACE_LEVEL_LISTENER = SUPPORT

    Cyclic Tracing

    Adding parameters TRACE_FILENO_ and TRACE_FILELEN_ to the SQLNET.ORA or LISTENER.ORA files enables Oracle Net trace files to be limited a certain size and a certain number of files. Following example is for Listener traces of 10 MB, with a maximum of 10 files for a maximum of 100 Mb of trace files. Cyclic tracing can be configured for the Client, Server and Listener

    TRACE_FILELEN_LISTENER=10240
    TRACE_FILENO_LISTENER=10

    TRACE_FILENO_{CLIENT/SERVER/listener_name}: When this parameter is set it will determine the maximum number of trace files that will be generated. Trace data will continue to generate but in a cyclic fashion. The maximum size of each file is set by configuring the appropriate TRACE_FILELEN parameter.

    TRACE_FILELEN_{CLIENT/SERVER/listener_name}: When set determines the maximum size of each trace file before either starting a new trace file (if the TRACE_FILENO parameter is set) or will overwrites an existing file (cyclic tracing). Once the last trace file has been written, up to the size specified by TRACE_FILELEN_<CLIENT/SERVER/listener_name>, tracing will continue by overwriting the first trace file in the cycle.

    Tracing Kerberos

    Kerberos can be traced using the following parameters in the SQLNET.ORA file.
    See Note 185897.1 Kerberos Troubleshooting Guide for more details.

    TRACE_LEVEL_OKINIT=SUPPORT
    TRACE_DIRECTORY_OKINIT=<VALID_DIRECTORY>
    TRACE_FILE_OKINIT=<VALID_FILE_NAME>

     

    Tracing Externel Procedures (Extproc)

    External procedure can be traced using the following parameter in the SQLNET.ORA file, where extproc is setup.

    TRACE_LEVEL_AGENT= SUPPORT
    TRACE_DIRECTORY_AGENT = <VALID_DIRECTORY_PATH>
    TRACE_TIMESTAMP_AGENT =ON

     

    Tnsping Trace

    TNSPING.TRACE_LEVEL = SUPPORT
    TNSPING.TRACE_DIRECTORY = <path where tnsping.trc will go>

     

    Enabling Dynamic Listener Tracing

    There might be situations when you cannot reload or restart the listener to enable the traces.Such times, you can fmake use of the dynamic tracing for the listener .

    LSNRCTL> set current_listener listener
    Current Listener is listener
    LSNRCTL> set trc_level 16
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    LISTENER parameter "trc_level" set to support
    The command completed successfully
    LSNRCTL> set trc_directory /home/oracle
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    LISTENER parameter "trc_directory" set to /home/oracle
    The command completed successfully
    LSNRCTL> exit

    This would create sqlnet support level tracing on the listener under directory /home/oracle with name listener.trc

    Only for 11g

    11g has new method of tracing Automatic Diagnostic Repository(ADR)  which will create the trace to the ADR directories
    Reference
    Note 454927.1Using and Disabling the Automatic Diagnostic Repository (ADR) with Oracle Net for 11g

    To create the trace files to the desired directory,
    For client tracing & server tracing add:
    DIAG_ADR_ENABLED= OFF


    For listener tracing:
    DIAG_ADR_ENABLED_<listener name> = OFF


    Unable to start Net Manager

    If Net Manager is unable to start, check that you are able to launch other GUI tools from the same server, where Net Manager is failing. For example the X-Window utility "xclock". If you are not able to launch xclock, you need to address this problem, before attempting to start Oracle GUI tools. If xclock works, check other Oracle GUI tools, like DBCA before reporting the issue to Oracle Support.

    References

    NOTE:374116.1 - How to Match Oracle Net Client and Server Trace Files
    NOTE:454927.1 - Using and Disabling the Automatic Diagnostic Repository (ADR) with Oracle Net for 11g


    반응형
    Posted by [PineTree]
    ORACLE/ADMIN2011. 5. 2. 21:28
    반응형

    In this Document
      Goal
      Solution
      References


    Applies to:

    Oracle Net Services - Version: 9.2.0.1.0 to 11.2.0.1 - Release: 9.2 to 11.2
    Information in this document applies to any platform.
    Checked for relevance on 7-MAY-2010.

    Goal

    When attempting to limit the amount of trace generated when TNS listener tracing is enabled, cyclic tracing can be used. But to further restrict the amount of time TNS listener is enabled, tracing can be enabled and disabled, dynamically via the listener control, lsnrctl. This means tracing can be enabled only when required and allows the listener to run without generating trace until required.But when enabled via this method, Time stamp is missing from the trace file(s) generated. The following steps explain how to workaround the time stamp restriction.

    Solution

    To workaround the current restriction of TNS listener tracing enabled via listener control, generating traces without time stamp, the following steps can be used. Steps 1 to 3 must be inplaced before attempting to capture any problem with tracing.

     1. Backup the Listener.ora file, add the following parameters and save.

    TRACE_LEVEL_<Listener Name> = 16
    TRACE_FILE_<Listener Name> = <File Name>
    TRACE_DIRECTORY_<Listener Name> = <Directory>
    TRACE_TIMESTAMP_<Listener Name> = ON
    TRACE_FILELEN_<Listener Name> = <Size in KiloBytes>
    TRACE_FILENO_<Listener Name> = <Number>

    TRACE_FILELEN and TRACE_FILENO are the cyclic tracing parameters.Ensure values used for these are large enough to capture information,without being overwritten.

    2.Reload the listener, with command lsnrctl reload <listener name>

    $lsnrctl reload 

    LSNRCTL for Solaris: Version 10.2.0.4.0 - Production on 21-NOV-2008 13:32:15 
    Copyright (c) 1991, 2004, Oracle.  All rights reserved. 

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sample.com)(PORT=1521))) 
    The command completed successfully

    With a default listener name of "listener", the listener name can be excluded from commands.

    3. Stop listener tracing, run set trc_level 0 via lsnrctl

    LSNRCTL> set trc_level 0 
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sample.com)(PORT=1521))) 
    listener parameter "trc_level" set to off 
    The command completed successfully

    If your listener name is not using the default name of "listener", then run command "set current_listener <listener name> in listener control, before any other command is used.

    4. When TNS listener tracing is required to be re-enabled. run set trc_level 16 via lsnrctl.

    LSNRCTL> set trc_level 16  
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sample.com)(PORT=1521)))  
    listener parameter "trc_level" set to support  
    The command completed successfully

     
    5. Turn off tracing as soon as the problem / issue has been captured with command "set trc_level 0" from lsnrctl. (As per step 3). Remove or hash out the parameters added to the listener.ora in Step 1 and run reload command. This will stop tracing from being re-activated.

    Please note for 11g TNS listener tracing, ADR tracing can be disabled by following Note 454927.1Using and Disabling the Automatic Diagnostic Repository (ADR) with Oracle Net for 11g
    반응형
    Posted by [PineTree]
    ORACLE/ADMIN2011. 5. 2. 16:30
    반응형

    UNIX: EXAMPLE OF TURNING ON LISTENER TRACE
    ==========================================

    PURPOSE


    RDBMS Manual, Oracle Note에서 Oracle Net Listener Trace File 생성 방법을
    설명하고 있으나 실예가 고객에 이해를 돕는데 유용하여
    아래와 같이 그 실제 상황에 가까운 예를 적습니다.

    Explanation


    Example


    listener trace를 생성하는 절차는 다음과 같습니다.

    a. 문제가 발생하는 database server에서:
    prompt$ echo $TNS_ADMIN

    b. TNS_ADMIN 환경 변수가 설정되어 있으면
    prompt$ cd $TNS_ADMIN

    설정되어 있지 않으면
    prompt$ cd $ORACLE_HOME/network/admin

    prompt$ vi listener.ora
    ...
    TRACE_LEVEL_<listener name>=16
    TRACE_FILE_<listener name>=<filename>
    TRACE_DIRECTORY_<listener name>=<directory>
    TRACE_TIMESTAMP_<listener name>=ON
    :wq
    prompt$ lsnrctl stop <listener name>
    prompt$ lsnrctl start <listener name>

    Production 환경에서 trace file로 인한 disk full 없도록 trace file을 재사용할 수도 있습니다.

    TRACE_LEVEL_<listener name>=16
    TRACE_FILE_<listener name>=<filename>
    TRACE_DIRECTORY_<listener name>=<directory>
    TRACE_TIMESTAMP_<listener name>=ON
    TRACE_FILENO_<listener name>=<# of trace files to switch>
    TRACE_FILELEN_<listener name>=<length of each trace file in KB>

    예)
    TRACE_LEVEL_listener1=16
    TRACE_FILE_listener1=listener1
    TRACE_DIRECTORY_listener1=/u01/app/oracle/rdbms/10.2.0/network/trace
    TRACE_TIMESTAMP_listener1=ON
    TRACE_FILENO_listener1=3
    TRACE_FILELEN_listener1=1024768

    3. Reproduction
    문제 발생 후 trace를 중단 하시기 바랍니다.

    4. Stopping Oracle Net listener Tracing:
    prompt$ vi listener.ora
    ...
    TRACE_LEVEL_listener=0
    ...
    :wq
    prompt$ lsnrctl stop <listener name>
    prompt$ lsnrctl start <listener name>
    prompt$

    4. Listener가 내려간 동안은 기존의 database session들은
    Oracle Server Process의 의하여 계속 처리가 됩니다.
    새로운 database connection request는 listener가 내려간 동안
    처리되지 않아 그 동안 client는 database에 연결할 수 없습니다.

    5. TAR를 통한 진행 중에는 생성된 Oracle Net Server Trace file들을
    WinZip 또는 Unix의 compress (.tar.Z), GNU zip (tar.gz)으로
    묽어 올려주시기 바랍니다.

    6. TAR를 통한 진행 중에는 문제가 발생한 시:분도 같이 알려 주시면
    Net engineer가 Trace 중에 해당 시간에 기록된 내용을 중심으로 보게 됩니다.

    Reference Documents

    반응형
    Posted by [PineTree]
    ORACLE/ADMIN2011. 4. 14. 10:05
    반응형

    trace event를 세팅에 대하여

    init.ora에 특별한 파라메터를 세팅하므로서 memory나 디스크 corruption에대해
    분석할 수있는 방법이 있다. 이러한 파라메터들은 performance에 영향을 줄 수
    있으므로 정상적인 상태에서는 세팅하지 않는다. 여기서는 event information을
    모으기 위한 시간을 절약하는데 목적이 있으며 몇개의 event 세팅의 보기를 보여
    준다. 여기서 보여지는 것 말고도 많은 event들이 있으며 그것들은 그때그때의
    필요에 의해 세팅되어 진다.
    Event trace를 하기 위한 방법에는 두 가지가 있다. 첫번째는 init.ora에 세팅
    하는 것이며 이것은 모든 세션에 영향을 미친다. 두번째 방법은 alter session
    set events 명령어를 이용하는 것이며 현재 세션에만 영향을 미친다.

    Syntax는 다음과 같다.
    Event = "event syntax | , LEVEL n | : event syntax | , LEVEL n | .. "

    sql 문장을 이용한 syntax는 다음과 같다.
    SQL> alter session set events 'event syntax LEVEL n: event syntax
    LEVEL n: ...';

    예를들어 콘트롤 화일의 전체 내용을 보기 위한 syntax는 다음과 같다.
    SQL> alter session set events 'IMMEDIATE TRACE NAME CONTROLF LEVEL 10';

    event syntax는 여러개의 키워드를 가지고 있다. 첫번째의 키워드는 event
    number이거나 special keyword, 즉 IMMEDIATE일 수 있다. Event number는
    오라클 에러 번호이거나 internal error code일 수 있다. Event code는
    그 값에 따라 action이 발생되는 커널의 logic에 의해 결정된다. 이러한 내부
    event code는 /rdbms/mesg/oraus.msg 화일에 있다. 다른 operating system에
    서는 상기 화일이 binary format이거나 text가 아닐 수 있다. Internal event
    code는 10000 - 20000의 범위에 있다.
    만약 IMMEDIATE라는 키워드가 첫번째 나온다면 이것은 unconditional event
    임을 나타낸다. 그리고 그 결과는 이 명령어가 사용된 직후 발생된다. 이러한
    명령어는 alter session 라. 명령어에서만 효과가 있고 init.ora에서 설정된
    문장은 효과가 없다.
    두번째와 세번째 키워드는 각각 대부분 TRACE와 NAME이다. TRACE라는 키워드는
    output이 trace file로 dump될 것을 의미하며 NAME이라는 키워드는 실제 event
    name 바로 앞에 온다. TRACE말고도 다른 키워드가 올 수 있으나 그것들은 오라
    클의 개발팀을 위해 사용된다. 마지막 키워드는 event name으로 실제 dump할
    내용을 정한다.
    만약 IMMEDIATE 키워드를 사용하지 않는다면 얼마나 오래동안 trace를 할지를
    지정해야 한다. FOREVER 키워드를 사용했을때에는 해당 session이나 instance가
    살아있는 시점까지 event는 살아있게 된다.
    Event 문장 다음에는 대부분의 event에서 LEVEL 키워드가 세팅된다. 만약 level
    이 없다면 errorstack을 dump하는 동안 exception이 발생할 수 있다. 일반적
    으로 LEVEL은 1에서 10까지의 범위를 갖는다. 10은 그 event에 대해서 전체
    내용을 전부 dump할 것을 의미한다.
    예를들어 LEVEL을 1로 했을때에는 control file을 dump할때 control file
    header만을 dump하지만 10이면 전체 내용을 dump한다. BLOCKDUMP키워드 일때
    에는 LEVEL은 특별한 의미를 가지며 그것은 datablock의 실제 주소가 십진수로
    표시된다.

    이제 몇개의 예를 들어 보자. 다음은 init.ora 에 세팅될 수 있는 내용이다.

    EVENT = "604 TRACE NAME ERRORSTACK FOREVER"
    EVENT = "10210 TRACE NAME CONTEXT FOREVER, LEVEL 10"

    첫번째 문장은 process가 ORA-604를 만날때마다 error stack을 dump하게 될 것
    이다. 두번째 문장은 디스크에서 캐쉬로 블록을 읽을때 block integrity를 체크
    하는 event이다.
    다음 문장들은 SQL을 통해서 event를 세팅하는 예를 보인다.

    SQL> ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME BLOCKDUMP
    LEVEL 67109037';
    SQL> ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME CONTROLF
    LEVEL 10';
    SQL> ALTER SESSION SET EVENTS 'IMMEDIATE TRACE NAME SYSTEMSTATE
    LEVEL 10';

    첫번째 문장은 데이타블록 67109037을 trace file로 dump할 것이다. 모든
    오라클 데이타베이스의 데이타블록은 block number와 file number의 유일한
    값으로 되어 있다. 상기예에서 67109037은 block number와 file number와의
    십진표현법이다. 이러한 정보는 operating system dependent하다. 두번째
    문장은 전체 콘트롤화일의 내용을 trace file로 dump한다.
    세번째 문장은 system state 를 trace로 dump한다. (system state는 현재
    RDBMS에 의해 잡혀있는 object에 대한 정보를 보여주며 process state dump는
    특정 process에 잡혀있는 object에 대한 process state dump를 보여준다)
    이러한 정보는 system hang problem과 같은 문제의 분석에 유용할 수 있다.

    EVENT NAMES
    여기서는 사용가능한 event에 대한 감각을 익히기 위해서 몇개의 event name을
    들어 설명한다.


    - ERRORSTACK
    오라클은 어떤 process가 특별한 에러를 만났을때 그에 관련된 정보를 저장하기
    위해 "error stack"을 생성한다. Oracle foreground process는 에러 메세지를
    받는다. Application 운영중에는(Developer/2000 Forms) 에러와 관련된 자세한
    정보를 foreground process는 받지 못한다.
    이 event는 전체 에러 스택을 trace로 dump해 주며 oracle error를 debugging
    하는데 유용하게 이용할 수 있다. 예를들어 application이 ora-604와 함께
    실행이 중단되면

    SQL> alter session set events '604 trace name errorstack forever';
    은 에러 스택을 trace file로 생성시켜 줄 것이다.

    - SYSTEMSTATE
    이 event는 전체 system state를 dump하며 이것은 모든 프로세스의 state dump
    를 포함한다.
    Performance degradation, process hang이나 system hang을 분석하는데 있어서
    유용하다.
    SQL> alter session set events 'immediate trace name systemstate
    level 10';

    - EVENT CODE 10013 AND 10015
    이것들은 corrupted rollback segment 문제를 분석하는데 사용될 수 있다.
    이러한 경우에 데이타베이스는 startup 할 수 없고 ora-1578에러를 발생한다.
    만약 원인이 rollback에 있는 것으로 판단됐을때 init.ora에 상기 event를 세팅
    하면 trace 화일을 생성할 것이다. syntax는 다음과 같다.
    Event = "10015 trace name context forever"

    - EVENT CODES 10210 AND 10211
    이것들은 block checking,가 event checking event들이다. 일반적으로 디스크
    블록이 캐쉬로 읽어들여질때 기본적인 integrity checking이 수행된다. 상기
    event들을 세팅하므로서 오라클은 부가적인 check을 하게되며 이것은 block
    corruption을 분석하는데 결정적이다. PMON은 항상 block checking을 가능한
    상태로 유지하고 있다. 정상적인 상태에서도 block-checking이나 index-
    checking을 수행하는 것이 좋을 수도 있으나 over head가 있다.
    Event = "10210 trace name context forever, level 10"

    - EVENT CODES 10231 AND 10232
    정전으로 인해 디스크의 한 블록 전체의 내용이 없어질 수 있다. 그런 상황에서
    그 테이블의 자료를 살려내기 위해 일반적으로 export를 받는다. 그러나 full
    table scan은 bad block을 만났을때 실패할 것이다. 이러한 상황을 피해가기
    위해 event 10231의 세팅이 필요하다. 이 event는 full table scan시
    corrupted block을 skip할 것이다. Event 10232가 세팅된다면 corrupted
    block을 trace file로 dump된다. 이러한 event를 세팅하기 위해서는 몇몇 조건
    들이 필요하다.

    . 이러한 블록은 오라클에 의해 soft-corrupted되어야 한다. 즉 오라클이
    corrupt block을 발견할 때 그 블록에 어떤 bit을 세팅하므로서 손상되었다고
    표시한다. 오라클이 soft-corrupt block을 하기 위해서는 event 10210을 세팅
    해야 한다. 그러므로 event 10210과 함께 10231이 쓰이는 것이 권장된다.
    . 인덱스를 이용하여 해당 블록을 접근하는 것은 안되며, 단지 full table
    scan만이 수행 되어야 한다. 만약 손상된 테이블을 export하려면 이러한 event
    를 init.ora에 세팅해 놓아야 한다.

    SQL> alter session set events 10231 trace name context off;
    Event = "10231 trace name context forever, level 10"
    첫번째 문장은 세션에서 lock-checking 을 더 이상 하지 않게 하며 두번째는
    block-checking을 실행하게 된다.

    Reference Documents


    <Note:1051056.6>
    <Note:21184.1>
    반응형
    Posted by [PineTree]