티스토리 툴바


ORACLE/TUNING2012/03/08 11:22





DBA 계정으로 sqlplus 로그인하여 실행
 
(성능통계 수집 기간 및 보관주기 보기)

select snap_interval, retention from dba_hist_wr_control;

 

(20분 간격으로 2일보관주기로 변경)

begin

   dbms_workload_repository.modify_snapshot_settings (

      interval => 20,

      retention => 2*24*60

   );

end;


* AWR snapshot 생성 (시작과 종료시 아래 처럼 실행)
- 1노드에 대해서 snapshot 됨
execute dbms_workload_repository.create_snapshot;
 
- 전체 노드에 대해서 snapshot 됨
exec sys.dbms_workload_repository.create_snapshot('ALL');
 
 
* report 출력시 (해당 결과파일 local로 받아서 *.html형식으로)
$ORACLE_HOME/rdbms/admin/awrrpt.sql 수행
   실행시 입력 값
   Enter value for report_type: text     << text format 으로 보고서 생성
   Enter value for num_days: 1  << 최근 하루 동안의 snap 조회
   Enter value for end_snap: 1271   << 09:08 ~ 14:00 구간에 대한 조회 요청
   Enter value for report_name: awrrpt_1_1266_1271.txt  << 보고서 이름 지정
 
 
* 분석 point

1.  Load Profile 분석
Snap 구간 동안의 DBMS 성능 통계를 보여준다. 기본적인 DBMS 성능의 Baseline을 제공한다.
초당 Transactions  및 SQL 호출 수 등을 통해 DBMS의 Activity 를 분석한다.
 
2.  메모리 성능 분석
Shared Pool 및 Buffer Cache의 Hit Rate 등 메모리 활용의 적절성을 분석한다.
 
3.  이벤트 분석
CPU time이 높은 비율로 유지되어야 하며 기타 I/O 를 위한 Wait이나 Lock 발생여부를 분석한다.
 
4.  TOP SQL 분석
SQL ordered by Gets 항목 분석을 통해 I/O를 많이 유발하는 Bad SQL을 찾아서 튜닝한다
==============================================================================================
==============================================================================================
Knowledge 등록 건 (LGCNS 공공 DA 김승철 차장) ==========================================================
 
오라클10g의 AWR기능을 활용하면 튜닝에 필요한 많은 정보를 얻을 수 있다.
MMON 백그라운드 프로세스와 여러 개의 슬레이브 프로세스를 통해 자동으로 매 시간마다 스냅샷 정보를 수집한다.
수집된 데이타는 7일 후 자동으로 삭제된다. 스냅샷 주기와 보관 주기는 사용자에 의해 설정 가능하다.

1. AWRRPT에서 SNAP_ID와 SQL_ID로 바인드 변수 찾기
   -------------------------------------------------

   1.1 awrrpt의 레포트파일의 SNAP_ID 및 SQL_ID를 활용
         SQL> select *
                from dba_hist_sqlbind
               where SNAP_ID=2099
                 and SQL_ID='92rpbbrrb3bqj';

         SQL> select *
                from dba_hist_sqlbind
               where SNAP_ID between 18797 and 18814  -- between [Begin Snap] and [End Snap]
                 and SQL_ID='1g8h29fbpv5yu';

   1.2 SQL_ID알고 최근 SNAP_ID를 구하여 활용 
        SQL> select max(SNAP_ID) from dba_hist_sqlbind where SQL_ID='92rpbbrrb3bqj';
                 2099

        SQL> select *
               from dba_hist_sqlbind
              where SNAP_ID=2099
                and SQL_ID='92rpbbrrb3bqj';


2. 실행중인 SQL을 SID로 찾아 PLAN 보기
   ------------------------------------

   SQL> select 'select * from TABLE(dbms_xplan.display_cursor('''||sql_id||''','||SQL_CHILD_NUMBER||')) ;'
          from  v$session 
         where  sid = 4194;

   결과 : select * from TABLE(dbms_xplan.display_cursor('bqxzbkrtt26gj',0)) ; 

   -- 결과를 실행
   SQL> select * from TABLE(dbms_xplan.display_cursor('bqxzbkrtt26gj',0)) ;                                       


3. V$SESSION의 SQL_HASH_VALUE로 SQL 찾기
   --------------------------------------------

   SQL> select sql_text
          from v$sqltext
         where hash_value = 2555467871
         order by piece;


4. /*+ gather_plan_statistics */ 힌트와 dbms_xplan.display_cursor 패키지를 이용한 플랜보기
   ---------------------------------------------------------------------------------------

   - statistics_level = all 인 경우에는 Hint 불필요
   - SQL 실행 시 Row Source 레벨의 통계 정보 수집
   - E-Rows(예측 Row 수)와 A-Rows(실제 Row 수)의 비교를 통해 통계정보의 오류를 파악할 수 있음
   - Optimizer가 얼마나 합리적인 실행 계획을 세우느냐는 Cardinality, 즉 예상 Row수의 정확성에 달려 있음

   SQL> select /*+ gather_plan_statistics */ * from tb_test where id < 1000;
   또는
   SQL> alter session statistics_level = ALL;
   SQL> select * from tb_test where id < 1000; 

   SQL> select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));
   ---------------------------------------------------------------------------------------------------------
   | Id  | Operation                   | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
   ---------------------------------------------------------------------------------------------------------
   |   1 |  TABLE ACCESS BY INDEX ROWID|  TB_TEST        |      1 |      1 |   1000 |00:00:00.01 |     140 |
   |*  2 |   INDEX RANGE SCAN          |  TB_TEST_IDX    |      1 |      1 |   1000 |00:00:00.01 |      70 |
               :
   - 주요 항목 설명
     . E-Rows: 예측 Row 수
     . A-Rows: 실제 Row 수
     . A-Time: 실제 소요 시간
     . Buffers: Logical Reads

참고) dbms_xplan.display_cursor(sql_id, child_number, format)의 format 종류
   - Basic
   - Typical
   - Outline
   - All
   - Advanced
   * allstats last
   * +peeked_binds : 예) dbms_xplan.display_cursor(null,null,'ALLSTATS LAST +peeked_binds');


5. 스냅샷 직접 생성(수동)
   ---------------------

    SQL> execute dbms_workload_repository.create_snapshot;

    SQL> SELECT snap_id, begin_interval_time begin, end_interval_time end FROM SYS.DBA_HIST_SNAPSHOT;

    SQL> SELECT snap_id, startup_time FROM dba_hist_snapshot ORDER BY 1,2;

             SNAP_ID    STARTUP_TIME
             ---------- --------------------
             10         2007/12/19 10:27:32.000 <-- 삭제할 첫번째 스냅샷
             11         2007/12/19 10:27:32.000
             12         2007/12/19 10:27:32.000
             13         2007/12/19 10:27:32.000
             14         2007/12/19 10:27:32.000
             15         2007/12/19 10:27:32.000 <-- 삭제할 마지막 스냅샷
             16         2007/12/19 10:27:32.000
             17         2007/12/19 10:27:32.000

             12 rows selected.


6. SNAP_ID 범위 지정하여 삭제
   --------------------------

    SQL> exec dbms_workload_repository.drop_snapshot_range(10, 15);


7. AWR 스냅샷 주기와 보관 주기 설정
   --------------------------------

   1] 스냅샷주기(1시간,default) 및 보관주기(7일,default) 조회
       SQL> SELECT snap_interval , retention FROM dba_hist_wr_control;
            SNAP_INTERVAL              RETENTION 
            -------------------------- ---------------------------
            +00000 01:00:00.0          +00007 00:00:00.0 

   2] 스냅샷주기(10분) 및 보관주기(15일)을 변경
       SQL> execute DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS
                                                  (interval  => 10,        -- 분단위
                                                   retention => 15*24*60); -- 15일

   3] 스냅샷주기(10분) 및 보관주기(15일) 조회
       SQL> SELECT snap_interval , retention FROM dba_hist_wr_control;
            SNAP_INTERVAL              RETENTION 
            -------------------------- ---------------------------
            +00000 00:10:00.0          +00015 00:00:00.0

8. AWR Report 생성
   ----------------

   과거의 DB의 상태를 awrrpt를 이용하여 확인할 수 있다.

   SQL> connect / as sysdba

   SQL> @?/rdbms/admin/awrrpt.sql 실행

            :

   Enter value for report_type: html 입력

            :

   Enter value for num_days: 8 입력

   Listing the last 8 days of Completed Snapshots

                                                                                    Snap
   Instance     DB Name        Snap Id    Snap Started         Level
   ------------ ------------ --------- ------------------ -----
   DB_SID       DB_NAME       20159 01 Aug 2008 00:00         1
                                          20160 01 Aug 2008 01:00      1
                                          20161 01 Aug 2008 02:00      1
                                          20162 01 Aug 2008 03:00      1
                                          20163 01 Aug 2008 04:00      1
                                          20164 01 Aug 2008 05:00      1
                                          20165 01 Aug 2008 06:00      1
                                          20166 01 Aug 2008 07:00      1
                                          20167 01 Aug 2008 08:00      1
                                          20168 01 Aug 2008 09:00      1
                                               :

                                          20333 08 Aug 2008 06:00      1
                                          20334 08 Aug 2008 07:00      1
                                          20335 08 Aug 2008 08:00      1
                                          20336 08 Aug 2008 09:00      1  --- begin
                                          20337 08 Aug 2008 10:00      1
                                          20338 08 Aug 2008 11:00      1
                                          20339 08 Aug 2008 12:00      1  --- end
                                          20340 08 Aug 2008 13:00      1
                                          20341 08 Aug 2008 14:00      1
                                          20342 08 Aug 2008 15:00      1

   Enter value for begin_snap: 20336 입력 --- begin

   Enter value for end_snap   : 20339 입력  --- end


   Enter value for report_name: awrrpt_20080808_09-12_DB_SID.html 입력

    awrrpt_20080808_09-12_DB_SID.html 파일을 ftp로 pc로 다운로드 받은 후
   열어서 SQL ordered by Elapsed Time 항목 등을 확인해 보시면 된다.

저작자 표시 비영리
Posted by [PineTree]
TAG AWR, oracle
ORACLE/TUNING2012/03/08 11:21





16:25:06  > !cat sqlbind.sql

set lines 150 pages 50 verif off trimspool on
col VAR_NAME form A18
col TYPE_VALUE form A30
col sess_param  form A80

-- 20080506  jailee

accept sql_id      prompt 'Please enter the value for Sql_id : '

 

select *
from (select decode(no,1,'VAR ','exec :')||replace(name,':','') VAR_NAME,decode(no,1,datatype_string, ' := '||''''||value_string||''';') TYPE_VALUE
      from v$sql_bind_capture b
          ,(select 1 no from dual union all select 2 from dual) t
      where sql_id = '&sql_id'
      order by 1,2
     )
union all
select '--DBA_HIST_SQLBIND','' from dual
union all
select *
from (select decode(no,1,'VAR ','exec :')||replace(name,':',''),decode(no,1,datatype_string, ' := '||''''||value_string||''';')
      from DBA_HIST_SQLBIND b
          ,(select 1 no from dual union all select 2 from dual) t
      where  dbid = (select dbid from v$database)
      and sql_id = '&&sql_id'
      and (snap_id , dbid) = (select max(snap_id) , max(b.dbid)
                              from DBA_HIST_SQLBIND, (select dbid from v$database )  b
                              where sql_id =  '&&sql_id')
      order by b.snap_id,1,2
     )
;

select --SQL_ID,
       CHILD_ADDRESS,isdefault,'"'||NAME||'" = '||value||' ;' sess_param
from v$sql_optimizer_env b
where sql_id = '&&sql_id'
--and isdefault = 'NO'
order by isdefault,name
;

 

16:26:10 > @sqlbind
Please enter the value for Sql_id : 55ynxfrzdhzhw

VAR_NAME           TYPE_VALUE
------------------ ------------------------------
VAR B1             CHAR(32)
VAR B2             CHAR(32)
VAR B3             CHAR(32)
VAR B4             CHAR(32)
exec :B1            := '001';
exec :B2            := '2008-05-01';
exec :B3            := '2008-05-02';
exec :B4            := '107983481   ';
--DBA_HIST_SQLBIND
VAR B1             CHAR(32)
VAR B2             CHAR(32)
VAR B3             CHAR(32)
VAR B4             CHAR(32)
exec :B1            := '001';
exec :B2            := '2008-05-01';
exec :B3            := '2008-05-02';
exec :B4            := '107981134   ';

19 rows selected.

Elapsed: 00:00:00.55

CHILD_ADDRESS    ISD SESS_PARAM
---------------- --- --------------------------------------------------------------------------------
C00000076A201F58 NO  "_b_tree_bitmap_plans" = false ;
C00000076A201F58 NO  "_bloom_filter_enabled" = false ;
C00000076A201F58 NO  "_db_file_optimizer_read_count" = 128 ;
C00000076A201F58 NO  "_gby_hash_aggregation_enabled" = false ;
C00000076A201F58 NO  "_index_join_enabled" = false ;
C00000076A201F58 NO  "_optimizer_compute_index_stats" = false ;
C00000076A201F58 NO  "_optimizer_sortmerge_join_enabled" = false ;
C00000076A201F58 NO  "_pga_max_size" = 2097152 KB ;
C00000076A201F58 NO  "optimizer_secure_view_merging" = false ;
C00000076A201F58 NO  "sort_area_size" = 2147483647 ;
C00000076A201F58 YES "active_instance_count" = 3 ;
C00000076A201F58 YES "bitmap_merge_area_size" = 1048576 ;
C00000076A201F58 YES "cpu_count" = 14 ;
C00000076A201F58 YES "cursor_sharing" = exact ;
C00000076A201F58 YES "hash_area_size" = -2 ;
C00000076A201F58 YES "optimizer_dynamic_sampling" = 2 ;
C00000076A201F58 YES "optimizer_features_enable" = 10.2.0.3 ;
C00000076A201F58 YES "optimizer_index_caching" = 0 ;
C00000076A201F58 YES "optimizer_index_cost_adj" = 100 ;
C00000076A201F58 YES "optimizer_mode" = all_rows ;
C00000076A201F58 YES "parallel_ddl_mode" = enabled ;
C00000076A201F58 YES "parallel_dml_mode" = disabled ;
C00000076A201F58 YES "parallel_execution_enabled" = true ;
C00000076A201F58 YES "parallel_query_mode" = enabled ;
C00000076A201F58 YES "parallel_threads_per_cpu" = 2 ;
C00000076A201F58 YES "pga_aggregate_target" = 51200000 KB ;
C00000076A201F58 YES "query_rewrite_enabled" = true ;
C00000076A201F58 YES "query_rewrite_integrity" = enforced ;
C00000076A201F58 YES "skip_unusable_indexes" = true ;
C00000076A201F58 YES "sort_area_retained_size" = 0 ;
C00000076A201F58 YES "star_transformation_enabled" = false ;
C00000076A201F58 YES "statistics_level" = typical ;
C00000076A201F58 YES "workarea_size_policy" = auto ;

select * from table(dbms_xplan.display_awr('803b7z0t84sp7', NULL, NULL, 'basic rows bytes cost'));

저작자 표시 비영리
Posted by [PineTree]
ORACLE/TUNING2012/03/08 11:17





-- SQL 튜닝 대상선정(10g)하기
select trunc(a.disk_reads/a.executions,0) diskreads,
       trunc(a.buffer_gets/a.executions,0) bufferget, 
       trunc(a.elapsed_time/a.executions/1000000,0) elapsetime,
       trunc(a.ROWS_PROCESSED/a.executions,0) return_rows,
       a.executions,
       a.last_load_time,
       module,action, length(sql_fulltext), sql_fulltext, address,sql_id,parsing_schema_name
  from v$sql  a 
 where executions > 0
   and command_type in ( 3, 6,7)
   and module not in ( 'SQL Developer','Orange for ORACLE DBA')
   and buffer_gets / executions > 1000
 order by elapsetime desc ;
    
command_type - 2 (insert)
command_type - 3 (select)
command_type - 7 (delete)
command_type - 6 (update)
  
-- bind 변수 확인
select * from v$sql_bind_capture where address = 'C000000095EFDDC0';
select * from dba_hist_sqlbind where sql_id = '0b5b05k3akd1w'  order by snap_id desc, position;
  
-- full text
select 'AA'||sql_text||'BB' from  v$sqltext_with_newlines where address = 'C000000095EFDDC0'
 order by Piece
select 'AA'||sql_text||'BB' from  v$sqltext_with_newlines where sql_id = 'gzcf51wp0pqxt' 
order by Piece
  
-- plan보기
select p.plan_table_output
  from (select distinct sql_id, child_number
          from v$sql_plan s
         where s.address = '' or 
               s.sql_id = '0as4u6a4fky2n') s,
        table(dbms_xplan.display_cursor (s.sql_id, s.child_number, 'typical')) p;
  
--  awr plan보기
select sql_id,lpad(' ',depth*4,'  ')||' '||operation|| ' ' ||options|| ' '
 ||object_name|| ' (' ||cost||')'plan, to_char(timestamp,'YYYY-MM-DD HH24:MI:SS') as "date"
   from DBA_HIST_SQL_PLAN 
where sql_id in ('fac0jhjuwg9k9'
order by timestamp,sql_id,plan_hash_value, id;
  
-- awr 성능 보기
select sql_id, module, b.begin_interval_time,
       trunc(buffer_gets_delta/decode(executions_delta,0,1,executions_delta)) buffer_gets,
       trunc(disk_reads_delta/decode(executions_delta,0,1,executions_delta)) disk_reads,
       trunc(fetches_delta/decode(executions_delta,0,1,executions_delta)) fetchs,
       trunc(ROWS_PROCESSED_DELTA/decode(executions_delta,0,1,executions_delta)) ROWS_PROCESSED,
       trunc(elapsed_time_delta/1000000/decode(executions_delta,0,1,executions_delta)) 
   as elapsed_time,
       trunc(IOWAIT_DELTA/1000000/decode(executions_delta,0,1,executions_delta)) IOWAIT,
       trunc(APWAIT_DELTA/1000000/decode(executions_delta,0,1,executions_delta)) APWAIT,
       trunc(CLWAIT_DELTA/1000000/decode(executions_delta,0,1,executions_delta)) CLWAIT,
       trunc(CCWAIT_DELTA/1000000/decode(executions_delta,0,1,executions_delta)) CCWAIT,
       executions_delta executions
 from DBA_HIST_SQLSTAT a, 
      dba_hist_snapshot b
where a.sql_id = '7rcjrfsh81jy2'
  and a.snap_id  = b.snap_id
  and a.dbid = b.dbid
  and b.instance_number = 1
  and b.begin_interval_time between to_timestamp('20110701','YYYYMMDD')
 and to_timestamp('2012','YYYY')
  order by a.snap_id;
  
-- trace를 못 뜰때?ㅋ 
select /*+ gather_plan_statistics */ * 
from SCOTT.TEST where key > 10000;
select * from table(dbms_xplan.display_cursor(null,null,'ALLSTATS LAST'));
  
dbms_xplan.display_cursor format 종류
   - Basic, Typical, Outline, All, Advanced, 
   - allstats last, +peeked_binds

저작자 표시 비영리
Posted by [PineTree]
ORACLE/TUNING2012/03/08 11:15





V$SQL BIND CAPTURE

EXEM Knowledge Base

Jump to: navigation, 찾기

목차

[숨기기]

[편집] 기본 정보

[편집] 개요

V$SQL_BIND_CAPTURE 뷰는 SQL 커서에서 Bind Variable이 사용된 경우 해당 Bind Variable의 이름과 유형, 값 등을 캡쳐한 정보를 제공한다.

[편집] 지원

10g 이상

[편집] 컬럼

이름 유형 설명
ADDRESS 8) Parent Cursor의 Address
HASH_VALUE NUMBER Parent Cursor의 Hash Value.
SQL_ID VARCHAR2(13) Unique SQL ID. V$SQL의 SQL_ID 컬럼과 조인 가능하다.
CHILD_ADDRESS 8) Child Cursor의 Address
CHILD_NUMBER NUMBER Child Cursor의 번호.
NAME VARCHAR2(30) Bind Variable의 이름. 예: :name
POSITION NUMBER SQL 문장에서 Bind Variable의 위치. 1부터 시작한다.
DUP_POSITION NUMBER Bind Variable의 이름이 중복되는 경우 최초 Bind Variable의 위치를 가리킨다.
DATATYPE NUMBER Bind Variable의 데이터 유형. 오라클 내부적으로 사용되는 숫자값이다.
DATATYPE_STRING VARCHAR2(15) Bind Variable의 데이터 유형에 대한 인식 가능한 이름. 예:NUMBER, VARCHAR2
CHARACTER_SID NUMBER National character set identifier
PRECISION NUMBER Precision (for numeric binds)
SCALE NUMBER Scale (for numeric binds)
MAX_LENGTH NUMBER 최대 Bind 길이
WAS_CAPTURED VARCHAR2(3) Bind 값에 대한 Capture가 이루어졌는지의 여부 (YES) 또는 (NO)
LAST_CAPTURED DATE Bind 값에 대한 Capture가 이루어진 가장 최근 시간
VALUE_STRING VARCHAR2(4000) Bind 값에 대한 String 표현
VALUE_ANYDATA ANYDATA Bind 값에 대한 Sys.AnyData에 의한 표현


[편집] 참고 사항

[편집] Bind Capture가 이루어지는 시점

Oracle은 다음과 같은 시점에 Bind Capture를 수행한다.

  • SQL 문장이 Hard Parse되는 시점에 Bind Variable이 사용되고 Bind 값이 부여된 경우
  • Bind Capture가 이루어진 이후, Bind 값이 변경된 경우. 단, 오라클의 성능상의 오버헤드를 최소화기 위해 15분 이상의 간격을 두고 Capture를 수행한다. 즉, Bind Capture된 값이 항상 최신의 값을 나타내는 것이 아니라는 것에 주의해야 한다.

[편집] Bind 값 알아내기

Oracle 10g 이전에는 특정 SQL 문장에서 사용 중인 Bind 값을 알아내고자 할 때는 Processstate Dump를 수행하거나 SQL Trace, 혹은 Audit를 수행했어야 했다. 하지만, V$SQL_BIND_CAPTURE 뷰를 사용하면 간단한 조회만으로 Bind 값을 알아낼 수 있게 되었다. 각 툴이 제공하는 값의 종류는 다음과 같이 정리할 수 있다.

  • Processstate Dump: 특정 Session(Process)가 "현재" 수행 중인 SQL 문장에서 사용되는 Bind 값의 목록
  • SQL Trace: 특정 Session이나 System 전체가 수행한 모든 SQL 문장에서 사용된 Bind 값
  • V$SQL_BIND_CAPTURE: SQL 문장별로 최근에 사용된 Bind 값
  • Audit: 특정 테이블 또는 전체 오브젝트에 대한 Select/Insert/Update/Delete에 대한 SQL 문장과 Bind 값

[편집] Bind 값의 이력

V$SQL_BIND_CAPTURE 뷰의 History 버전인 DBA_HIST_SQLBIND 뷰를 통해 과거 특정 시점에 특정 SQL 문장에서 사용된 Bind 값을 확인할 수 있다.

[편집] 예제

SQL> CREATE TABLE bind_test(id INT);
SQL> var x number;
SQL> EXEC :x := 1;
SQL> select * from bind_test where id = :x';

SQL> SELECT name, position, was_captured, 
	to_char(last_captured,'yyyy/mm/dd hh24:mi:ss'), value_string
   FROM v$sql_bind_capture
   WHERE sql_id = (SELECT sql_id FROM v$sql WHERE sql_text =
   ('select * from bind_test where id = :x')
   
NAME	POSITION	WAS_CAPTURED	LAST_CAPTURED		VALUE_STRING
----	--------	----------	--------------		------------
:X	1		YES		2007/10/13 00:16:19	1
저작자 표시 비영리
Posted by [PineTree]
ORACLE2012/03/08 11:12





저작자 표시 비영리
Posted by [PineTree]
ORACLE/ORA-ERROR2012/03/06 16:37






SELECT a.ksppinm "Parameter", b.ksppstvl "Session Value",
  2         c.ksppstvl "Instance Value"
  3    FROM x$ksppi a, x$ksppcv b, x$ksppsv c
  4   WHERE a.indx = b.indx AND a.indx = c.indx
  5         AND a.ksppinm LIKE '%kgl_large_heap%';

Parameter
--------------------------------------------------------------------------------

Session Value
--------------------------------------------------------------------------------
--------------------
Instance Value
--------------------------------------------------------------------------------
--------------------
_kgl_large_heap_warning_threshold
52428800
52428800


출처 : http://gampol.tistory.com/entry/Memory-Notification-Library-Cache-Object-loaded-into-SGA

조치방법: (다음과 같이 조치후 서버 restart)
sqlplus “/as sysdba”
alter system set "_kgl_large_heap_warning_threshold"=8388608 scope=spfile ;
shutdown immediate
startup

 
원인: (Cause 항목 참조)
해당 오류메시지는 Error 가 아닌 Warning 입니다.
이는 shared pool 영역중 libraray cache 영역의 단편화가 심해 Free Memory를 찾는데 오랜 시간이 걸릴 때 
위와 같은 오류가 발생합니다.
새로운 트랜잭션이 발생시 SQL의 파싱결과 등이 저장되는 library cache영역에 단편화로 인한 메시지로 
10g R2의 메모리 관리 메커니즘에 따른 메시지로 보시면됩니다.
 
 
=======================================================================
Applies to:
Oracle Server - Enterprise Edition - Version: 
This problem can occur on any platform.
Symptoms
The following messages are reported in alert.log after 10g Release 2 is installed.
       Memory Notification: Library Cache Object loaded into SGA
       Heap size 2294K exceeds notification threshold (2048K)
Changes
Installed / Upgraded to 10g Release 2
Cause
These are warning messages that should not cause the program
responsible for these errors to fail.  
They appear as a result of new event messaging mechanism
and memory manager in 10g Release 2. The meaning is that the
process is just spending a lot of time in finding free memory
extents during an allocate as the memory may be heavily fragmented.
Real memory messages should be ORA-403x when  a real memory allocation problem 
occurs.
Solution
In 10g we have a new undocumented parameter that sets the KGL heap size
warning threshold.   This parameter was not present in 10gR1.
Warnings are written if heap size exceeds this threshold.
   
Set  _kgl_large_heap_warning_threshold  to a reasonable high value or zero
to prevent these warning messages. Value needs to be set in bytes. 
If you want to set this to 8192 (8192 * 1024) and are using an spfile: 
(logged in as "/ as sysdba")
SQL> alter system set "_kgl_large_heap_warning_threshold"=8388608 scope=spfile ; 
SQL> shutdown immediate SQL> startup 
SQL> show parameter _kgl_large_heap_warning_threshold
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_kgl_large_heap_warning_threshold integer 8388608 
If using an "old-style" init parameter, 
Edit the init parameter file and add 
_kgl_large_heap_warning_threshold=8388608
In 10.2.0.2,  the threshold is increased to 50MB after regression tests, so this should be a reasonable and recommended value.
References

 

http://surachartopun.com/2008/07/memory-notification-library-cache.html

10.2.0.1 Annoying message "Memory Notification: Library Cache Object loaded into SGA"
Posted: March 5, 2006 by Frits Hoogland in Oracle EE, Oracle XE 
9In the 10.2.0.1 version of the oracle database a new heap checking mechanism, together with a new messaging system is introduced. 
This new mechanism reports memory allocations above a threshold in the alert.log, together with a tracefile in the udump directory.

In certain situations it can be handy to know if large allocations are being done in the sga heap (shared pool), 
but only to troubleshoot memory allocation problems (which eventually will appear as the infamous ORA-4031). 
For normal day to day work, I doubt the effectivity of these messages.

The default limit is set at 2048K. It appears normal usage can result in messages from the memory manager. 
During my last installation (with all options set default, all options installed), 
this resulted in 125 messages from the memory manager.

Oracle gives a solution on metalink in note 330239.1:
Set _kgl_large_heap_warning_threshold to a “reasonable high” value. This parameter is set in bytes, 
and oracle recommends the value 8388608 (8192K).


Wednesday, July 30, 2008
Memory Notification: Library Cache Object loaded into SGA
 
Today, I checked alert.log file. I found:

Memory Notification: Library Cache Object loaded into SGA
Heap size 9426K exceeds notification threshold (8192K)

When I found out on metalink:
These messages are report in alert.log after 10g Release 2 is installed.

Cause:

These are warning messages that should not cause the program responsible for these errors to fail. They appear as a result of new event messaging mechanism and memory manager in 10g Release 2.

The meaning is that the process is just spending a lot of time in finding free memory extents during an allocate as the memory may be heavily fragmented. Fragmentation in memory is impossible to eliminate completely, however, continued messages of large allocations in memory indicate there are tuning opportunities on the application.

The messages do not imply that an ORA-4031 is about to happen.

Solution:

In 10g we have a new undocumented parameter that sets the KGL heap size warning threshold. This parameter was not present in 10gR1. Warnings are written if heap size exceeds this threshold.

Set _kgl_large_heap_warning_threshold to a reasonable high value or zero to prevent these warning messages. Value needs to be set in bytes.

If you want to set this to 8192 (8192 * 1024) and are using an spfile:

(logged in as "/ as sysdba")

SQL> alter system set "_kgl_large_heap_warning_threshold"=10485760 scope=spfile ;

SQL> shutdown immediate

SQL> startup

SQL> show parameter _kgl_large_heap_warning_threshold

NAME TYPE VALUE

--------------------------------- ------- ------------------------------
_kgl_large_heap_warning_threshold integer 10485760

If using an "old-style" init parameter,

Edit the init parameter file and add

_kgl_large_heap_warning_threshold=10485760

 

저작자 표시 비영리
Posted by [PineTree]