Oracle Series Script 3: Life-saving job processing scripts

Source: Internet
Author: User

background: The database appears to be long-term execution of the job resulting in excessive resource consumption, the following is expected to quickly locate the job, rapid intervention processing, restore database performance. Long-term operation through the following statements? T more than the database, a.

Identify the job number that is being executed and its session number
SELECT sid,job from Dba_jobs_running;

Stop execution of the job
SELECT sid,serial# from V$session WHERE sid= ' 130 ';
ALTER SYSTEM KILL SESSION ' &sid,&serial ';
EXEC Dbms_job. Broken (&job,true);

Example Analysis:
1, the query is running the job, through the query there are two, and the process is more occupied by two Oracle process compliance.
Sql> SELECT sid,job from dba_jobs_running;
SID JOB

    12        116    16        117

2. Querying information for a running job
Sql> SELECT sid,serial# from v$session WHERE sid= ' 12 ';
SID serial#

    12          4

Sql> SELECT sid,serial# from v$session WHERE sid= ' 16 ';
SID serial#

    16          1

3, use the job information that is queried to end the job
sql> ALTER SYSTEM KILL SESSION ' 12,4 ';
System altered.
sql> ALTER SYSTEM KILL SESSION ' 16,1 ';
System altered.
4, if you do not want to run the above job, you can set the job to broken.
EXEC Dbms_job. Broken (116,true);
EXEC Dbms_job. Broken (117,true);

Oracle Series Script 3: Life-saving job processing scripts

Related Article

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.