728x90

공식문서

MOS 사이트 주소(Oracle과 계약된 계정 필요) : https://support.oracle.com/ 

Understanding Automatic Diagnostic Repository (Doc ID 422893.1)

 

 

기능 및 내용 설명

11g New Features RDBMS 진단을 위한 파일 기반 저장소
ADR HOME 내부에 아래 그림처럼 여러 디렉터리를 소유

 

실제 디렉터리 구성 정보

 

ADR BASE의 DEFAULT 경로 : $ORACLE_BASE

SQL>set linesize 200
SQL>set pagesize 200
SQL>col name format a23
SQL>col value format a57

SQL>show parameter diagnostic_dest
SQL>select * from v$diag_info;

 

디렉터리 별 설명

alert XML 포맷의 alert 로그가 저장
cdump 이전 버전의 core_dump_dest 에 해당하는 core_dump가 저장
hm Health Monitor가 여러 컴포넌트를 검사한 후 일부 파일을 저장
incident incident 별로 서로 다른 디렉터리에 저장
Incpkg incident 를 패키징할 때 특정 지원 파일들이 저장
Metadata alert, incident, pakage 등에 대한 metadata 저장
trace 사용자 trace 및 background trace가 alert 로그의 텍스트 버전과 함께 저장

 

Problem - Database의 Critical 에러 (예 : ORA-00600, ORA-07445, ORA-04031 등)
Incident - 각 사건 숫자 ID 를 내포하고 있는 문제의 단일 occurance.
( Problem 1 회 발생을 의미하며 ORA-00600 에러가 3 번 발생할 경우 ORA-0600 Problem 이 3 번의
Incident가 기록

 

ADRCI를 이용한 자동 로그 정리

ADR에 접속하여 관리하는 유틸리티, 쉘을 작성하여 ADRCI를 이용한 자동 로그 정리 예시

예시에서는 LISTENER와 RDBMS의 로그를 삭제, 원하는 항목을 추가하여 수행

[oracle@ol7 orcl]$ vi adrci.sh

#!/bin/bash
# Usage: PURGE [[-i  |  ] |
# [-age  [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]]]:
#
# Purpose: Purge the diagnostic data in the current ADR home. If no
# option is specified, the default purging policy will be used.
#
# Options:
# [-i id1 | id1 id2]: Users can input a single incident ID, or a
# range of incidents to purge.
#
# [-age ]: Users can specify the purging policy either to all
# the diagnostic data or the specified type. The data older than 
# ago will be purged
#
# [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]: Users can specify what type of
# data to be purged.
#
# Examples:
# purge
# purge -i 123 456
# purge -age 60 -type incident
# LISTENER (

for i in `adrci exec="show homes"|grep listener`;do
echo "adrci exec=\"set home $i;\""
adrci exec="set home $i;purge -age 1800";
done
# ADR HOME
ADR_HOME=`adrci exec="show home " | grep rdbms`
# HOME Check
# echo $ADR_HOME
adrci exec="set home $ADR_HOME;purge -age 4320 -type ALERT"
adrci exec="set home $ADR_HOME;purge -age 1080 -type TRACE

 

참고

[oracle@ol7 orcl]$ adrci

ADRCI: Release 12.2.0.1.0 - Production on Fri Apr 8 17:45:42 2022

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/app/oracle"
adrci> show homepath
ADR Homes:
diag/rdbms/orcl/orcl
adrci> show homes
ADR Homes:
diag/rdbms/orcl/orcl
adrci> set home diag/rdbms/orcl/orcl
adrci> show control
ADR Home = /app/oracle/diag/rdbms/orcl/orcl:
*************************************************************************
ADRID                SHORTP_POLICY        LONGP_POLICY         LAST_MOD_TIME                            LAST_AUTOPRG_TIME                        LAST_MANUPRG_TIME                        ADRDIR_VERSION       ADRSCHM_VERSION      ADRSCHMV_SUMMARY     ADRALERT_VERSION     CREATE_TIME
-------------------- -------------------- -------------------- ---------------------------------------- ---------------------------------------- ---------------------------------------- -------------------- -------------------- -------------------- -------------------- ----------------------------------------
1335663986           720                  8760                 2021-12-14 10:54:11.032204 +09:00        2022-04-08 10:43:27.718338 +09:00                                                 1                    2                    107                  1                    2021-12-14 10:54:11.032204 +09:00
1 row fetched

 

<grid adrci>
ADRCI(Automatic Diagnostic Repository Command Interpreter) 유틸리티는 Oracle Database 진단 데이터를 관리하는 데 사용하는 명령줄 도구입니다.

ADR_BASE= ORACLE_BASE
파라미터 조회 : show parameter diagnostic_dest 로 확인
11g부터 Background_dump_dest 및 'user_dump_dest'는 무시, 이후 모든 trace 파일이 trace 디렉토리에 저장

select * from v$diag_info;

1. oracle 계정에서 ardci입력
2. 관련 명령어
adrci>show homes    --홈경로 확인(adrci 명령어 사용 전)
adrci>show problem  --문제 확인
adrci>show incident   --
adrci>show alert       -- alert log 확인(db alert 1, listener 6 등)

 

 

 

 

# SHORTP_POLICY : trace file, core dump file .etc
# LONGP_POLICY : incident file, health monitor waring file .etc

 

 

<단위 : 시간>
adrci> set control (SHORTP_POLICY = 48) 
adrci> set control (LONGP_POLICY = 48)


# diag 디렉토리 하위 디렉터리 내의 파일 정리(경고로그 등의 *.log 파일은 정리 대상에서 제외)


디스크가 많은것 하루치 로그만 남기고 모두 삭제(60*24=1440 하루, 아래는 10일치)
adrci>purge -age 14400 -type INCIDENT   => 심각한 오류에 관련된 덤프 파일
adrci>purge -age 14400 -type ALERT        => xml 포맷의 alert log
adrci>purge -age 14400 -type TRACE       => 사용자 trace 파일 및 Alert.log
adrci>purge -age 14400 -type CDUMP      => core dump
adrci>purge -age 14400 -type HM           => Health Monitor

 

+ Recent posts