Oracle DBMS_SCHEDULER

zhulch發表於2007-07-16

轉載

[@more@]
Oracle DBMS_SCHEDULER
Version 10.2
General Information
Source{ORACLE_HOME}/rdbms/admin/dbmssch.sql
First Available10.1

Constants
NameData TypeValue
General
logging_offPLS_INTEGER32
logging_runsPLS_INTEGER64
logging_fullPLS_INTEGER256
Raise Flag Events
job_startedPLS_INTEGER1
job_succeededPLS_INTEGER2
job_failedPLS_INTEGER4
job_brokenPLS_INTEGER8
job_completedPLS_INTEGER16
job_stoppedPLS_INTEGER32
job_sch_lim_reachedPLS_INTEGER64
job_disabledPLS_INTEGER128
job_chain_stalledPLS_INTEGER256
job_all_eventsPLS_INTEGER511
job_over_max_durPLS_INTEGER512
job_run_completedPLS_INTEGERjob_succeeded+job_failed+job_stopped;

Dependencies
ALL_SCHEDULER_CHAINSDBA_SCHEDULER_JOBS
ALL_SCHEDULER_CHAIN_RULESDBA_SCHEDULER_JOB_ARGS
ALL_SCHEDULER_CHAIN_STEPSDBA_SCHEDULER_JOB_CLASSES
ALL_SCHEDULER_GLOBAL_ATTRIBUTEDBA_SCHEDULER_JOB_LOG
ALL_SCHEDULER_JOBSDBA_SCHEDULER_JOB_RUN_DETAILS
ALL_SCHEDULER_JOB_ARGSDBA_SCHEDULER_PROGRAMS
ALL_SCHEDULER_JOB_CLASSESDBA_SCHEDULER_PROGRAM_ARGS
ALL_SCHEDULER_JOB_LOGDBA_SCHEDULER_RUNNING_CHAINS
ALL_SCHEDULER_JOB_RUN_DETAILSDBA_SCHEDULER_RUNNING_JOBS
ALL_SCHEDULER_PROGRAMSDBA_SCHEDULER_SCHEDULES
ALL_SCHEDULER_PROGRAM_ARGSDBA_SCHEDULER_WINDOWS
ALL_SCHEDULER_RUNNING_CHAINSDBA_SCHEDULER_WINDOW_DETAILS
ALL_SCHEDULER_RUNNING_JOBSDBA_SCHEDULER_WINDOW_GROUPS
ALL_SCHEDULER_SCHEDULESDBA_SCHEDULER_WINDOW_LOG
ALL_SCHEDULER_WINDOWSDBA_SCHEDULER_WINGROUP_MEMBERS
ALL_SCHEDULER_WINDOW_DETAILSDEFSCHEDULE
ALL_SCHEDULER_WINDOW_GROUPSGV_$SCHEDULER_RUNNING_JOBS
ALL_SCHEDULER_WINDOW_LOGUSER_QUEUE_SCHEDULES
ALL_SCHEDULER_WINGROUP_MEMBERSUSER_SCHEDULER_CHAINS
AQ$SCHEDULER$_EVENT_QTABUSER_SCHEDULER_CHAIN_RULES
AQ$SCHEDULER$_EVENT_QTAB_RUSER_SCHEDULER_CHAIN_STEPS
AQ$SCHEDULER$_EVENT_QTAB_SUSER_SCHEDULER_JOBS
AQ$SCHEDULER$_JOBQTABUSER_SCHEDULER_JOB_ARGS
AQ$SCHEDULER$_JOBQTAB_RUSER_SCHEDULER_JOB_LOG
AQ$SCHEDULER$_JOBQTAB_SUSER_SCHEDULER_JOB_RUN_DETAILS
AQ$_SCHEDULER$_EVENT_QTAB_FUSER_SCHEDULER_PROGRAMS
AQ$_SCHEDULER$_JOBQTAB_FUSER_SCHEDULER_PROGRAM_ARGS
DBA_QUEUE_SCHEDULESUSER_SCHEDULER_RUNNING_CHAINS
DBA_SCHEDULER_CHAINSUSER_SCHEDULER_RUNNING_JOBS
DBA_SCHEDULER_CHAIN_RULESUSER_SCHEDULER_SCHEDULES
DBA_SCHEDULER_CHAIN_STEPSV_$SCHEDULER_RUNNING_JOBS
DBA_SCHEDULER_GLOBAL_ATTRIBUTE_DEFSCHEDULE

SELECT name FROM dba_dependencies
WHERE referenced_name = 'DBMS_SCHEDULER'
UNION
SELECT referenced_name FROM dba_dependencies
WHERE name = 'DBMS_SCHEDULER';

Defined Data Types
TYPE bylist IS VARRAY (256) OF PLS_INTEGER;
NameConstantData TypeValue
YearlyConstantPLS_INTEGER

1

MonthlyConstantPLS_INTEGER2
WeeklyConstantPLS_INTEGER3
DailyConstantPLS_INTEGER4
HourlyConstantPLS_INTEGER5
MinutelyConstantPLS_INTEGER6
SecondlyConstantPLS_INTEGER7
MondayConstantINTEGER1
TuesdayConstantINTEGER2
WednesdayConstantINTEGER3
ThursdayConstantINTEGER4
FridayConstantINTEGER5
SaturdayConstantINTEGER6
SundayConstantINTEGER7

TYPE SCHEDULER$_RULE_LIST IS TABLE OF sys.schedule;
/

TYPE SCHEDULER$_STEP_TYPE_LIST IS TABLE OF sys.sch;
/

TYPE SCHEDULER$_CHAIN_LINK_LIST IS TABLE OF sys.sc;
/

TYPE SCHEDULER$_STEP_TYPE IS OBJECT (
step_name VARCHAR2(32),
step_type VARCHAR2(32));
/

TYPE RE$VARIABLE_VALUE AS OBJECT (
variable_name VARCHAR2(32),
variable_data sys.anydata)

-- For the definition of RE$NV_LIST:
SELECT dbms_metadata.get_ddl('TYPE', 'RE$NV_LIST)
FROM dual;

Execute Any ClassGRANT execute any class TO ;
GRANT execute any class TO uwclass;
Exernal JobsGRANT execute any program TO ;
GRANT execute any program TO uwclass;
System Privileges to Create External JobsGRANT create external job TO ;
GRANT create external job TO uwclass;
System Privileges to Create Internal Database JobsGRANT create job TO ;
GRANT create job TO uwclass;
System Privileges to Create Chainsdbms_rule_adm.grant_system_privilege(dbms_rule_adm.create_rule_obj, '')

dbms_rule_adm.grant_system_privilege(
dbms_rule_adm.create_rule_set_obj, '')

dbms_rule_adm.grant_system_privilege(
dbms_rule_adm.create_evaluation_context_obj, '')

BEGIN
dbms_rule_adm.grant_system_privilege(
dbms_rule_adm.create_rule_obj, 'uwclass'),
dbms_rule_adm.grant_system_privilege(
dbms_rule_adm.create_rule_set_obj, 'uwclass'),
dbms_rule_adm.grant_system_privilege(
dbms_rule_adm.create_evaluation_context_obj, 'uwclass')
END;
/

System Privileges to Create SchedulesGRANT manage scheduler TO ;
GRANT manage scheduler TO uwclass;
ADD_EVENT_QUEUE_SUBSCRIBER
Adds a user as a subscriber to the Scheduler event queue SYS.SCHEDULER$_EVENT_QUEUE, and grants the user permission to dequeue from this queue using the designated agent.dbms_scheduler.add_event_queue_subscriber(
subscriber_name IN VARCHAR2 DEFAULT NULL);
SELECT owner, name
FROM dba_queues
ORDER BY 2,1;

set linesize 121
col retention format a20

SELECT queue_table, max_retries, retry_delay, retention
FROM dba_queues
WHERE name = 'SCHEDULER$_EVENT_QUEUE';

select consumer_name
from dba_queue_subscribers
where queue_name = 'SCHEDULER$_EVENT_QUEUE';

exec dbms_scheduler.add_event_queue_subscriber('UWCLASS');

SELECT consumer_name
FROM dba_queue_subscribers
WHERE queue_name = 'SCHEDULER$_EVENT_QUEUE';

exec dbms_scheduler.remove_event_queue_subscriber('UWCLASS');

SELECT consumer_name
FROM dba_queue_subscribers
WHERE queue_name = 'SCHEDULER$_EVENT_QUEUE';
ADD_WINDOW_GROUP_MEMBER
Adds one or more windows to an existing window groupdbms_scheduler.add_window_group_member(
group_name IN VARCHAR2,
window_list IN VARCHAR2);
TBD
ALTER_CHAIN
Alters steps of a chaindbms_scheduler.alter_chain(
chain_name IN VARCHAR2,
step_name IN VARCHAR2,
attribute IN VARCHAR2,
value IN BOOLEAN);
TBD
ALTER_RUNNING_CHAIN
Alters steps of a running chain

Overload 1
dbms_scheduler.alter_running_chain(
job_name IN VARCHAR2,
step_name IN VARCHAR2,
attribute IN VARCHAR2,
value IN BOOLEAN);
TBD
Overload 2dbms_scheduler.alter_running_chain(
job_name IN VARCHAR2,
step_name IN VARCHAR2,
attribute IN VARCHAR2,
value IN VARCHAR2);
TBD
ANALYZE_CHAIN
Analyzes a chain or a list of steps and rules and outputs a list of chain dependenciesdbms_scheduler.analyze_chain(
chain_name IN VARCHAR2,
rules IN sys.scheduler$_rule_list,
steps IN sys.scheduler$_step_type_list,
step_pairs OUT sys.scheduler$_chain_link_list);
TBD
AUTO_PURGE
Purges from the logs based on class and global log_historydbms_scheduler.auto_purge;
exec dbms_scheduler.auto_purge;
CHECK_SYS_PRIVS
Internal / Undocumenteddbms_scheduler.check_sys_privs RETURN PLS_INTEGER;
conn uwclass/uwclass

SELECT dbms_scheduler.check_sys_privs
FROM dual;

conn / as sysdba

SELECT dbms_scheduler.check_sys_privs
FROM dual;
CLOSE_WINDOW
Closes an open window prematurely. A closed window means that it is no longer in effect. When a window is closed, the Scheduler will switch the resource plan to the one that was in effect outside the window or in the case of overlapping windows to another window.dbms_scheduler.close_window(window_name IN VARCHAR2);
TBD
COPY_JOB
Copy a job. The new_job will contain all the attributes of the old_job, except that it will be created disableddbms_scheduler.copy_job(old_job IN VARCHAR2, new_job IN VARCHAR2);
exec dbms_scheduler.copy_job('UW_File_Load', 'New_UW_Load');

SELECT job_name, enabled
FROM all_scheduler_jobs;

exec dbms_scheduler.drop_job('New_UW_Load', TRUE);

SELECT job_name, enabled
FROM all_scheduler_jobs;
CREATE_CALENDAR_STRING
Undocumenteddbms_scheduler.create_calendar_string(
frequency IN PLS_INTEGER,
interval IN PLS_INTEGER,
bysecond IN bylist,
byminute IN bylist,
byhour IN bylist,
byday_days IN bylist,
byday_occurrence IN bylist,
bymonthday IN bylist,
byyearday IN bylist,
byweekno IN bylist,
bymonth IN bylist,
calendar_string OUT VARCHAR2);
TBD
CREATE_CHAIN
Creates a chain. Chains are created disabled and must be enabled before use.dbms_scheduler.create_chain(
chain_name IN VARCHAR2,
rule_set_name IN VARCHAR2 DEFAULT NULL,
evaluation_interval IN INTERVAL DAY TO SECOND DEFAULT NULL,
comments IN VARCHAR2 DEFAULT NULL);
TBD
CREATE_EVENT_SCHEDULE
Create a named event scheduledbms_scheduler.create_event_schedule(
schedule_name IN VARCHAR2,
start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
event_condition IN VARCHAR2,
queue_spec IN VARCHAR2,
end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
comments IN VARCHAR2 DEFAULT NULL);
TBD - Demo 2?
CREATE_JOB
Create a job in a single call (without using an existing program or schedule).

Overload 1
dbms_scheduler.create_job(
job_name IN VARCHAR2,
job_type IN VARCHAR2,
job_action IN VARCHAR2,
number_of_arguments IN PLS_INTEGER DEFAULT 0,
start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
repeat_interval IN VARCHAR2 DEFAULT NULL,
end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
Overload 2dbms_scheduler.create_job(
job_name IN VARCHAR2,
job_type IN VARCHAR2,
job_action IN VARCHAR2,
number_of_arguments IN PLS_INTEGER DEFAULT 0,
start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
event_condition IN VARCHAR2,
queue_spec IN VARCHAR2,
end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
Create a job using an existing Program and Schedule

Overload 3
dbms_scheduler.create_job(
job_name IN VARCHAR2,
program_name IN VARCHAR2,
schedule_name IN VARCHAR2,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
Create a job using an existing Program

Overload 4
dbms_scheduler.create_job(
job_name IN VARCHAR2,
program_name IN VARCHAR2,
start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
repeat_interval IN VARCHAR2 DEFAULT NULL,
end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
Overload 5dbms_scheduler.create_job(
job_name IN VARCHAR2,
program_name IN VARCHAR2,
start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
event_condition IN VARCHAR2,
queue_spec IN VARCHAR2,
end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
Overload 6dbms_scheduler.create_job(
job_name IN VARCHAR2,
schedule_name IN VARCHAR2,
job_type IN VARCHAR2,
job_action IN VARCHAR2,
number_of_arguments IN PLS_INTEGER DEFAULT 0,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
CREATE_JOB_CLASS
Create a job classdbms_scheduler.create_job_class(
job_class_name VARCHAR2,
resource_consumer_group VARCHAR2 DEFAULT NULL,
service VARCHAR2 DEFAULT NULL,
logging_level PLS_INTEGER DEFAULT DBMS_SCHEDULER.LOGGING_RUNS,
log_history PLS_INTEGER DEFAULT NULL,
comments VARCHAR2 DEFAULT NULL);

BEGIN
dbms_resource_manager.create_consumer_group('Workers', 'Those that do
actual work');
END;
/

BEGIN
dbms_scheduler.create_job_class(
job_class_name => 'finance_jobs',
resource_consumer_group => 'Workers');
END;
/

CREATE_PROGRAM
Create a new programdbms_scheduler.create_program(
program_name IN VARCHAR2,
program_type IN VARCHAR2,
program_action IN VARCHAR2,
number_of_arguments IN PLS_INTEGER DEFAULT 0,
enabled IN BOOLEAN DEFAULT FALSE,
comments IN VARCHAR2 DEFAULT NULL);
See Scheduler Demos: Below
CREATE_SCHEDULE
Creates a scheduledbms_scheduler.create_schedule(
schedule_name IN VARCHAR2,
start_date IN TIMESTAMP WITH TIMEZONE DEFAULT NULL,
repeat_interval IN VARCHAR2,
end_date IN TIMESTAMP WITH TIMEZONE DEFAULT NULL,
comments IN VARCHAR2 DEFAULT NULL);
BEGIN
dbms_scheduler.create_schedule('embed_sched', repeat_interval =>
'FREQ=YEARLY;BYDATE=0130,0220,0725');

dbms_scheduler.create_schedule('main_sched', repeat_interval => 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=15;BYHOUR=9,17;INCLUDE=embed_sched'); END;
/

BEGIN
dbms_scheduler.create_schedule('job2_schedule', repeat_interval =>
'job1_schedule+OFFSET:15D');
END;
/

BEGIN
dbms_scheduler.create_schedule('year_start', repeat_interval=>
'FREQ=YEARLY;BYDATE=0201^SPAN:1W;BYDAY=SUN');

dbms_scheduler.create_schedule('retail_fiscal_year',
to_timestamp_tz('15-JAN-2005 12:00:00','DD-MON-YYYY HH24:MI:SS'),
'year_start,year_start+13w,year_start+26w,year_start+39w;periods=4');
END;
/

BEGIN
dbms_scheduler.create_schedule('fifth_day_off', repeat_interval =>
'FREQ=retail_fiscal_year;BYDAY=SAT,SUN;INCLUDE=holiday;
BYPERIOD=2,4;BYSETPOS=5');
END;
/

See Scheduler Demos: Below
CREATE_WINDOW
Creates a recurring time window and associates it with a resource plan. The window can then be used to schedule jobs, which run under the associated resource plan.dbms_scheduler.create_window(
window_name IN VARCHAR2,
resource_plan IN VARCHAR2,
schedule_name IN VARCHAR2,
duration IN INTERVAL DAY TO SECOND,
window_priority IN VARCHAR2 DEFAULT 'LOW',
comments IN VARCHAR2 DEFAULT NULL);

BEGIN
dbms_scheduler.create_window_group(
window_name => 'weeknights',
resource_plan => 'maint_window'
duration -> interval '90' minute,
window_priority => 'HIGH'
comments => 'Off-hours maintenance window');
END;
/

CREATE_WINDOW_GROUP
Creates a new window groupdbms_scheduler.create_window_group(
group_name IN VARCHAR2,
window_list IN VARCHAR2 DEFAULT NULL,
comments IN VARCHAR2 DEFAULT NULL);
BEGIN
dbms_scheduler.create_window_group(
group_name => 'downtime',
window_list => 'weeknights, weekends'
comments => 'Group of system maintenance windows');
END;
/
DEFINE_ANYDATA_ARGUMENT
Define an argument with a default value encapsulated in an ANYDATA data typedbms_scheduler.define_anydata_argument(
program_name IN VARCHAR2,
argument_position IN PLS_INTEGER,
argument_name IN VARCHAR2 DEFAULT NULL,
argument_type IN VARCHAR2,
default_value IN SYS.ANYDATA,
out_argument IN BOOLEAN DEFAULT FALSE);
TBD
DEFINE_CHAIN_EVENT_STEP
Adds or replaces a chain step and associates it with an inline schedule

Overload 1
dbms_scheduler.define_chain_event_step(
chain_name IN VARCHAR2,
step_name IN VARCHAR2,
event_schedule_name IN VARCHAR2,
timeout IN INTERVAL DAY TO SECOND DEFAULT NULL);
TBD
Adds or replaces a chain step and associates it with an inline event

Overload 2
dbms_scheduler.define_chain_event_step(
chain_name IN VARCHAR2,
step_name IN VARCHAR2,
event_condition IN VARCHAR2,
queue_spec IN VARCHAR2,
timeout IN INTERVAL DAY TO SECOND DEFAULT NULL);
TBD
DEFINE_CHAIN_RULE
Adds or replaces a chain ruledbms_scheduler.define_chain_rule(
chain_name IN VARCHAR2,
condition IN VARCHAR2,
action IN VARCHAR2,
rule_name IN VARCHAR2 DEFAULT NULL,
comments IN VARCHAR2 DEFAULT NULL);
TBD
DEFINE_CHAIN_STEP
Adds or replaces a chain step and associates it with a program or chaindbms_scheduler.define_chain_step(
chain_name IN VARCHAR2,
step_name IN VARCHAR2,
program_name IN VARCHAR2);
TBD
DEFINE_METADATA_ARGUMENT
Define a special metadata argument for the programdbms_scheduler.define_metadata_argument(
program_name IN VARCHAR2,
metadata_attribute IN VARCHAR2,
argument_position IN PLS_INTEGER,
argument_name IN VARCHAR2 DEFAULT NULL);
TBD
DEFINE_PROGRAM_ARGUMENT

Define an argument of a program

Overload 1
dbms_scheduler.define_program_argument(
program_name IN VARCHAR2,
argument_position IN PLS_INTEGER,
argument_name IN VARCHAR2 DEFAULT NULL,
argument_type IN VARCHAR2,
default_value IN VARCHAR2,
out_argument IN BOOLEAN DEFAULT FALSE);
See Scheduler Demos: Below
Overload 2dbms_scheduler.define_program_argument(
program_name IN VARCHAR2,
argument_position IN PLS_INTEGER,
argument_name IN VARCHAR2 DEFAULT NULL,
argument_type IN VARCHAR2,
out_argument IN BOOLEAN DEFAULT FALSE);
See Scheduler Demos: Below
DISABLE
Disable a program, chain, job, window or window_group. The procedure will NOT return an error if the object was already disabled.dbms_scheduler.disable(
name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
See Scheduler Demos: Below
DISABLE1_CALENDAR_CHECK
Undocumenteddbms_scheduler.disable1_calendar_check;
dbms_scheduler.disable1_calendar_check;
DROP_CHAIN
Drop a chaindbms_scheduler.drop_chain(
chain_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
TBD
DROP_CHAIN_RULE
Drop a chain ruledbms_scheduler.drop_chain_rule(
chain_name IN VARCHAR2,
rule_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
TBD
DROP_CHAIN_STEP
Drop a chain stepdbms_scheduler.drop_chain_step(
chain_name IN VARCHAR2,
step_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
TBD
DROP_JOB
Drop a job or several jobsdbms_scheduler.drop_job(
job_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
See Scheduler Demos: Below
DROP_JOB_CLASS
Drop a job classdbms_scheduler.drop_job_class(
job_class_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
exec dbms_scheduler.create_job_class(job_class_name, TRUE);
DROP_PROGRAM
Drops an existing program (or a comma separated list of programs)dbms_scheduler.drop_program(
program_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
See Scheduler Demo: Below
DROP_PROGRAM_ARGUMENT
Drop a program argument either by name or position

Overload 1
dbms_scheduler.drop_program_argument(
program_name IN VARCHAR2,
argument_position IN PLS_INTEGER);
See Scheduler Demos: Below
Overload 2dbms_scheduler.drop_program_argument(
program_name IN VARCHAR2,
argument_name IN VARCHAR2);
See Scheduler Demos: Below
DROP_SCHEDULE
Drop a schedule (or comma-separated list of schedules)dbms_scheduler.drop_schedule(
schedule_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
TBD - Demo2 ?
DROP_WINDOW
Drops a window. All metadata about the window is removed from the database. All references to the window are removed from window groups.dbms_scheduler.drop_window(
window_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
TBD
DROP_WINDOW_GROUP
Drops a window group but not the windows that are members of this window group.dbms_scheduler.drop_window_group(
group_name IN VARCHAR2,
force IN BOOLEAN DEFAULT FALSE);
TBD
ENABLE
Enable a program, chain, job, window or window group. The procedure will NOT return an error if the object was already enabled.dbms_scheduler.enable(name IN VARCHAR2);
See Scheduler Demos: Below
EVALUTE_CALENDAR_STRING
Get multiple steps of the repeat interval by passing the next_run_date returned by one invocation as the return_date_after argument of the next invocation of this proceduredbms_scheduler.evaluate_calendar_string(
calendar_string IN VARCHAR2,
start_date IN TIMESTAMP WITH TIME ZONE,
return_date_after IN TIMESTAMP WITH TIME ZONE,
next_run_date OUT TIMESTAMP WITH TIME ZONE);
set serveroutput on;

alter session set NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';

DECLARE
start_date TIMESTAMP;
return_date_after TIMESTAMP;
next_run_date TIMESTAMP;
BEGIN
start_date := TO_TIMESTAMP_TZ('01-JAN-2006 10:00:00','DD-MON-YYYY HH24:MI:SS');

return_date_after := start_date;
FOR i IN 1..5
LOOP
dbms_scheduler.evaluate_calendar_string(
'FREQ=DAILY;BYHOUR=9;BYMINUTE=30;BYDAY=MON,TUE,WED,THU,FRI',
start_date, return_date_after, next_run_date);

dbms_output_put_line('next_run_date: ' || next_run_date);
return_date_after := next_run_date;
END LOOP;
END;
/
EVALUTE_RUNNING_CHAIN
Forces immediate evaluation of a running chaindbms_scheduler.evaluate_running_chain(job_name IN VARCHAR2);
TBD
GENERATE_EVENT_LIST
Not documenteddbms_scheduler.generate_event_list(statusvec NUMBER) RETURN VARCHAR2
TBD
GENERATE_JOB_NAME
Returns a unique name for a jobdbms_scheduler.generate_job_name(
prefix IN VARCHAR2 DEFAULT 'JOB$_') RETURN VARCHAR2;
SELECT dbms_scheduler.generate_job_name
FROM dual;

SELECT dbms_scheduler.generate_job_name('UW')
FROM dual;
GET_ATTRIBUTE
Retrieve an attribute

Overload 1
dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT PLS_INTEGER);
TBD
Overload 2dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT BOOLEAN);
TBD
Overload 3dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT DATE);
TBD
Overload 4dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT TIMESTAMP);
TBD
Overload 5dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT TIMESTAMP WITH TIME ZONE);
TBD
Overload 6dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT TIMESTAMP WITH LOCAL TIME ZONE);
TBD
Overload 7dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT INTERVAL DAY TO SECOND);
TBD
Overload 8dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT VARCHAR2);
TBD
Overload 9dbms_scheduler.get_attribute(
name IN VARCHAR2,
attribute IN VARCHAR2,
value OUT VARCHAR2,
value2 OUT VARCHAR2);
TBD
GET_CHAIN_RULE_ACTION
Used by chain views to output rule actionsdbms_scheduler.get_chain_rule_action(action_in IN re$nv_list)
RETURN VARCHAR2;
TBD
GET_CHAIN_RULE_CONDITION
Used by chain views to output rule conditionsdbms_scheduler.get_chain_rule_condition(
action_in IN re$nv_list,
condition_in IN VARCHAR2) RETURN VARCHAR2;
TBD
GET_DEFAULT_VALUE
This accepts an attribute name and returns the default value. If the attribute is not recognized it returns NULL. If the attribute is of type BOOLEAN, it will return 'TRUE' or 'FALSE'.dbms_scheduler.get_default_value(attribute_name VARCHAR2)
RETURN VARCHAR2 ;
TBD
GET_JOB_STEP_CF
Undocumenteddbms_scheduler.get_job_step_cf (
iec VARCHAR2,
icn VARCHAR2,
vname VARCHAR2,
iev SYS.RE$NV_LIST) RETURN SYS.RE$VARIABLE_VALUE;
TBD
GET_SCHEDULER_ATTRIBUTE
Get the value of a scheduler attributedbms_scheduler.get_scheduler_attribute(
attribute IN VARCHAR2,
value OUT VARCHAR2);
See SET_SCHEDULER_ATTRIBUTE Demo: Below
GET_SYS_TIME_ZONE_NAME
Return the current timezone settingdbms_scheduler.get_sys_time_zone_name RETURN VARCHAR2
SELECT dbms_scheduler.get_sys_time_zone_name
FROM dual;
GET_VARCHAR2_VALUE
Converts SYS.ANYDATA to VARCHAR2dbms_scheduler.get_varchar2_value(a SYS.ANYDATA) RETURN VARCHAR2;
CREATE TABLE t (mycol sys.anyData);

INSERT INTO t
VALUES (sys.anyData.convertVarchar2('hello world'));

SELECT * FROM t;

SELECT dbms_scheduler.get_varchar2_value(mycol)
FROM t;
OPEN_WINDOW
Opens a window independent of its schedule. This window will open and the resource plan associated with it, will take effect immediately for the duration specified or for the normal duration of the window if no duration is given. Only an enabled window can be manually opened.dbms_scheduler_open_window(
window_name IN VARCHAR2,
duration IN INTERVAL DAY TO SECOND,
force IN BOOLEAN DEFAULT FALSE);
TBD
PURGE_LOG
Purges from the logs based on the arguments. The default is to purge all entriesdbms_scheduler.purge_log(
log_history IN PLS_INTEGER DEFAULT 0,
which_log IN VARCHAR2 DEFAULT 'JOB_AND_WINDOW_LOG',
job_name IN VARCHAR2 DEFAULT NULL);
TBD
REMOVE_EVENT_QUEUE_SUBSCRIBER
Remove subscriber from the SCHEDULER queuedbms_scheduler.remove_event_queue_subscriber(
subscriber_name IN VARCHAR2 DEFAULT NULL);
See ADD_EVENT_QUEUE_SUBSCRIBER Demo: Above
REMOVE_WINDOW_GROUP_MEMBER
Removes one or more windows from an existing window groupdbms_scheduler.remove_window_group_member(
group_name IN VARCHAR2,
window_list IN VARCHAR2);
TBD
RESET_JOB_ARGUMENT_VALUE
Clear a previously set job argument value

Overload 1
dbms_scheduler.reset_job_argument_value(
job_name IN VARCHAR2,
argument_position IN PLS_INTEGER);
exec dbms_scheduler.reset_job_argument_value('UW_File_Load', 2);
Overload 2dbms_scheduler.reset_job_argument_value(
job_name IN VARCHAR2,
argument_name IN VARCHAR2);
exec dbms_scheduler.reset_job_argument_value('UW_File_Load', 'YEARNO');
RESOLVE_CALENDAR_STRING
Undocumented

Overload 1
dbms_scheduler.resolve_calendar_string(
calendar_string IN VARCHAR2,
frequency OUT PLS_INTEGER,
interval OUT PLS_INTEGER,
calendars_used OUT BOOLEAN,
bysecond OUT scheduler$_int_array_type,
byminute OUT scheduler$_int_array_type,
byhour OUT scheduler$_int_array_type,
byday_days OUT scheduler$_int_array_type,
byday_occurrence OUT scheduler$_int_array_type,
bydate_y OUT scheduler$_int_array_type,
bydate_md OUT scheduler$_int_array_type,
bymonthday OUT scheduler$_int_array_type,
byyearday OUT scheduler$_int_array_type,
byweekno OUT scheduler$_int_array_type,
bymonth OUT scheduler$_int_array_type,
bysetpos OUT scheduler$_int_array_type);
TBD
Overload 2dbms_scheduler.resolve_calendar_string(
calendar_string IN VARCHAR2,
frequency OUT PLS_INTEGER,
interval OUT PLS_INTEGER,
bysecond OUT BYLIST,
byminute OUT BYLIST,
byhour OUT BYLIST,
byday_days OUT BYLIST,
byday_occurrence OUT BYLIST,

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

Oracle DBMS_SCHEDULER
請登入後發表評論 登入
全部評論

相關文章