Book Giveaway & Chapter Download: Mastering Oracle Scheduler in Oracle 11g Databases
Join the DZone community and get the full member experience.Join For Free
dzone and packt publishing have partnered to bring you this exclusive chapter from 'mastering oracle scheduler in oracle 11g databases' (by ronald rood ). this chapter explains how to make good use of the scheduler and apply job separation.
control the scheduler
oracle scheduler does a lot of out of the box things, and if the demands are not too high, oracle scheduler can cover most of the situations. when your application has to run many thousands of jobs in an hour and log them over a long period, a little more attention is needed. in cases where the demands are high, we need to take care of a few more things to keep the system happy. what we need to do depends on how the scheduler is used and what kind of load it is supposed to handle.
in this chapter, we will take a closer look at how we can control this beast. we will take a look at the privileges for job creation, job execution, and scheduler management. we will also examine how to control logging retention and find a way to prevent jobs from running when the database starts.
like most object types in the database, as seen at the beginning of chapter 1, oracle enables us to create scheduler objects. the privileges create job and create external job are very important. they should normally be used when building an application system . also, there is a create any job privilege, which can be useful when you need to create a job in a different schema. normally, this privilege should not be granted to anyone. it will allow the grantee to run an arbitrary code on any schema, which is not particularly desirable. instead, just log on to the correct schema and perform the tasks using the correct privileges.
(a priviledges chart is shown here in the download below).
here, it is interesting to note that the drop any job privilege seems to be missing. for other object types, we have the create any privilege and also the drop any privilege. making use of these any privileges looks smart at first glance. however, it makes a system less transparent and more difficult to maintain eventually. preferably, objects are granted explicitly instead of falling back on any privileges when building an application. for example, select any table and you will observe that it is much harder to find how an application flows or what the impact of dropping an object is. if the privileges are explicitly granted, we can see that someone is using our object.
mostly, it is smarter to create schemas using the least privileges principle. this means that one or more schemas contain tables that hold the data, and other schemas contain the procedures that act on the various tables. users or roles should have privileges on the procedures.
the dbms_scheduler package is available to the public. the use of the package is controlled by the underlying privileges such as create jobs, manage scheduler, and the execution privileges on the products of the dbms_scheduler package such as jobs, programs, and job classes.
you can buy 'mastering oracle scheduler in oracle 11g databases' from the packt publishing website. packt offers free shipping to the us, uk, europe, and selected asian countries. alternatively, you can buy the book from amazon, bn.com, computer manuals and most other internet book retailers.
Opinions expressed by DZone contributors are their own.