Presentation is loading. Please wait.

Presentation is loading. Please wait.

DBMS_SCHEDULER: The How, What and Why

Similar presentations


Presentation on theme: "DBMS_SCHEDULER: The How, What and Why"— Presentation transcript:

1

2 DBMS_SCHEDULER: The How, What and Why
David Hicken Flying J, Inc. Types of Users? Level of Oracle? OEM? Toad? SQL Developer? Other tools? PL/SQL and SQL experience? DBA_ view experience?

3 Oracle DBMS_SCHEDULER
Scheduling Options DBMS_Scheduler Options Breaking Down the DBMS_SCHEDULER Individual parts of the DBMS_SCHEDULER Time Driven Schedules Event Driven Schedules DBMS_JOBS to DBMS_SCHEDULER Monitoring the Scheduler Things to Look Out For Q & A

4 Oracle Scheduling Options
Cron and at in Unix and Linux Windows Scheduler DBMS_JOBS Oracle Scheduler Oracle 9i Scheduler Oracle 10g Scheduler Oracle 11g Scheduler

5 DBMS_Scheduler Options
Time Driven Schedules Flexible and Easy Event Driven Schedules Harder to set up Chaining Schedules Can be used with Time or Event

6 Breaking Down DBMS_Scheduler
Programs Schedules Jobs Job Classes Windows Window Groups Chains

7 DBMS_SCHEDULER: Programs
Stored Procedure Can pass parameters PL/SQL Block Executable Dependent upon the OS.

8

9 DBMS_SCHEDULER: Schedules
Named Schedules On the fly Can use old DBMS_JOBS scheduling syntax, or new syntax. EVALUATE_CALENDAR_STRING

10

11 DBMS_SCHEDULER Schedule words
FREQ Yearly Monthly Weekly Hourly Minutely Secondly INTERVAL Number BYMONTH BYDAY BYHOUR BYMINUTE BYSECOND BYWEEKNO BYDATE BYMONTHDAY INCLUDE ByMonth=May,Jun,Jul,Aug ByHour=0,1,2,3,4,5,6,7,17,18,19,20,21,22,23 ByDay=Mon,Tue,Wed,Thu,Fri ByWeekNo=4 ByMonthDay=3 And many others!

12 DBMS_SCHEDULER: Jobs begin dbms_scheduler.create_job (
job_name => 'HR_STATS_REFRESH', job_type => 'PLSQL_BLOCK', job_action => '- - Gather HR Stats BEGIN DBMS_STATS.GATHER_SCHEMA_STATS(''hr''); END;', start_date => systimestamp, repeat_interval => 'FREQ=DAILY';byhour=9;byminute=0, enabled => TRUE, comments => 'Refreshes the HR Schema at 9:00 PM' ); end; /

13

14

15

16 DBMS_SCHEDULER: Job Classes
Create Job Class to group jobs Assign Resources to Job Class Control Jobs according to Class Start and Stop a group of jobs Set Priorities for a Job Class

17

18 DBMS_SCHEDULER: Windows
Caution: Windows are NOT schedules Only one window open at a time When windows conflict, Priority and “First Open” Stop on Window Close Force Windows to Open and/or Close

19

20 DBMS_SCHEDULER: Window Groups
Combine Windows Weeknights Weekends MAINTENANCE_WINDOW

21

22 DBMS_SCHEDULER: Event Driven Schedules
Requires Advanced Queuing Defined Events More advanced than this class ....

23 DBMS_SCHEDULER Events
JOB_STARTED JOB_SUCCEEDED JOB_FAILED JOB_BROKEN JOB_COMPLETED JOB_STOPPED JOB_SCH_LIM_REA CHED JOB_DISABLED JOB_CHAIN_STALL ED JOB_OVER_MAX_D URATION Events raised by applications

24 DBMS_SCHEDULER: Chains
Can be Time Driven or Event Driven Define Programs Define Steps A program Another chain (nested chain) An Event

25

26 Monitoring and Managing the Scheduler
Oracle Enterprise Manager Straight forward, but many screens deep Toad Implemented poorly in current versions, but next version (Toad 10) is greatly improved DBA_ Views

27

28

29

30 Scheduler DBA_ Views DBA_SCHEDULER_JOBS DBA_SCHEDULER_PROGRAM_A RGS
DBA_SCHEDULER_WINGROUP_ MEMBERS DBA_SCHEDULER_SCHEDULES DBA_SCHEDULER_WINDOWS DBA_SCHEDULER_JOB_RUN_DE TAILS DBA_SCHEDULER_WINDOW_DET AILS DBA_SCHEDULER_RUNNING_JO BS DBA_SCHEDULER_CHAIN_STEPS DBA_QUEUE_SCHEDULES DBA_SCHEDULER_JOB_ARGS DBA_SCHEDULER_WINDOW_LO GDBA_SCHEDULER_RUNNING_C HAINS DBA_SCHEDULER_GLOBAL_ATT RIBUTE DBA_SCHEDULER_WINDOW_GR OUPS DBA_SCHEDULER_PROGRAMS DBA_SCHEDULER_JOB_CLASSE S DBA_SCHEDULER_JOB_LOG DBA_SCHEDULER_CHAIN_RULE S DBA_SCHEDULER_CHAINS

31

32 Things to Watch for... OEM has trouble defining schedules
Toad's implementation is poor Bug in creating programs. Test run script first Uses TIMESTAMP, which has a bug prior to Makes it hard to see when schedules fire Some of the DBA_ views may require some “tweaking” due to above bug ALTER SYSTEM SET job_queue_processes=0; doesn't stop schedules!

33 DBMS_Scheduler vs. DBMS_Jobs
More versatile scheduling Scheduling syntax is readable Event driven ability Chaining ability Enable/Disable Easily editable Parameters Logging … and that's the ones off the top of my head.

34 Quick Comparison Feature DBMS_JOBS DBMS_Scheduler
Schedule jobs based on anonymous blocks and PL/SQL Procedures YES Schedule jobs on OS commands NO Schedule recurring jobs using SYSDATE Schedule base on an interval YES, but complex Schedule using calendar syntax expression Schedule using predefined schedule Schedule using predefined window Modify existing job attributes Assign Priorities to jobs

35 Quick Comparison 2 Feature DBMS_JOBS DBMS_Scheduler
Group Jobs into a Job Class NO YES Allow multiple jobs to share schedule Use Oracle Resource Management to determine schedules Limit Jobs to a single instance in a RAC configuration Allow jobs to run on several nodes in a RAC Full integration in Oracle Enterprise Manager Partial Provide privileges and roles for specifically control job scheduling Easy to use Easy to modify

36 Converting DBMS_JOBS to DBMS_SCHEDULER
Can use old syntax trunc(sysdate)+1+3/24 Can use new syntax freq=daily;interval=1;byhour=3;byminute=2 4 Caution with self-replicating DBMS_JOBS

37 DBMS_SCHEDULER The How What and Why
Questions?


Download ppt "DBMS_SCHEDULER: The How, What and Why"

Similar presentations


Ads by Google