Oracle 视图 V$DIAG_OPT_TRACE_RECORDS 官方解释,作用,如何使用详细说明
本站中文解释
视图是用来显示Oracle数据库及客户端收集的性能跟踪信息的。该视图基于Oracle数据库的$ORACLE_HOME/rdbms/trace目录下的文件,包括alert.log, listener.log, etc。数据库会自动在自己的目录下生成一系列的trace和跟踪文件,其中每个文件都代表一个不同数据库内部进程或会话 。比如$ ORACLE_HOME/rdbms/trace/ora_1772.trc代表ora_1772进程。
使用V$DIAG_OPT_TRACE_RECORDS视图,可以检查和跟踪当前连接活动。尤其是当你使用Oracle数据库时,你可以使用V$DIAG_OPT_TRACE_RECORDS查看哪些查询在你的会话运行超过一定时间,例如,你可以在V$DIAG_OPT_TRACE_RECORDS中过滤出消耗时间超过1秒的查询。
使用方法:第一个参数应该是确定要跟踪的进程ID,可以从V$PROCESS查找,第二个参数是我们要查询的时间,例如查询超过1秒的查询:
select p.sid, e.seconds_in_wait
from V$DIAG_OPT_TRACE_RECORDS p,V$SESSION_LONGOPS e
where p.event = ‘SQL*Net message from client’ and
e.sid = p.sid and
e.seconds_in_wait>1
order by p.sid;
官方英文解释
V$DIAG_OPT_TRACE_RECORDS
contains all optimizer trace event data that is present in the trace files that are part of the current Automatic Diagnostic Repository (ADR). This view also supports GV$ global views.
Column | Datatype | Description |
---|---|---|
|
|
Path to current ADR home |
|
|
Displays the name of the process trace file |
|
|
Displays the level of the trace record |
|
|
Displays the top parent level of the trace record |
|
|
Displays the type of the trace record. Possible values include:
|
|
|
Displays the timestamp when the trace record was produced |
|
|
Describes the trace record payload (contents) |
|
|
Displays the section ID / dump ID of the trace record |
|
|
Displays the section name / dump name of the trace record |
|
|
Displays the component name which produced the trace record |
|
|
Displays the operation name which produced the trace record |
|
|
Displays the name of the code file where this trace record is produced |
|
|
Displays the function which produced this trace record |
|
|
Displays the line number in the code file which produced this trace record |
|
|
Displays the operating system thread ID of the process which produced the trace record |
|
|
Displays the user session ID which generated the trace record |
|
|
Displays the user session serial number which produced the trace record |
|
|
Displays the trace record security label classification. Possible values:
|
|
|
Displays the container unique ID where the trace record was produced |
|
|
Displays the container name where the trace record was produced |
|
|
The ID of the container to which the data pertains. Possible values include:
|