Oracle Kill 正在运行的 Job

 

转自:http://levicorp.com/2009/05/22/how-to-kill-the-running-job/

 

 

1. Check the running Job (From here you will get the SID thatrunning the Job)

SQL> SELECT * FROM DBA_JOBS_RUNNING;


2. Make Job become Broken/offline

BEGIN SYS.DBMS_IJOB.BROKEN(job#,TRUE); END;
SQL> BEGIN SYS.DBMS_IJOB.BROKEN('136451',TRUE); END;


3. Kill the Oracle’s Session

SQL> ALTER SYSTEM KILL SESSION 'sid,serial#';


4. Kill the O/S Process ID (PID)

SELECT p.spid FROM v$session s, v$process p
WHERE s.paddr = p.addr
AND s.sid = :sid;
  
For Windows, at the DOS Prompt: orakill sid spid
For UNIX at the command line> kill '9 spid
Ussually Oracle Job running with Process Name : ora_j00%


5. Check if the Job is Still Running

SQL> SELECT * FROM DBA_JOBS_RUNNING;


6. Determine the Current Number of Job Queue Processes

SQL> col value for a10
SQL> select name,value from v$parameter where name = 'job_queue_processes';


7. Alter the Job Queue to Zero

SQL> ALTER SYSTEM SET job_queue_processes = 0;
This will bring down the entire job queue processes.


8. Validate that No Processes are Using the Job Queue

SQL> SELECT * FROM DBA_JOBS_RUNNING;


9. Mark the DBMS_JOB as Not Broken

BEGIN SYS.DBMS_IJOB.BROKEN(job#,FALSE); END;


10. Alter the Job Queue to Original Value

SQL> ALTER SYSTEM SET job_queue_processes = original_value;

 

 

 

-------------------------------------------------------------------------------------------------------

Skype: tianlesoftware

Email:   tianlesoftware@gmail.com

Blog:     http://www.tianlesoftware.com

Weibo: http://weibo.com/tianlesoftware

Twitter: http://twitter.com/tianlesoftware

Facebook: http://www.facebook.com/tianlesoftware

Linkedin: http://cn.linkedin.com/in/tianlesoftware

 

 

-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----

DBA1 群:62697716(满);   DBA2 群:62697977(满)  DBA3 群:62697850(满)  

DBA 超级群:63306533(满);  DBA4 群:83829929   DBA5群: 142216823

DBA6 群:158654907    DBA7 群:172855474   DBA总群:104207940

posted @ 2012-02-16 19:55  生活不是用来挥霍的  阅读(548)  评论(0编辑  收藏  举报