54xw 发表于 2011-12-22 08:54

产生hanganalyze跟踪文件

<DIV>Metalink的对hanganalyze的描述是:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial color=#808080 size=1>When a database has a severe performance response time, the cause of the problem can be a HANG. <BR>Using HANGANALYZE trace files you can determine whether an Oracle process is blocking other processes, <BR>before starting a performance analysis. <BR><BR>Caution: HANGANALYZE run at levels higher that 3 may generate a huge number of trace files for large systems. <BR>Do not use levels higher than 3 without discussing their effects with Oracle Support.</FONT></DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV><FONT face="Courier New"></FONT>&nbsp;</DIV>
<DIV>使用eygle网站上提供的方式产生一个library cache pin:</DIV>
<DIV>&nbsp;</DIV>
<DIV>建立一个空的procedure, pinning : </DIV>
<DIV>&nbsp;</DIV>
<DIV><A href="mailto:SYS@test" target=_blank><FONT face=Arial color=#808080 size=1>SYS@test</FONT></A><FONT face=Arial color=#808080 size=1> SQL&gt; create or replace procedure pinning<BR>&nbsp; 2&nbsp; is begin<BR>&nbsp; 3&nbsp; null;<BR>&nbsp; 4&nbsp; end;<BR>&nbsp; 5&nbsp; /</FONT></DIV>
<DIV><FONT face=Arial color=#808080 size=1>Procedure created.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>建立一个procedure, calling ,调用pinning&nbsp; </DIV>
<DIV><BR><A href="mailto:SYS@test" target=_blank><FONT face=Arial color=#808080 size=1>SYS@test</FONT></A><FONT face=Arial color=#808080 size=1> SQL&gt; create or replace procedure calling<BR>&nbsp; 2&nbsp; is<BR>&nbsp; 3&nbsp; begin<BR>&nbsp; 4&nbsp; pining;<BR>&nbsp; 5&nbsp; dbms_lock.sleep(600);<BR>&nbsp; 6&nbsp; end;<BR>&nbsp; 7&nbsp; /</FONT></DIV>
<DIV><FONT face=Arial color=#808080 size=1>Procedure created.<BR></FONT></DIV>
<DIV>执行calling </DIV>
<DIV><BR><A href="mailto:SYS@test" target=_blank><FONT face=Arial size=1>SYS@test</FONT></A><FONT face=Arial size=1> SQL&gt; exec calling</FONT></DIV>
<DIV><BR><FONT face=Arial size=1>=&gt;暂停了</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>在另一个session 重建pinning </DIV>
<DIV><BR><A href="mailto:SYS@test" target=_blank><FONT face=Arial color=#808080 size=1>SYS@test</FONT></A><FONT face=Arial><FONT size=1><FONT color=#808080> SQL&gt; create or replace procedure pining<BR>&nbsp; 2&nbsp; is begin<BR>&nbsp; 3&nbsp; null;<BR>end;&nbsp; 4<BR>&nbsp; 5&nbsp; /&nbsp; =</FONT><FONT color=#808080>》这时候library cache pin就产生了</FONT></FONT></FONT> </DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial color=#808080 size=1>$ dbi sessions</FONT></DIV>
<DIV><FONT face=Arial color=#808080 size=1>&nbsp;&nbsp; SID&nbsp;&nbsp;&nbsp; SERIAL# SPID&nbsp;&nbsp;&nbsp;&nbsp; USERNAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; STATUS&nbsp;&nbsp; SQL_HASH_VALUE EVENT<BR>------ ---------- -------- --------------- -------- -------------- -------------<BR>&nbsp;&nbsp; 143&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4743 10717&nbsp;&nbsp;&nbsp; SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACTIVE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3918317640 PL/SQL lock t<BR>&nbsp;&nbsp; 142&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2407 10782&nbsp;&nbsp;&nbsp; SYS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACTIVE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 library cache<BR></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>使用oradebug来产生hanganalyze跟踪文件 ,因为测试机是单节点,所以只需这样执行 </DIV>
<DIV>&nbsp;</DIV>
<DIV><A href="mailto:SYS@test" target=_blank><FONT face=Arial color=#808080 size=1>SYS@test</FONT></A><FONT face=Arial color=#808080 size=1> SQL&gt; oradebug hanganalyze 3;<BR>Hang Analysis in /u01/app/oracle/admin/test/udump/test_ora_10875.trc<BR></FONT><A href="mailto:SYS@test" target=_blank><FONT face=Arial color=#808080 size=1>SYS@test</FONT></A><FONT face=Arial color=#808080 size=1> SQL&gt; oradebug hanganalyze 3;<BR>Hang Analysis in /u01/app/oracle/admin/test/udump/test_ora_10875.trc<BR></FONT><A href="mailto:SYS@test" target=_blank><FONT face=Arial color=#808080 size=1>SYS@test</FONT></A><FONT face=Arial color=#808080 size=1> SQL&gt; exit</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>对于产生的trace文件就要具体分析了。</DIV>
<DIV>&nbsp;</DIV>
<DIV>metalink 上的使用说明:</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial color=#808080 size=1>STEPS TO GENERATE A HANGANALYZE TRACE FILE:<BR>======================================== <BR>Use the following set of commands to generate HANGANALYZE trace files.<BR><BR><BR>1- Using SQL*Plus connect as "INTERNAL" (Oracle8i) or "/ AS SYSDBA" (Oracle9i)<BR><BR>2- Execute the following commands:<BR>&nbsp;&nbsp; SQL&gt; oradebug hanganalyze 3 <BR>&nbsp;&nbsp; ... Wait at least 1 minutes to give time to identify process state changes.<BR>&nbsp;&nbsp; SQL&gt; oradebug hanganalyze 3 <BR><BR>3- Open a separate SQL session and immediately generate a system state dump.<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ sqlplus '/ as sysdba'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oradebug setmypid<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oradebug unlimit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oradebug dump systemstate 266<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wait 90 seconds<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oradebug dump systemstate 266<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wait 90 seconds<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; oradebug dump systemstate 266<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; quit<BR><BR><BR>Note: Starting with Oracle 9.2 HANGANALYZE can generate HANGANALYZE cluster wide.<BR>Using this feature you can generate session dependencies to all the sessions <BR>connected to all the instances of the RAC cluster. Use the following set of commands <BR>to generate a RAC cluster wide HANGANALYZE:<BR><BR>1- Using SQL*Plus connect as "/ AS SYSDBA" <BR>2- Execute the following commands:<BR>&nbsp;&nbsp; SQL&gt; oradebug setmypid <BR>&nbsp;&nbsp; SQL&gt; oradebug setinst all<BR>&nbsp;&nbsp; SQL&gt; oradebug -g def hanganalyze 3<BR>&nbsp;&nbsp; ... Wait at least 1 minutes to give time to identify process state changes.<BR>&nbsp;&nbsp; SQL&gt; oradebug -g def hanganalyze 3<BR></FONT></DIV>
<DIV><FONT face=Arial color=#808080 size=1><BR>&nbsp;</DIV></FONT>
<DIV>除此之外oradebug还能做很多事情,还得好好学习一下。</DIV>
<DIV>&nbsp;</DIV>
<DIV>参考:<STRONG>Steps to generate HANGANALYZE trace files </STRONG></DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
页: [1]
查看完整版本: 产生hanganalyze跟踪文件