eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« 使用dbms_rowid包获得rowid的详细信息 | Blog首页 | 使用触发器实现数据库级守护,防止DDL操作 »

如何获得跟踪文件名称
modb.pro

当我们使用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
       

 

你可以在这里下载以上脚本:ForUnix ForNt

 


历史上的今天...
    >> 2016-12-16文章:
    >> 2013-12-16文章:
    >> 2011-12-16文章:
    >> 2008-12-16文章:
    >> 2006-12-16文章:
    >> 2005-12-16文章:
           人生自是有情痴
           Day Day Up

By eygle on 2004-12-16 19:59 | Comments (0) | FAQ | 110 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com