오라클 성능 트러블슈팅의 기초 (2012년)
PGA 메모리가 비정상적으로 커지는 현상 분석 0 0 18,995

by 구루비스터디 ORA-10261 힙 메모리 분석 [2023.09.06]


PGA 메모리가 비정상적으로 커지는 현상 분석

상황가정

  • 특정 프로세스가 특정 작업을 수행할 때 PGA 메모리의 크기가 급증하고, 그로 인해 시스템 성능이 전반적으로 저하되는 현상이 종종 발생
  • PGA 메모리 크기가 임계치(500 MB) 이상이 되면 프로세스의 작업을 강제 중단 시키고, PGA 힙 덤프를 수행하도록 설정 하고 싶음
  • 위와 같은 문제가 발생하는 시간이 주로 새벽 시간이기 때문에 위의 작업을 자동화 하고 싶음


10261 진단 이벤트 : PGA의 크기가 특정 임계점을 넘어가면 ORA-600 에러 발생 시킴

ORA-10261: Limit the size of the PGA heap
Cause: the limit is one kilobyte times the level of the event. If the pga grows bigger than this signal an internal error.
Action: None


10261 진단 이벤트 데모



SQL> ------------------------------------------------------------------------------
SQL> -- 10261 diag event
SQL> -- when pga size is over 100MB, you would be hit by ORA-600 error
SQL> alter session set events '10261 trace name context forever, level 100000';

Session altered.

SQL> ------------------------------------------------------------------------------
SQL> -- with 600 error, dump heap dump at level 0x20000001
SQL> alter session set events '600 trace name heapdump level 0x20000001';

Session altered.




>> {PGA 의 크기가 임계점 초과} → {10261 이벤트에 의해 ORA-600 에러 발생} → {600 에러 진단 이벤트에 의해 PGA 힙 덤프 수행}
>> "특정 프로세스의 PGA 크기가 지나치게 커지면 PGA 힙 덤프를 수행함으로써 이 문제를 트러블슈팅할 수 있도록 하라"


10261 진단 이벤트 사례



SQL> create or replace procedure proc_array(len number)
is
  type vtable is table of varchar2(1000);
  vt vtable := vtable();
begin
  for idx in 1 .. len loop
    vt.extend;
    vt(idx) := rpad('x', 1000, 'x');
  end loop;
end;
/  2    3    4    5    6    7    8    9   10   11  

Procedure created.

SQL> alter session set events '10261 trace name context forever, level 100000';

Session altered.

SQL> alter session set events '600 trace name heapdump level 0x20000001';

Session altered.

SQL> exec proc_array(20000000);
BEGIN proc_array(20000000); END;

*
ERROR at line 1:
ORA-00600: internal error code, arguments: [723], [16424], [pga heap], [], [],
[], [], []


SQL> alter session set events '10261 trace name context off';

Session altered.

SQL> alter session set events '600 trace name context off';

Session altered.





Fri Apr 27 22:06:39 2012
Errors in file /home/owen/app/owen/diag/rdbms/orcl/orcl/incident/incdir_4945/orcl_ora_2808_i4945.trc:
ORA-00600: internal error code, arguments: [723], [82452], [pga heap], [], [], [], [], []
ORA-00600: internal error code, arguments: [723], [16424], [pga heap], [], [], [], [], []
Trace dumping is performing id=[cdmp_20120427220640]




[owen@ol5u811gr1 ~]$ more /home/owen/app/owen/diag/rdbms/orcl/orcl/incident/incdir_4945/orcl_ora_2808_i4945.trc
Dump file /home/owen/app/owen/diag/rdbms/orcl/orcl/incident/incdir_4945/orcl_ora_2808_i4945.trc
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /home/owen/app/owen/product/11.1.0/db_1
System name:	Linux
Node name:	ol5u811gr1.oracle.com
Release:	2.6.32-300.10.1.el5uek
Version:	#1 SMP Wed Feb 22 17:22:40 EST 2012
Machine:	i686
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 18
Unix process pid: 2808, image: oracle@ol5u811gr1.oracle.com (TNS V1-V3)
...
Dump continued from file: /home/owen/app/owen/diag/rdbms/orcl/orcl/trace/orcl_ora_2808.trc
ORA-00600: internal error code, arguments: [723], [16424], [pga heap], [], [], [], [], []

========= Dump for incident 4945 (ORA 600 [723]) ========
----- Beginning of Customized Incident Dump(s) -----
****** ERROR: PGA size limit exceeded: 102455604 > 102400000 *****
******************************************************
...



SQL> select * from table(tpack.heap_file_report('/home/owen/app/owen/diag/rdbms/orcl/orcl/incident/incdir_4945/orcl_ora_2808_i4945.trc'));

TYPE		     HEAP_NAME		  ITEM		       ITEM_COUNT  ITEM_SIZE  HEAP_SIZE      RATIO
-------------------- -------------------- -------------------- ---------- ---------- ---------- ----------
HEAP		     pga heap						0      95.73	  95.73        100
...
OBJECT		     pga heap		  koh-kghu call 	     4584	71.7	   95.7       74.8
OBJECT		     pga heap		  KGNFS pcontext		1	   0	   95.7 	 0
OBJECT		     pga heap		  dbgdInitEventGr		1	   0	   95.7 	 0
OBJECT		     pga heap		  Alloc environm		7	   0	   95.7 	 0
OBJECT		     pga heap		  allocate kzthsm		1	   0	   95.7 	 0
OBJECT		     pga heap		  none			     1532	23.6	   95.7       24.7
...



>> 이러한 간단한 정보도 힙 덤프 분석 없이는 얻을 수 없다.

"데이터베이스 스터디모임" 에서 2012년에 "오라클 성능 트러블슈팅의 기초 " 도서를 스터디하면서 정리한 내용 입니다.

- 강좌 URL : http://www.gurubee.net/lecture/4314

- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^

- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.

댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.
로그인 사용자만 댓글을 작성 할 수 있습니다. 로그인, 회원가입