Connected to Oracle9i Enterprise Edition Release 9.2.0.4.0
Connected as tpdev
SQL> show user
User is "tpdev"
select a.SID, a.SERIAL#, a.USERNAME, a.OSUSER
from v$session a, v$process b
where b.SPID = '26555'
and a.PADDR = b.ADDR;
----------------------
SID SERIAL# USERNAME OSUSER
121 64286 TPDEVOPER Xiaorong.Huang
-----------------------
@gettracename.sql
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;
------------------------------------------
/home/oracle/admin/ora8/udump/ora8_ora_21909.trc
-----------
然后到服务器上查看文件,结果出现没有这个文件
[oracle@DB1 udump]$ pwd
/home/oracle/admin/ora8/udump
[oracle@DB1 udump]$ ll ora8_ora_21909.trc
ls: ora8_ora_21909.trc: No such file or directory
[oracle@DB1 udump]$
查看最新更新的文件是ora8_ora_21967.trc,部分文件内容:
/home/oracle/admin/ora8/udump/ora8_ora_21967.trc
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.4.0 - Production
ORACLE_HOME = /home/oracle/product/9.2
System name: Linux
Node name: DB1
Release: 2.4.21-20.ELsmp
Version: #1 SMP Wed Aug 18 20:46:40 EDT 2004
Machine: i686
Instance name: ora8
Redo thread mounted by this instance: 1
Oracle process number: 110
Unix process pid: 21967, image: oracle@DB1 (TNS V1-V3)
*** SESSION ID
74.48423) 2006-02-10 13:29:09.831
nls_lang:null
execute commands:
---------------
这里就出现疑问了,trace文件名有一部分是用spid的值的,我要跟踪的spid是26555,而不是21967。
[oracle@DB1 udump]$ ps -ef | grep 21967
oracle 21967 1 0 13:29 ? 00:00:00 oracleora8 (LOCAL=NO)
oracle 21969 21967 0 13:29 ? 00:00:00 oracleora8 (LOCAL=NO)
oracle 22079 21057 0 13:39 pts/1 00:00:00 grep 21967
这到底什么原因呀?
二:
还有一个问题 DBMS_SYSTEM. SET_SQL_TRACE_IN_SESSION 和exec dbms_system.set_ev 有什么区别吗?