使用DBMS_SUPPORT包(zt)

发表于:2007-05-26来源:作者:点击数: 标签:
From: http://www.eygle.com/faq/DBMS_SUPPORT.htm About: DBMS_SUPPORT包从Oracle7.2引入,主要功能用以提供更完整的用户session跟踪信息 DBMS_SUPPORT包从Oracle7.2引入,主要功能用以提供更完整的用户session跟踪信息 这个包可以通过运行 dbmssupp. sql 和
From:
http://www.eygle.com/faq/DBMS_SUPPORT.htm
About:
DBMS_SUPPORT包从Oracle7.2引入,主要功能用以提供更完整的用户session跟踪信息

DBMS_SUPPORT包从Oracle7.2引入,主要功能用以提供更完整的用户session跟踪信息

这个包可以通过运行 dbmssupp.sqlprvtsupp.plb 两个脚本来创建.

该脚本位于$ORACLE_HOME/rdbms/admin目录下

以下版本中都包含这些文件:

8.0.6, 8.1.7, 9.0.1, 9.2.0 and above

1.创建DBMS_SUPPORT Package


SQL> @?/rdbms/admin/dbmssupp.sql

Package created.

Package body created.

SQL> @?/rdbms/admin/prvtsupp.plb

Package body created.

2.主要函数及过程

SQL> desc dbms_support

FUNCTION MYSID RETURNS NUMBER

FUNCTION PACKAGE_VERSION RETURNS VARCHAR2

PROCEDURE START_TRACE
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
WAITS BOOLEAN IN DEFAULT
BINDS BOOLEAN IN DEFAULT

PROCEDURE START_TRACE_IN_SESSION
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
SID NUMBER IN
SERIAL NUMBER IN
WAITS BOOLEAN IN DEFAULT
BINDS BOOLEAN IN DEFAULT

PROCEDURE STOP_TRACE

PROCEDURE STOP_TRACE_IN_SESSION
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
SID NUMBER IN
SERIAL NUMBER IN

3.简单用法

 

SQL> SELECT DBMS_SUPPORT.MYSID from DUAL;

MYSID
----------
8

SQL> select dbms_support.PACKAGE_VERSION from dual;

PACKAGE_VERSION
--------------------------------------------------------------------------------
DBMS_SUPPORT Version 1.0 (17-Aug-1998) - Requires Oracle 7.2 - 8.0.5


 4.进程跟踪(跟踪当前session及其他session)

SQL> exec dbms_support.start_trace

PL/SQL procedure suclearcase/" target="_blank" >ccessfully completed.

SQL> select count(*) from dba_users;

COUNT(*)
----------
34

SQL> exec dbms_support.stop_trace;

PL/SQL procedure successfully completed.

SQL> select sid,serial#,username from v$session
2 /

SID SERIAL# USERNAME
---------- ---------- ------------------------------
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 764 SYS

8 rows selected.

SQL> exec dbms_support.start_trace_in_session(4,1);

PL/SQL procedure successfully completed.

SQL> exec dbms_support.stop_trace_in_session(4,1);

PL/SQL procedure successfully completed.


5.Trace文件

以上跟踪生成的Trace文件可以在udump目录下找到.

SQL> show parameter user_dump

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest string /opt/oracle/admin/hsjf/udump

 



原文转自:http://www.ltesting.net