ORACLE SCHEDULED JOB
A Scheduled Job is, in most cases, an indispensable object that saves lives (time). For example, you wouldn’t want to sit at the computer counting down to push a big New Year’s Eve discount into the system at exactly 12 o’clock, would you? Then you love scheduled jobs as much as I do, or you will. We can prepare packages that perform all kinds of administrative and operational tasks you want done routinely at certain time intervals, such as gathering table statistics, calculating salaries, or terminating queries that have been running longer than a certain time, and tie them to periods with a Scheduled Job. Later we may add step-by-step creation instructions using Toad, but for now let’s look at what the main parameters do.
SCHEDULED JOB BASIC PARAMETERS
RESTARTABLE : The parameter that determines how the job should behave if it encounters an error while running.
TRUE : After a while, the job is restarted automatically.
“If you are running a package that contains operations you do not want repeated, I recommend setting this to FALSE. You wouldn’t want to insert 15 salary rows for everyone in the first three months just because the calculation fails for April.”
LOGGING LEVEL : We use it to determine how detailed the job log will be.
OFF : Do not keep any log records for this job.
RUNS : Keep a job-level log for this job; on each run, the log is updated to the latest run.
FULL : Keep a run-level log for this job; logs of past runs are also kept.
MAX_RUNS : Specifies the maximum number of times the job will run within the period given in the interval. When the given number is reached, the job does not run again even if the date we set as END_DATE has not yet been reached. If MAX_RUNS is given as NULL, it repeats until the END_DATE is reached. It can take a value between 1 and 1000000.
MAX_FAILURES : Specifies how many times it will be attempted before being disabled. If the job fails to complete for any reason, the failure count increases by one. It does not restart without user intervention.
JOB_WEIGHT : If we want the job to use parallelism, we give a value between 1 and 100.
SCHEDULE_LIMIT : If the job cannot start at a scheduled time (e.g., the server is down), specifies how much time after the planned time it should keep retrying at most.
“For example, if there is a 6-hour job that must finish by 9 a.m. every day and it will start running at midnight, it means we have 3 hours of flexibility.”
