oracle分析工具dbms_profiler分析代码
执行前需要运行$ORACLE_HOME/rdbms/admin/proftab.sql 创建一些关键表. BEGIN DBMS_PROFILER.START_PROFILER('MY_APPLICATION'||TO_CHAR(SYSDATE,'YYYYMMDD HH24:MI:SS')); --执行程序 MY_APPLICATION_CODE; DBMS_PROFILER.END_PROFILER; END; SELECT to_char(p1.total_time/10000000,'99999999') ||'-' ||to_char(p1.total_occur) AS time_count, SUBSTR (p2.unit_owner,1,20) ||'.' ||DECODE(p2.unit_name,'','',SUBSTR(p2.unit_name,1,20)) AS unit, to_char(p1.line#)|| '-'||p3.text text FROM plsql_profiler_data p1 ,plsql_profiler_units p2 ,all_source p3 ,(SELECT SUM(total_time) AS grand_total FROM plsql_profiler_units) p4 WHERE p2.unit_owner NOT IN('SYS','SYSTEM') AND P1.RUNID=3 AND (P1.TOTAL_TIME >=P4.grand_total/100) AND P1.RUNID=P2.RUNID AND P2.UNIT_NUMBER=P1.UNIT_NUMBER AND P3.TYPE='PACKAGE BODY' AND P3.OWNER=P2.UNIT_OWNER AND p3.line=p1.line# AND p3.name=p2.unit_name ORDER BY p1.total_time DESC;
文章名称:oracle分析工具dbms_profiler分析代码
本文来源:http://cdiso.cn/article/jcscoi.html