当前位置:Gxlcms > mysql > 【翻译自mos文章】得到正在运行job的sessionid

【翻译自mos文章】得到正在运行job的sessionid

时间:2021-07-01 10:21:17 帮助过:39人阅读

得到正在运行job的 session id 参考原文: How to get the session Id of the Running Job (Doc ID 1604966.1) 适用于: Oracle Database - Enterprise Edition - Version 9.2.0.8 and later Information in this document applies to any platform. 目标:

得到正在运行job的 session id

参考原文:
How to get the session Id of the Running Job (Doc ID 1604966.1)

适用于:
Oracle Database - Enterprise Edition - Version 9.2.0.8 and later
Information in this document applies to any platform.

目标:

怎么得到正在运行job的session id

--->注意:本文说的job包括 由DBMS_JOB 创建的 和 DBMS_SCHEDULER 创建的。

解决方案:

如果job 使用DBMS_JOB package创建,请使用如下语句:

set feedback off
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
set feedback on

select jr.job, s.username, s.sid, s.serial#, p.spid, s.lockwait, s.logon_time
from dba_jobs_running jr, v$session s, v$process p
where jr.sid = s.sid
and s.paddr = p.addr
order by jr.job;

如果job 使用DBMS_SCHEDULER 创建,请使用如下语句:
set feedback off
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
set feedback on

select rj.job_name, s.username, s.sid, s.serial#, p.spid, s.lockwait, s.logon_time
from dba_scheduler_running_jobs rj, v$session s, v$process p
where rj.session_id = s.sid
and s.paddr = p.addr
order by rj.job_name;

人气教程排行