环境ebs11i 数据库9i
很奇怪的问题,apps用户无法查看profiler数据,profiler analysis下也无数据,而切换其它用户,正常显示。
第一感觉就是同义词的问题。
在使用toad profiler前,要确保一些设置。具体请参考toadworld的一篇文章。
http://www.toadworld.com/BLOGS/tabid/67/EntryId/76/Toad-for-Oracle-9-0-How-do-I-Detect-Performance-Bottlenecks-in-my-PL-SQL-Code.aspx
下面是最重要一段:
What do I need to do to set up the PL/SQL Profiler?
You first need to run Toad’s Server Side Objects Wizard which is located under the Database – Administer menu group. This will install 3 tables into a schema of your choice then verify that you have access to Oracle’s SYS.DBMS_PROFILER Package. If this Package is not installed, you need to do the following:
1. Login to Oracle through Toad as SYS.
2. Load the Oracle home>RDBMSADMINPROFLOAD.SQL script into the Editor.
3. From the SQL Editor menu, select Execute as Script (or press F5).
4. Make sure that GRANT EXECUTE on the DBMS_PROFILE package has been granted to PUBLIC or to the users that will use the profiling feature.
Once this is complete, you’ll find Toad’s PL/SQL Profiler toggle button becomes active.
在运行Toad’s Server Side Objects Wizard时,(假如你选择任何用户都可使用toad profiler)会提醒创建用户toad,然后创建三个表和一个程序包TOAD.TOAD_PROFILER,同时,为这个三个表创建owner为public的三个同义词,三个表和同义词如下:
TOAD.PLSQL_PROFILER_DATA <<->> PLSQL_PROFILER_DATA
TOAD.PLSQL_PROFILER_RUNS <<->> PLSQL_PROFILER_RUNS
TOAD.PLSQL_PROFILER_UNITS <<->> PLSQL_PROFILER_UNITS
而查看数据库,会发现系统中已存在owner为SYS的同样三个表和一个程序包SYS.DBMS_PROFILER,并且这个三个表都有owner为APPS的三个同义词,三个表和同义词如下:
SYS.PLSQL_PROFILER_DATA <<->> APPS.PLSQL_PROFILER_DATA
SYS.PLSQL_PROFILER_RUNS <<->> APPS.PLSQL_PROFILER_RUNS
SYS.PLSQL_PROFILER_UNITS <<->> APPS.PLSQL_PROFILER_UNITS
因为无法看到toad profiler运行的源代码,猜想如下:
为了达到任何用户都可使用toad profiler的目的,很可能是toad profiler从public同义词取得数据然后输出结果。当用户是APPS的时候,因为已经存在APPS同义词而导致取不到toad profiler数据。如果是这样,只需要DROP掉3个APPS同义词即可。
DROP掉3个APPS同义词后,以apps用户登录toad,toad profiler已有数据,profiler analysis下也有数据显示。
如果存在程序调用原apps同义词,则会产生问题,这里无法验证。[@more@]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9961638/viewspace-1043634/
,如需转载,请注明出处,否则将追究法律责任。