如何檢視資料庫中的job任務

楊奇龍發表於2011-02-16
在資料庫的日常維護中,會使用job來定期完成某些任務,如何檢視已經定義的job呢?我們可以透過如下語句:
SQL> col interval format a10
SQL> col log_user format a10
SQL> col segment_user format a10
SQL> col what format a40
SQL> select job,instance,interval,next_date,
  2  next_sec,failures,broken,log_user,priv_user,schema_user
  3  ,total_time,what
  4  from dba_jobs;
   JOB   INSTANCE INTERVAL   NEXT_DATE      NEXT_SEC           FAILURES B LOG_USER   PRIV_USER                      SCHEMA_USER                    TOTAL_TIME WHAT                                                                                                                                     
---------- ---------- ---------- -------------- ---------------- ---------- - ---------- ------------------------------ ------------------------------ ---------- ----------------------------------------
27   1 wk_job.nex 20-2月 -1101:00:00   N SYS  WKSYS WKSYS 0 wksys.wk_job.invoke(22,25);
                      t_time('DY0701')                 
26 1 wk_job.nex 16-2月 -11 14:00:00   0 N SYS WKSYS   WKSYS 123 wksys.wk_job.invoke(22,24);   
                      t_time('HH0001')                                               
4001 0 sysdate +  16-2月 -11 18:10:57  0 N SYS FLOWS_030000   FLOWS_030000  4 wwv_flow_cache.purge_sessions(p_purge_se8/24ss_older_then_hrs => 24);           
4002  0 sysdate +  16-2月 -11 13:51:19   0 N SYS  FLOWS_030000    FLOWS_030000  24 wwv_flow_mail.push_queue(wwv_flow_platfo10/1440 rm.get_preference('SMTP_HOST_ADDRESS'),wwv_flow_platform.get_preference('SMTP_HOST_PORT'));             
29   0 sysdate +  16-2月 -11 13:50:25  0 N SYSMAN     SYSMAN   SYSMAN 94 EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROC1/24 *S();                          
                      60)
 
SQL> desc dba_jobs
 名稱                  描述
 -------------------- -------------------------------------------------------------------------------
 JOB                   job 的識別符號                                                     
 LOG_USER             job 的擁有者                                             
 PRIV_USER            誰擁有預設許可權來應用這個job                                            
 SCHEMA_USER                                                     
 LAST_DATE             job 上一次成功執行的時間                                                      
 LAST_SEC             job 上一次成功執行的那次job 開始執行的時間                                         
 THIS_DATE            job 這次現在開始執行的時間 如沒有者為null          
 THIS_SEC             同上                                                    
 NEXT_DATE             job 下一次執行的時間                                      
 NEXT_SEC              同上
 TOTAL_TIME          程式執行的時間總量,其值與系統中同時執行的程式數有關 單位 秒
 BROKEN               如果為y ,表示終止job,即使再次到達job的執行時間時,job也執行。
 INTERVAL             一個時間函式
 FAILURES              job 失敗的次數
 WHAT                  對job的描述
 NLS_ENV               alter session parameters describing the NLS environment of the job
 MISC_ENV              a versioned raw maintained by the kernel
 INSTANCE              Instance number restricted to run the job
SQL> select job,what from dba_jobs;
       JOB WHAT                                                                     
---------- ----------------------------------------                                    
        27 wksys.wk_job.invoke(22,25);                                               
        26 wksys.wk_job.invoke(22,24);                                               
      4001 wwv_flow_cache.purge_sessions(p_purge_sess_older_then_hrs => 24);
      4002 wwv_flow_mail.push_queue(wwv_flow_platform.get_preference('SMTP_HOST_ADDRESS'),                            wwv_flow_platform.get_preference('SMTP_HOST_PORT'));
        29 EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS();                                                                                                                      

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22664653/viewspace-687373/,如需轉載,請註明出處,否則將追究法律責任。

相關文章