(转)如何获得跟踪文件名称

当我们使用sql_trace/10046等事件进行进程跟踪时,会生成跟踪文件.跟踪文件名称由以下几部分组成:

<sid>_ora_<pid>.trc

以下脚本用户获得跟踪文件名称:

For Unix:

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.4.0 - Production on Fri Oct 8 12:08:09 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production

SQL> set echo on
SQL> @gettrcnameunix
SQL> SELECT       d.VALUE
  2         || '/'
  3         || LOWER (RTRIM (i.INSTANCE, CHR (0)))
  4         || '_ora_'
  5         || p.spid
  6         || '.trc' trace_file_name
  7    FROM (SELECT p.spid
  8            FROM v$mystat m, v$session s, v$process p
  9           WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,
10         (SELECT t.INSTANCE
11            FROM v$thread t, v$parameter v
12           WHERE v.NAME = 'thread'
13             AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,
14         (SELECT VALUE
15            FROM v$parameter
16           WHERE NAME = 'user_dump_dest') d
17  /

TRACE_FILE_NAME
--------------------------------------------------------------------------------
/opt/oracle/admin/hsbill/udump/hsbill_ora_29630.trc      
                      For Nt:




SQL> SELECT    d.VALUE
  2         || '\'
  3         || LOWER (RTRIM (i.INSTANCE, CHR (0)))
  4         || '_ora_'
  5         || p.spid
  6         || '.trc' trace_file_name
  7    FROM (SELECT p.spid
  8            FROM v$mystat m, v$session s, v$process p
  9           WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,
10         (SELECT t.INSTANCE
11            FROM v$thread t, v$parameter v
12           WHERE v.NAME = 'thread'
13             AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,
14         (SELECT VALUE
15            FROM v$parameter
16           WHERE NAME = 'user_dump_dest') d
17  /

TRACE_FILE_NAME
--------------------------------------------------------------------------------
e:\oracle\admin\eygle\udump\eygle_ora_3084.trc
      

你可能感兴趣的:((转)如何获得跟踪文件名称)