How can I easily analyze an Oracle package's execution for performance issues?

两盒软妹~` 提交于 2019-12-07 07:59:01

问题


I have a pl/sql package in an 11g R2 DB that has a fair number of related procedures & functions. I execute a top level function and it does a whole lot of stuff. It is currently processing < 10 rows per second. I would like to improve the performance, but I am not sure which of the routines to focus on.

This seems like a good job for Oracle's "PL/SQL hierarchical profiler (DBMS_HPROF)" Being the lazy person that I am I was hoping that either SQLDeveloper v3.2.20.09 or Enterprise Manager would be able do what I want with a point & click interface. I cannot find this.

Is there an "easy" way to analyze the actual PL/SQL code in a procedure/package?

I have optimized the queries in the package using the "Top Activity" section of Enterprise Manager, looking at all of the queries that were taking a long time. Now all I have is a single "Execute PL/SQL" showing up, and I need to break that down into at least the procedures & functions that are called, and what percentage of the time they are taking.


回答1:


The PL/SQL Hierarchical Profiler, documented here, is actually very easy to run, assuming that you have the necessary privileges.

Basically you just need to run a PL/SQL block like this:

begin
   dbms_hprof.start_profiling('PLSHPROF_DIR', 'test.trc');
   your_top_level_procedure;
   dbms_hprof.stop_profiling;
end;

The plshprof utility will generate HTML reports from the raw profiler output file (test.trc in the example above).



来源:https://stackoverflow.com/questions/19771192/how-can-i-easily-analyze-an-oracle-packages-execution-for-performance-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!