[Translated from MOS] Get the session ID of the job in progress

Source: Internet
Author: User
Obtain the session ID of the job.

Reference Original:
How to get the session ID of the running job (Doc ID 1604966.1)

Applicable:
Oracle Database-Enterprise Edition-version 9.2.0.8 and later
Information in this document applies to any platform.


Objectives:

How can I obtain the session ID of a job running?

---> Note: The jobs mentioned in this article include those created by dbms_job and DBMS_Scheduler.



Solution:

If a job is created using dbms_job package, use the following statement:

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;



If the job is created using DBMS_Scheduler, use the following statement:
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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.