原文链接:
http://www.eygle.com/archives/2007/05/script_gettrcname.html
SELECT d.VALUE
|| '/'
|| LOWER (RTRIM (i.INSTANCE, CHR (0)))
|| '_ora_'
|| p.spid
|| '.trc' trace_file_name
FROM (SELECT p.spid
FROM v$mystat m, v$session s, v$process p
WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,
(SELECT t.INSTANCE
FROM v$thread t, v$parameter v
WHERE v.NAME = 'thread'
AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,
(SELECT VALUE
FROM v$parameter
WHERE NAME = 'user_dump_dest') d
/
|| '/'
|| LOWER (RTRIM (i.INSTANCE, CHR (0)))
|| '_ora_'
|| p.spid
|| '.trc' trace_file_name
FROM (SELECT p.spid
FROM v$mystat m, v$session s, v$process p
WHERE m.statistic# = 1 AND s.SID = m.SID AND p.addr = s.paddr) p,
(SELECT t.INSTANCE
FROM v$thread t, v$parameter v
WHERE v.NAME = 'thread'
AND (v.VALUE = 0 OR t.thread# = TO_NUMBER (v.VALUE))) i,
(SELECT VALUE
FROM v$parameter
WHERE NAME = 'user_dump_dest') d
/
创建文件gettrc.sql,并将以上内容保存到该文件中。拷贝到脚本目录
$ORACLE_HOME/rdbms/admin/或其他oracle用户具有读权限的目录中。
SQL> @gettrc.sql
TRACE_FILE_NAME
--------------------------------------------------------------------------------
/orahome/admin/mydata/udump/mydata_ora_12290.trc
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25264937/viewspace-694792/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25264937/viewspace-694792/