[Translated from mos] Get the sessionid of the running job

Source: Internet
Author: User
To obtain the sessionid of a running job, see the original article: HowtogetthesessionIdoftheRunningJob (DocID1604966.1) applicable to: OracleDatabase

To obtain the session id of a Running job, see the original article: 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:

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.