dbms_scheduler package系列(一)
--附上網上關於此包的資料
---建立job
SQL> begin
2 dbms_scheduler.create_job(job_name => 'job_1',job_type => 'executable',job_action => 'exp file=c:\t_exp.dmp tables=t_exp;',start_date => sysdate,repeat_interval => 'freq=daily;interval=1');
3 end;
4 /
PL/SQL procedure successfully completed
SQL> begin
2 dbms_scheduler.create_job(job_name => 'job_1',job_type => 'executable',job_action => 'exp file=c:\t_exp.dmp tables=t_exp;',start_date => sysdate,repeat_interval => 'freq=daily;interval=1');
3 end;
4 /
PL/SQL procedure successfully completed
SQL> select * from user_scheduler_jobs;
JOB_NAME JOB_SUBNAME JOB_STYLE JOB_CREATOR CLIENT_ID GLOBAL_UID PROGRAM_OWNER PROGRAM_NAME JOB_TYPE JOB_ACTION NUMBER_OF_ARGUMENTS SCHEDULE_OWNER SCHEDULE_NAME SCHEDULE_TYPE START_DATE REPEAT_INTERVAL EVENT_QUEUE_OWNER EVENT_QUEUE_NAME EVENT_QUEUE_AGENT EVENT_CONDITION EVENT_RULE FILE_WATCHER_OWNER FILE_WATCHER_NAME END_DATE JOB_CLASS ENABLED AUTO_DROP RESTARTABLE STATE JOB_PRIORITY RUN_COUNT MAX_RUNS FAILURE_COUNT MAX_FAILURES RETRY_COUNT LAST_START_DATE LAST_RUN_DURATION NEXT_RUN_DATE SCHEDULE_LIMIT MAX_RUN_DURATION LOGGING_LEVEL STOP_ON_WINDOW_CLOSE INSTANCE_STICKINESS RAISE_EVENTS SYSTEM JOB_WEIGHT NLS_ENV SOURCE NUMBER_OF_DESTINATIONS DESTINATION_OWNER DESTINATION CREDENTIAL_OWNER CREDENTIAL_NAME INSTANCE_ID DEFERRED_DROP ALLOW_RUNS_IN_RESTRICTED_MODE COMMENTS FLAGS
------------------------------ ------------------------------ ----------- ------------------------------ ---------------------------------------------------------------- -------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------- -------------------------------------------------------------------------------- ------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ----------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------- --------- ----------- --------------- ------------ ---------- ---------- ------------- ------------ ----------- -------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------- -------------------- ------------------- -------------------------------------------------------------------------------- ------ ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ ----------- ------------- ----------------------------- -------------------------------------------------------------------------------- ----------
JOB_1 REGULAR SCOTT EXECUTABLE exp file=c:\t_exp.dmp tables=t_exp; 0 CALENDAR 31-JAN-13 09.38.31.000000 PM +08:00 freq=daily;interval=1 DEFAULT_JOB_CLASS FALSE TRUE FALSE DISABLED 3 0 0 0 OFF FALSE TRUE FALSE 1 NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENC 1 FALSE FALSE 2099248
SQL> begin
2 dbms_scheduler.enable(name => 'JOB_1');
3 end;
4 /
PL/SQL procedure successfully completed
SQL> select usj.ENABLED from user_scheduler_jobs usj;
ENABLED
-------
TRUE
2 dbms_scheduler.enable(name => 'JOB_1');
3 end;
4 /
PL/SQL procedure successfully completed
SQL> select usj.ENABLED from user_scheduler_jobs usj;
ENABLED
-------
TRUE
SQL> begin
2 dbms_scheduler.run_job(job_name => 'JOB_1');
3 end;
4 /
begin
dbms_scheduler.run_job(job_name => 'JOB_1');
end;
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing job scheduler service failed with status: 2
ORA-27301: OS failure message: ????????????????
ORA-27302: failure occurred at: sjsec 6a
ORA-27303: additional information: ????????????????
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 3
---檢視scheduler機制下的job
SQL> select * from user_scheduler_jobs usj;
JOB_NAME JOB_SUBNAME JOB_STYLE JOB_CREATOR CLIENT_ID GLOBAL_UID PROGRAM_OWNER PROGRAM_NAME JOB_TYPE JOB_ACTION NUMBER_OF_ARGUMENTS SCHEDULE_OWNER SCHEDULE_NAME SCHEDULE_TYPE START_DATE REPEAT_INTERVAL EVENT_QUEUE_OWNER EVENT_QUEUE_NAME EVENT_QUEUE_AGENT EVENT_CONDITION EVENT_RULE FILE_WATCHER_OWNER FILE_WATCHER_NAME END_DATE JOB_CLASS ENABLED AUTO_DROP RESTARTABLE STATE JOB_PRIORITY RUN_COUNT MAX_RUNS FAILURE_COUNT MAX_FAILURES RETRY_COUNT LAST_START_DATE LAST_RUN_DURATION NEXT_RUN_DATE SCHEDULE_LIMIT MAX_RUN_DURATION LOGGING_LEVEL STOP_ON_WINDOW_CLOSE INSTANCE_STICKINESS RAISE_EVENTS SYSTEM JOB_WEIGHT NLS_ENV SOURCE NUMBER_OF_DESTINATIONS DESTINATION_OWNER DESTINATION CREDENTIAL_OWNER CREDENTIAL_NAME INSTANCE_ID DEFERRED_DROP ALLOW_RUNS_IN_RESTRICTED_MODE COMMENTS FLAGS
------------------------------ ------------------------------ ----------- ------------------------------ ---------------------------------------------------------------- -------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------- -------------------------------------------------------------------------------- ------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ----------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------- --------- ----------- --------------- ------------ ---------- ---------- ------------- ------------ ----------- -------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------- -------------------- ------------------- -------------------------------------------------------------------------------- ------ ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ ----------- ------------- ----------------------------- -------------------------------------------------------------------------------- ----------
JOB_1 REGULAR SCOTT EXECUTABLE exp file=c:\t_exp.dmp tables=t_exp; 0 CALENDAR 31-JAN-13 09.38.31.000000 PM +08:00 freq=daily;interval=1 DEFAULT_JOB_CLASS TRUE TRUE FALSE SCHEDULED 3 0 0 0 01-FEB-13 09.38.31.200000 PM +08:00 OFF FALSE TRUE FALSE 1 NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENC 1 FALSE FALSE 2099248
SQL> select * from user_scheduler_jobs usj;
JOB_NAME JOB_SUBNAME JOB_STYLE JOB_CREATOR CLIENT_ID GLOBAL_UID PROGRAM_OWNER PROGRAM_NAME JOB_TYPE JOB_ACTION NUMBER_OF_ARGUMENTS SCHEDULE_OWNER SCHEDULE_NAME SCHEDULE_TYPE START_DATE REPEAT_INTERVAL EVENT_QUEUE_OWNER EVENT_QUEUE_NAME EVENT_QUEUE_AGENT EVENT_CONDITION EVENT_RULE FILE_WATCHER_OWNER FILE_WATCHER_NAME END_DATE JOB_CLASS ENABLED AUTO_DROP RESTARTABLE STATE JOB_PRIORITY RUN_COUNT MAX_RUNS FAILURE_COUNT MAX_FAILURES RETRY_COUNT LAST_START_DATE LAST_RUN_DURATION NEXT_RUN_DATE SCHEDULE_LIMIT MAX_RUN_DURATION LOGGING_LEVEL STOP_ON_WINDOW_CLOSE INSTANCE_STICKINESS RAISE_EVENTS SYSTEM JOB_WEIGHT NLS_ENV SOURCE NUMBER_OF_DESTINATIONS DESTINATION_OWNER DESTINATION CREDENTIAL_OWNER CREDENTIAL_NAME INSTANCE_ID DEFERRED_DROP ALLOW_RUNS_IN_RESTRICTED_MODE COMMENTS FLAGS
------------------------------ ------------------------------ ----------- ------------------------------ ---------------------------------------------------------------- -------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------- -------------------------------------------------------------------------------- ------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ----------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------- --------- ----------- --------------- ------------ ---------- ---------- ------------- ------------ ----------- -------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- ------------- -------------------- ------------------- -------------------------------------------------------------------------------- ------ ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ ----------- ------------- ----------------------------- -------------------------------------------------------------------------------- ----------
JOB_1 REGULAR SCOTT EXECUTABLE exp file=c:\t_exp.dmp tables=t_exp; 0 CALENDAR 31-JAN-13 09.38.31.000000 PM +08:00 freq=daily;interval=1 DEFAULT_JOB_CLASS TRUE TRUE FALSE SCHEDULED 3 0 0 0 01-FEB-13 09.38.31.200000 PM +08:00 OFF FALSE TRUE FALSE 1 NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENC 1 FALSE FALSE 2099248
---檢視job的相關引數,竟無記錄,怪怪
SQL> select * from user_scheduler_job_args;
JOB_NAME ARGUMENT_NAME ARGUMENT_POSITION ARGUMENT_TYPE VALUE ANYDATA_VALUE OUT_ARGUMENT
------------------------------ ------------------------------ ----------------- ------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- ------------
SQL> select * from user_scheduler_job_args;
JOB_NAME ARGUMENT_NAME ARGUMENT_POSITION ARGUMENT_TYPE VALUE ANYDATA_VALUE OUT_ARGUMENT
------------------------------ ------------------------------ ----------------- ------------------------------------------------------------- -------------------------------------------------------------------------------- ------------- ------------
---刪除job
SQL> begin
2 dbms_scheduler.drop_job(job_name => 'JOB_1',force => true);
3 end;
4 /
PL/SQL procedure successfully completed
SQL> begin
2 dbms_scheduler.drop_job(job_name => 'JOB_1',force => true);
3 end;
4 /
PL/SQL procedure successfully completed
---查詢無值
SQL> select * from user_scheduler_jobs usj;
SQL> select * from user_scheduler_jobs usj;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-753712/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- dbms_scheduler package系列(六)Package
- dbms_scheduler package系列(五)Package
- dbms_scheduler package系列(四)Package
- dbms_scheduler package系列三Package
- dbms_scheduler package系列(二)Package
- dbms_scheduler package系列(七)-2Package
- dbms_scheduler package系列(七)-1Package
- dbms_scheduler package body INVALID 解決方案Package
- dart系列之:建立Library packageDartPackage
- Oracle DBMS_SCHEDULEROracle
- 使用PACKAGE的一點經驗Package
- not an rpm package (or package manifest):Package
- not an rpm package (or package manifest)Package
- packagePackage
- 使用oracle dbms_scheduler代替crontabOracle
- dbms_scheduler 相關資料
- Package Specification 和 Package Body 及 Package有什麼區別? (轉)Package
- 深入安卓Package Manager和Package Installer安卓Package
- Oracle定時任務dbms_schedulerOracle
- 建立packagePackage
- [手寫系列]使用axios封裝一個天氣預報的package,併發布至NPMiOS封裝PackageNPM
- Package ssh is not available, but is referred to by another package 錯誤PackageAI
- oracle排程程式作業dbms_schedulerOracle
- oracle使用DBMS_SCHEDULER排程作業Oracle
- 使用 DBMS_SCHEDULER執行外部命令
- Oracle 排程程式作業( dbms_scheduler )Oracle
- 通過dbms_scheduler執行一個外部job時出現錯誤
- ORA-04042 procedure, function, package, or package body does not existFunctionPackage
- 談一談PostgreSQL及openGauss中的packageSQLPackage
- java 包(package)JavaPackage
- alter package/procedurePackage
- Package and ClassPath (轉)Package
- Oracle Package在itpub菠菜上的一點應用OraclePackage
- 類的方法,函式,同一個package不同.py檔案,不同package不同.py檔案————呼叫問題函式Package
- flutter package get 卡FlutterPackage
- Go package time 用法GoPackage
- yum error - package is a duplicate withErrorPackage
- package.jsonPackageJSON