ITPub博客

首页 > 数据库 > Oracle > [20170703]Oracle Call Interface Tracing

[20170703]Oracle Call Interface Tracing

原创 Oracle 作者:lfree 时间:2017-07-03 10:56:09 0 删除 编辑

[20170703]Oracle Call Interface (OCI) Tracing.txt

--//不熟悉这些东西,仅仅做一个记录.

The Oracle Call Interface (OCI) is a set of APIs which provides interaction with an Oracle database. It supports all
phases of a SQL statement execution.

If you ever wondered how to trace OCI function calls you can do it by setting EVENT_10842 environment variable.

--//例子:
set ORA_CLIENTTRACE_DIR=d:\temp
set EVENT_10842=server=all;user=all;stmt=all;level=15

--//注意:必须设置DIAG_ADR_ENABLED=off 在 sqlnet.ora中.在client还是服务端呢?

For ORA_CLIENTTRACE_DIR to take effect Automatic Diagnostic Repository (ADR) has to be disabled. You can disable it by
setting DIAG_ADR_ENABLED=off in your sqlnet.ora.

A tracefile is generated for each connection in the format of ora_skgu_<pid>.trc1 where pid is the process id of the
connection on the (client) system.
 
The following levels are supported:
1 - Trace all server attach and server detach calls for servers listed in "server" attribute of the environment
     variable.
2 - Trace all session begin, logon, session end, logoff calls for the users listed in "user" attribute of the
     environment variable.
3 - Trace all prepare, execute, fetch calls for the specified statement types listed in "stmt" attribute of environment
     variable.
4 - Trace all Bind, Define, Describe calls.
5 - Trace all OCI LOB calls
7 - Get statistical info on all connection pooling /connection related calls
8 - Get statistical info on all session info
9 - Get statistical info on all handle info
10 - Get statistical info on time taken in execute and fetch calls
11 - Get statistical info on transaction related calls
15 - Trace all calls with statistical info.

--//根据上面的信息自己测试看看:
1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.在client端执行:
R:\>set ORA_CLIENTTRACE_DIR=r:\
R:\>set EVENT_10842=server=all;user=all;stmt=all;level=15

--//登录后,执行sqlplus语句没有任何像ora_skgu_<pid>.trc1文件产生.
--//先尝试修改client的sqlnet.ora文件看看.
SCOTT@78> host ls -l r:\*.trc1
-rw-rw-rw-   1 user     group       22794 Jul  3 10:42 r:\ora_skgu_6708.trc1

--//OK,确实可以产生跟踪文件.里面一堆信息,看不懂..^_^.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2141514/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7971377