Oracle DBA, How To, Error, Cause and Action

cron Scheduler

What is cron job?

A Unix/Linux background program or daemon that runs continuously, starting other programs at specified times. These programs are identified and scheduled by crontab.
Cron is normally started automatically, so you never have to type this command.

In order for the oracle user to run cronjob the account should not be deny which can be set in the /etc/cron.deny (different Linux or unix will store the configuration file differently)

To micro manage the cron is via following files, by listing user that allow or deny the use of cron.
/etc/cron.allow
/etc/cron.deny



crontab command

A utility that specifies jobs to be run at regularly scheduled times.

crontab -option
  • -e = Open an editor on your crontab file so you can create, add, delete, or change entries.
  • -l = List the contents of your crontab file
  • -r = Removes your crontab file

To backup your crontab entries you can use following command

crontab -l > crontable.bak


Crontab Arguments

Each crontab entry stats with five fields that specify the time when the command should run, followed by the command itself. An entry must be in the form:

M H D m d /path/command

where:

M = Minutes, from 0 to 59
H = Hour, from 0 to 23
D = Day, Day of the month, from 1 to 31
m = Month, from 1 to 12
d = Day of the week, starting with 0 for Sunday
command = The command (or script) you want to execute at the speficied time.

If you place an asterisk (*) in one of the fields instead of a number, crontab interprets that as a wildcard for all possible values. Use a comma to separate multiple values and a hyphen to indicate a range; you can also include comments by preceding them with the pound (#) character.

No comments:

Post a Comment

Thanks for your comment.