【从翻译mos文章】正在实施的获取job的 session id
正在实施的获取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 使用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;
参考原始:
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;