Oracle用户PID,ORA-00600:内部错误

时间:2014-08-01 11:55:55

标签: oracle pid

我需要一个返回用户PID的函数。在this thread之后,我编写了以下函数:

CREATE OR REPLACE FUNCTION SPID
RETURN SMALLINT
AS
RES SMALLINT := 0;
BEGIN
SELECT PID INTO RES FROM V$PROCESS WHERE ADDR=(SELECT PADDR FROM V$SESSION WHERE SID=(SELECT SID FROM V$SESSION WHERE AUDSID=SPID()));
RETURN RES;
END;

然而,当我尝试做

SELECT SPID() FROM DUAL;

我收到ORA-00600错误:

ORA-00600: internal error code, arguments: [KPDB-MAX_SWITCH], [], [], [], [], [], [], [], [], [], 
ORA-06512: at "RNDSUITE.SPID", line 6
...

欢迎任何补救措施。

1 个答案:

答案 0 :(得分:2)

你可以用这个pid:

select 
   pid,spid 
from 
   v$process 
where 
   ADDR=(select paddr from v$session where AUDSID=sys_context('USERENV', 'sessionid'));