13.3 OEM and the Job Scheduler
The OEM provides you with the ability to configure a set of jobs to be automatically run on one or more of your databases. You can set up the jobs to run at the same time on each database or at different times. Oracle supplies a list of commonly used jobs to choose from. You can also write your own customized scripts and schedule them to run automatically.
As with all the OEM utilities, the OEM Job Scheduler uses the intelligent agent on each computer node to perform the actual work that has been scheduled. There is only one intelligent agent per node, regardless of how many databases are on that node or how many jobs have been scheduled to be run against those databases.
The default tasks provided with the OEM Job Scheduler utility can be run either one time or on a scheduled basis:
Back up tablespace
Run DBA script
Shut down database
Start up database
Run OS command
Many of these tasks help protect your databases, as we describe in the following sections.
13.3.1 Back Up Tablespaces, Export, Import, and Load Data
The ability to back up tablespaces on a scheduled basis is a wonderful option that helps ensure you can recover your database to either the last time the tablespaces were backed up or to a point in time after the last backup (if archivelog mode has been enabled). However, if you are going to schedule automatic tablespace backups , you must be sure to also perform a log switch and capture the associated redo log files and control files to be included with the tablespace backup so you can perform an effective recovery.
Scheduled exports can help ensure that you can recover one or more tables, views, or indexes successfully and easily. Performing imports and data loads automatically can help you perform long-running tasks late at night. However, these abilities , when used by an unauthorized person, could potentially enable someone to introduce data to your system without your knowledge. You must ensure that the computer used as the OEM console is not accessible to anyone but your organization's DBAs.
For information about overall backup features and strategies, see Chapter 12.
13.3.2 Run SQL Scripts and SQL*Plus
By creating customized scripts, running them on a daily basis, and reading the output, you can monitor who has been accessing your systems. You might want to create a script to verify on an nightly basis who has been granted access to the database and what privileges each user possesses.
13.3.3 Start Up and Shut Down Your Database
As we have seen in other sections of the OEM, there are many options that include the ability to shut down and start up a database. In order to perform a cold, file-level backup, the database must be shut down. In order to perform an export of the database and ensure that only DBAs can interact with the database while the export is going on, you might want to start up the database in restricted mode and then perform the export.
13.3.4 Broadcast Messages
If you are performing a scheduled job on a database, the ability to warn users that the database is about to be shut down is very helpful. Although this option normally has little value from a security perspective, it is still a nice option to communicate information to all users of a system.
13.3.5 Run OS Commands and Tcl Commands
The OEM Job Scheduler gives you the ability to run command scripts to control operating system actions. For example, you might want to run an operating system command procedure to gather information about who is currently on that system. The OS command script might be as simple as the following command in UNIX, which shows all of the users on the system and redirects the output to a file called users.txt :
ps -ef > users.txt
The Tool Command Language (Tcl) is used with Oracle enhancements (Ora Tcl) to enable you to write command scripts in a language the OEM intelligent agents can understand. Tcl scripts, provided by Oracle through the OEM Job and Event Schedulers, are used to control intelligent agent actions and enable monitoring of your databases on one or more platforms.
13.3.6 Deinstall, Delete, Distribute, and Install Products
The final set of Oracle-supplied tasks available for the Job Scheduler through the OEM deal with Oracle software products. Through the Job Scheduler, you can deinstall products which are installed in your databases and install, delete, or distribute Oracle software to your various platforms through a scheduled job.