Before you start, say one thing: As a DBA, you should prohibit all applications from using Dbms_job.
Dbms_scheduler is very complex, and Oracle spends a lot of chapters on two books, two of which are:
- Oracle? Database PL/SQL Packages and Types Reference
- Oracle? Database Administrator ' s Guide
If you want to learn more about scheduling, it is recommended to read the second book in detail and then read the relevant chapters in the first book.
In the Cloud era, resource management becomes very important, and Dbms_scheduler can tightly integrate Oracle's own resource management
For developers, the common problem is how to schedule a job if the scheduling time is not so regular.
This is a good solution, you can use Dbms_scheduler.create_scheduler to create Schedule objects, the following are examples:
beginDbms_scheduler.create_schedule (Schedule_name= 'sch_day_10_30', start_date=Systimestamp, Repeat_interval= 'freq=daily; byhour=10;byminute=30'); Dbms_scheduler.create_schedule (Schedule_name= 'sch_day_20_10', start_date=Systimestamp, Repeat_interval= 'freq=daily; byhour=20;byminute=10'); Dbms_scheduler.create_job (Job_name= 'My Sch Test', Repeat_interval= 'sch_day_10_30,sch_day_20_10', Job_type= 'Plsql_block', Job_action= 'BEGIN NULL; END;', Enabled=TRUE, Auto_drop=FALSE, Comments= NULL);End;
By using scheduling, there are several benefits:
- Only need to modify the schedule, do not need to modify the job
- Easy to understand
Using schedule to manage scheduling in Oracle scheduling