Databases Reference
In-Depth Information
Chapter 21
Automating Jobs
In almost any type of database environment—from development, to testing, to production—DBAs rely heavily on
automating tasks. Typical jobs that DBAs automate include the following:
•
Shutdown and startup of databases and listeners
•
Backups
•
Validating the integrity of backups
•
Checking for errors
•
Removing old trace or log files
•
Checking for errant processes
•
Checking for abnormal conditions
Automating routine tasks allows DBAs to be much more effective and productive. Automated environments
are inherently smoother running and more efficient than manually administered systems. DBA jobs that run
automatically from scripts consistently execute the same set of commands each time and therefore are less prone to
human error and mistakes. Two scheduling utilities are described in this chapter:
•
Oracle Scheduler
cron
utility
•
Linux/Unix
This chapter begins by detailing the basic aspects of the Oracle Scheduler utility. This scheduler is available if you
have an Oracle database installed. Oracle Scheduler can be used to schedule jobs in a wide variety of configurations.
Also covered in this chapter is how to use the Linux/Unix
cron
scheduling tool. In Linux/Unix environments,
DBAs often use the
cron
scheduling utility to run jobs automatically. The
cron
utility is ubiquitous and easy to
implement and use. If you're an Oracle DBA, you must be familiar with
cron
, because sooner or later, you'll find
yourself in an environment that relies heavily on this tool to automate database jobs.
The last several sections in this chapter show you how to implement many real-world DBA jobs, such as
automatically starting/stopping the database, monitoring, and OS file maintenance. You should be able to extend
these scripts to meet the automation requirements of your environment.
■
Enterprise Manager Grid/Cloud Control can also be used to schedule and manage automated jobs. If you work
in a shop that uses Enterprise Manager, then it's appropriate to use this tool for automating your environment.
Note