Oracle Enterprise Manager Administrator's Guide Go to Product Documentation Library
Library
Go to books for this product
Product
Go to Contents for this book
Contents
Go to Index
Index



Go to previous file in sequence Go to next file in sequence

Job Scheduling


The Job Scheduling services allow you to automate standard and repetitive tasks, such as executing a SQL script or executing an operating system command. With the Job system, you can create and manage jobs, schedule execution of jobs, and view information about the jobs. Jobs can be scheduled on a single node or multiple nodes in the network, provided that the node has an intelligent agent running on it. The topics discussed in this chapter include:

Job Scheduling Process

The Job scheduling process includes:

  1. Creating a job. This involves:
    1. Determining the type and destination of the job.
    2. Determining the tasks of the job.
    3. Determining the parameters for each task.
    4. Scheduling the times that the job executes.
  2. Saving and modifying a job, if desired.
  3. Submitting a job to the Job system.
  4. Viewing the job history to review the results of the job.

Job Tasks

The Job system provides a variety of predefined job tasks, or you can submit your own tasks by executing a SQL*Plus script or running an operating system program. Job tasks are implemented in the Tool Command Language (Tcl) scripts with Oracle extensions (OraTcl) to include database specific commands. You can write your own Tcl script and submit it with the Run Tcl job task. For more information on custom job scripts, see the Oracle Enterprise Manager Application Developer's Guide.

The tasks are grouped by the destination of the task:

The tasks allow you to:

For information on Oracle predefined job tasks and their parameters, see the online help for Oracle job tasks and Oracle Job Tasks on page 4-15.

You can combine two or more tasks into one job, called a composite job. Composite jobs can contain test conditions based on the success of a task. For example, if a composite job consists of two tasks, starting up a database and then running a SQL script, you can specify that the script be run only if the database was successfully started.

You can create jobs that can be used as fixit jobs for event conditions that are monitored with the Event Management System. Fixit jobs cannot be scheduled. See Chapter 5, "Event Management" for information on monitoring events in the system.

Note:

You need to set up a password file to perform administration tasks, such as start up or shut down, on a remote database. See Administration of a Remote Database on page 1-22.

Job Credentials

Jobs are normally run with the user preferences of the administrator who submitted the job. This ensures that jobs cannot be used to perform functions the administrator could not perform if logged into the machine directly. For example, to write a job output file to the ORACLE_HOME/network/agent/ directory, the administrator must have permissions to write to that directory on that node.

Because jobs are categorized by the type of service they act on, the job system knows what credentials to pass to the agent. If the job runs on a node, the job system passes either the user preferences for the node or, if none are specified, your Console username and password. If the job runs on a service, such as a database, the job system also passes the user preferences for the service. For information on user preferences, see Console User Preferences on page 1-24.

Note:

You must set up valid user credentials for the nodes that you want to run jobs on. Node credentials are required for all jobs. If node credentials are not set up correctly for an NT node, you may get the "Failed to Authenticate User" error message. For more information on configuration issues, see the Oracle Enterprise Manager Configuration Guide.

Submitting Jobs

The Job system is simple to use because the task of scheduling and managing jobs is centralized in the Enterprise Manager Console. The administrator only needs to submit a job once, regardless of the number of destinations on which the job will run or the number of times the job will be run.

When you submit a job, the Console's daemon process sends the job information to the appropriate intelligent agents on the destinations you selected. The agents are responsible for executing the job on the specified schedule and returning job status messages to the Console through the daemon.

Note:

There is usually a slight delay between the submitting the job and the notification by the agent.

To schedule a job, you do not have to connect to the node on which the job will be run. You only need to submit the job to the Console and specify the destinations on which it should run. The destinations can include nodes, databases, listeners, and user-defined groups that have been created with the Map system.

Note:

Jobs can only be run on nodes where an intelligent agent is running. If you send a job to a group, the job is only scheduled on the nodes in the group where the agent is running.

The Job system of Enterprise Manager allows you to efficiently run jobs on multiple remote nodes by transferring job information to the agents servicing the nodes. When a job is executed, it is run by the agent on that node, thus minimizing network traffic between the remote node and the Console and communication daemon. In addition, jobs can be run on multiple nodes simultaneously because there is an intelligent agent residing on each node.

When you submit a job to one or more remote sites, it is possible that any one of those site may be down. If a site or its agent is down, the Communication Daemon queues any job requests that could not be delivered to the site. Once the site can be contacted, the daemon submits the queued job to the agent. When a job is submitted to an agent, the Communication Daemon attempts to validate the specified destinations. See Destination Validation Dialog on page 2-14.

Job Window

You can view the different pages of job information by selecting the page tabs in the Job window. The pages in the Job window are:

You can switch between the pages by clicking the tab of each page. The rows in both pages can be sorted on any column by clicking the column heading.

The Job window can be hidden or shown by selecting Job in the Console View menu. You can also hide or show the window by clicking the Job system icon in the Console toolbar. See Figure 4-1, "Job Window in the Console" for an illustration of the Job Scheduling window.

Figure 4-1 Job Window in the Console

Active Jobs

The Active Jobs page contains a summary of the active jobs on the network. These are jobs that you have submitted to the job system and are not yet completed. Each row is an execution of a particular job scheduled on a specific destination. While a job may execute multiple times, the job listed in the Active Jobs page is the one that is currently scheduled or running. You can use the Show Details menu option to display the details of the selected job. You cannot modify these jobs.

You can double-click on a job listed in the Active Jobs page to view the job details.

Job History

Job History contains a list of previous job executions. These are jobs that have been submitted to an agent and have executed successfully or unsuccessfully. This page also lists deleted jobs. You cannot modify these jobs.

You can double-click on a job listed in the Job History page to display the Job property sheet and view the Job Output dialog box, if output exists for the job. If no output is produced by a job, a message displays that states that there is no output for the job. If the output includes only blank spaces, the dialog box is blank.

You can save the jobs from the Job History page to a text file, then clear the jobs from the Job History window. This prevents the Job History page from being overloaded with obsolete jobs that occurred in previous days.

Job Library

Job Library contains a list of the jobs that you have created and saved. These jobs can be submitted to the job system at a later date. This is useful if you want to submit the same job at different times. You can use the Modify Saved Job menu option to modify a job selected in this page. You can also double-click on a job listed in the Job Library page to modify the job.

Job Menu

The Job menu allows you to create, modify, save, submit, and manage jobs. The menu options are enabled depending on the items selected in the Job window. See Figure 4-1, "Job Window in the Console" for an illustration of the Job menu.

Note:

When you submit or delete a job, there is usually a slight delay while the agent processes the request.

Create Job

Allows you to create a new job. See Creating, Modifying, or Viewing a Job on page 4-9.

Show Details

Displays the property sheet for the selected job in the Active Jobs page of the Job window. The property sheet is in read-only format. Active jobs can be removed but not modified. See Creating, Modifying, or Viewing a Job on page 4-9.

Remove Job

Removes the selected job from the Active Jobs page of the Job window. If you experience problems removing a job, see the Delete option of the Daemon Manager Menu on page 6-9.

Save History

Saves the contents of the Job History page to a text file. Enter a valid file name or select an existing file in the file selection dialog box.

Print History

Prints the jobs listed in the Job History page.

Clear History

Clears the jobs listed in the Job History page.

Modify Saved Job

Allows you to modify the job selected in the Job Library page of the Job window. The property sheet is the same as the property sheet for creating a new job. See Creating, Modifying, or Viewing a Job on page 4-9.

Creating, Modifying, or Viewing a Job

When you create, modify, or view details of a job, similar property sheets display. The contents of the Create Job and Job Details property sheets are nearly identical. See Figure 4-2, "Job Property Sheet" for an illustration of a Job property sheet. The property sheets contains:

Attention:

When submitting a job that consists of multiple tasks, an error may occur if the string of arguments that was sent is longer than the internal buffer. If that error occurs when submitting a job, divide the tasks among multiple jobs and resubmit the jobs.

Creating a New Job

To create a new job:

  1. Select Create Job from the Job menu to display the Create Job property sheet.
  2. Complete the pages of the Create Job property sheet.
  3. Determine whether the job is ready to submit.
    1. Click on the Submit button to submit the job to the agents at the selected destinations. The job appears in the Active Jobs window.
    2. Click on the Save button to save the job. The job appears in the Job Library window. You can modify or submit a saved job at a later time.
Note:

There is usually a slight delay between the submitting the job and the notification by the agent.

Modifying a Saved Job

To modify a saved job:

Note:

Only saved jobs that are in the Job Library page of the Job window can be modified. Submitted jobs in the Active Jobs window cannot be modified.

  1. Select a saved job in the Job Library page of the Job window.
  2. Select Modify Saved Job from the Job menu to display the Job Details property sheet.
  3. Update the pages of the Job Details property sheet.
    1. Determine whether the job is ready to submit.
    2. Click on the Submit button to submit the job to the agents at the selected destinations. The job appears in the Active Jobs window.
    3. Click on the Save button to save the job. The job appears in the Job Library window. You can modify or submit a saved job at a later time.

Viewing Job Details

To view the details of a job:

  1. Select a job in the Active Jobs page of the Job window.
  2. Select Show Details from the Job menu to display the Job Details property sheet.
  3. View the pages of the Job Details property sheet. This property sheet cannot be modified.

Job General Page

The General page allows you to determine job name, description, type, fixit job status, and destinations.

Job Name

Enter the name of the new job.

Description

Enter the description of the job.

Fixit Job

Check this box if you want to use this job as fixit job to correct an event condition. The fixit job must be submitted to the destination where the event is being monitored. A fixit job cannot be scheduled.

The job can be selected from the Fixit Job list in the Event Set Management Parameters page after it has been successfully submitted to an agent. See Creating or Modifying an Event Set on page 5-14.

Destination Type

Select the destination type from the pull-down list: Database, Listener, Node, or other service that is integrated into the Console.

Job destinations

Select the destinations of the job in the Available Destinations list and click the << (Add) button to move the destination to the Selected Destinations list.

The destinations are determined by the Job Type. The destinations include databases, listeners, nodes, and groups of these objects.

Note:

Only network objects that have been discovered correctly and have an Intelligent Agent running are included in the list of available destinations. See Discovering Services on page 2-8.

Job Task Page

The Task page allows you to choose the tasks that you want the job to perform.

Available Tasks

Select a task and click on the << (Add) button to include the task in the job. You can add multiple tasks to the job from the Available Tasks scrolling list. For information on Oracle predefined job tasks and their parameters, see the online help for Oracle job tasks and Oracle Job Tasks on page 4-15.

Selected Tasks

You can remove tasks from this list. Select the task and click on the >> (Remove) button.

Figure 4-2 Job Property Sheet

Job Parameters Page

On the Parameters Page, you specify parameter settings for the selected job tasks. To set the parameters for a task, select the task in the Selected Tasks list. The parameters for the selected task are displayed on the right side of the Parameters Page.

Selected Tasks

Select the task for which you want to set parameters.

Task Parameters

Specify the parameters for the selected task. You can enter values in the entry boxes or select values from the pull-down lists. The parameters vary according to the job task. For information on Oracle predefined job tasks and their parameters, see the online help for Oracle job tasks and Oracle Job Tasks on page 4-15.

For some jobs, you can override the preferred credentials for connecting to the service. This allows you to enter a username and password. For information on user preferences, see Job Credentials on page 4-3 and Console User Preferences on page 1-24.

Job Schedule Page

The Schedule page allows you to schedule the execution of the job task.

Execute

Select the frequency that you want the task executed. The choices are Immediately, Once, On Interval, On Day of Week, and On Date of Month.

Start Execution

Choose the first date and time that you want the task executed. This is the starting time for any task scheduled on an interval.

End Execution

Choose the last date and time that you want the task executed. This option does not apply if you chose the Immediately or Once execution options.

Time Zone

Select the time zone from the pull-down list. The choices are Agent, Console, and GMT. For this release, only the Agent time zone is available.

Job Progress Page

The Progress page contains all notifications that have been received for a specific job. Each row in the page summarizes a status change of the job. If you display the Progress page for an execution in the History Page, the page typically displays Submitted, Scheduled, Running, and Completed or Failed notifications for that execution. If you display an execution from the Active Jobs page, the Progress page displays only those notifications that have been received.

When you display the Progress page, the page displays the notifications only for the destination and execution time of the job occurrence selected. To view the notifications associated with other destinations or execution times, select other destinations or execution times from the Destination or Execution pull-down lists. You can also select <All> in either list to view all notifications. If the job has been Deleted on a destination, the Deleted notification always displays at the top of the Progress Page.

Note:

The Progress page is only available with the Show Details option of the Job menu.

The following options are available on the Progress page:

Destination

Select the destination of the job occurrences you want to view from the pull-down list. Select <All> for all destinations. The list of job occurrences changes according to the selection.

Execution

Select the execution time of the job occurrences you want to view from the pull-down list. Select <All> for all executions. The list of job occurrences changes according to the selection.

Save As

Select the Save As button to save the list of job occurrences as a local file using the standard Windows file dialog box.

Print

Select the Print button to print the list of job occurrences in the Progress page.

Show Output

If output exists for an occurrence of a job, you can display the output in the Output dialog box. To display any existing output:

The columns contain the following information:

Job Type

The job type is depicted with an icon at the left of the row. These icons are the same as the Active Jobs page. See Active Jobs on page 4-6.

Status

For information on the status of a job, see Active Jobs on page 4-6 and Job History on page 4-7.

Destination

This is the destination of the specific occurrence of the job.

Notification Time

This is the time the Console was notified.

Output Dialog Box

The Output dialog box displays any output as a result of the execution of an occurrence of a job.

Note:

If no output is produced by a job, a message displays that states that there is no output for the job. If the output includes only blank spaces, the dialog box is blank.

With the Output dialog box displayed, the following options are available:

Save As

Select the Save As button to save the output as a local file using the standard Windows file dialog box.

Close

Select the Close button to exit the dialog box after viewing it.

Print

Select the Print button to print the contents of the dialog box.

Job Definition

Select the Job Definition button to display more details.

Oracle Job Tasks

This section lists the Oracle predefined job tasks and parameters for:

This information is entered in the Job Task Page and Job Parameters Page of the Create Job property sheet. The name and the parameters are listed for each task.

Note:

For more information on job tasks, see the online help for Oracle job tasks. See Data Manager Tasks on page 14-6 and Distribute and Install Software Packages on page 15-17 for information on additional job tasks. Other tasks; such as Parallel Server job tasks; are described in the online help and documentation for the specific product.

Oracle Database Tasks

These are the tasks that can be run on databases and database groups. In addition, you can run operating system or host job tasks.

Note:

You need to set up a password file to perform administration tasks on a remote database. See Administration of a Remote Database.

Run SQL*Plus

This job executes a SQL*Plus script, allowing any legal SQL or PL/SQL scripts to be run, including all SQL*Plus formatting commands. You can load a previously created script or simply type SQL commands in the Script Text box. You can record and save SQL commands with the Log menu options and use those saved commands as a script. When you create a SQL script, save it in the ORACLE_HOME\sysman\scripts\sql directory to make the script easily accessible. SQL*Plus must be installed in the ORACLE_HOME of the target database.

Parameters:
  1. SQL File Name. The file must be accessible from the Console. Click on the Browse button to display the standard Windows File selection box to locate the name of an existing file. When you click the OK button after locating a SQL*Plus file, the contents of the file are displayed in the Script Text box.
Note:

If you want to create a new SQL*Plus script file, first click the Save button and enter a file name in the File Name field of the Save As dialog box.

  1. SQL Parameters. Enter one or more arguments that you want the script to use.
  2. Override Preferred Credentials. You can use the preferred credentials that have been set up for the database, or you can enter a username and password. If you check the box to override the credentials, then you need to enter:
    1. User Name. Username for accessing the database.
    2. Password. Password for the username.
Note:

See Console User Preferences on page 1-24 for more information.

  1. Script Text. You can edit the commands in the Script Text box. Click the Save button to save the updates. If you want to save the changes to a different file, you can change the name of the SQL file in the File Name field of the Save As dialog box.
Hint:

If you need to determine whether a SQL error has occurred during the running of a SQL script, include "WHENEVER SQLERROR EXIT SQL.SQLCODE" at the beginning of the script. If a SQL error occurs, the job status is set to failed.

Run DBA Script

This job executes a Server Manager line mode script that contains DBA commands. You can record and save SQL commands with the Log menu options and use those saved commands as a script. When you create a DBA script, save it in the ORACLE_HOME\sysman\scripts\dba directory to make the script easily accessible.

Parameters:
  1. DBA Script Name. The file must be accessible from the Console. Click on the Browse button to display the standard Windows File selection box to locate the name of an existing file. When you click the OK button after locating a DBA script file, the contents of the file are displayed in the Script Text box.
Note:

If you want to create a new script file, first click the Save button and enter a file name in the File Name field of the Save As dialog box.

  1. Override Preferred Credentials. You can use the preferred credentials that have been set up for the database, or you can enter a username and password. If you check the box to override the credentials, then you need to enter:
    1. User Name. Username for accessing the database.
    2. Password. Password for the username.
    3. Connect As. Select the role you want to connect as from the pull-down list.
Note:

See Console User Preferences on page 1-24 for more information.

  1. Script Text. You can edit the commands in the DBA Script box. Click the Save button to save the updates.
Note:

If you want to save the changes to a different file, you can change the name of the DBA script file in the File Name field of the Save As dialog box.

Shutdown Database

This job task shuts down an Oracle database instance.

Parameters:
  1. Mode: (Use Immediate, or Abort, to avoid suspending the job indefinitely.)
  2. Role:
  3. Override Preferred Credentials. Check the box if you want to override the preferred credentials that have been set up for the database. If you check the box to override the credentials, then you need to enter:
    1. User Name. Enter the username for accessing the database.
    2. Password. Enter the password for the username.
Note:

See Console User Preferences on page 1-24 for more information.

Startup Database

This job task starts up an Oracle database instance.

Parameters:
  1. Startup State. Select the start up state from the pull-down list:
  2. Parameter File. Enter the initialization parameter filename you want to use for the database. This file is located on the node where the agent and database reside. For example with a database on a Unix platform:
    /rdbms/oracle73/myinit.ora
    
    

    If you do not enter a filename, the default platform-specific initialization file is used.

  3. Override Preferred Credentials. Check the box if you want to override the preferred credentials that have been set up for the database. If you check the box to override the credentials, then you need to enter:
    1. User Name. Enter the username for accessing the database.
    2. Password. Enter the password for the username.
Note:

See Console User Preferences on page 1-24 for more information.

  1. Mount Mode. Select the mount option from the pull-down list:
  2. Connect As. Select the connecting role from the pull-down list:
  3. Restrict Connections. Check this box if you want to restrict this session of the database.
  4. Force Startup. Check this box if you want to force the startup of a database that is running.
Backup

This job allows you to submit a backup script that has been created with Oracle Backup Manager. The scripts for backing up a database are generated in the Tcl language. You can only update the Backup File Name field.

Parameters:
  1. Backup File Name. The file must be accessible from the Console. Click on the Browse button to locate the backup script filename (.bdf). When you have found the filename with the file selection box, select the file and click on the OK button.
Note:

The remaining parameter fields are set according to the selected backup script. The fields are read-only and cannot be modified.

  1. Model Service.
  2. Database status during backup.
  3. Tablespace status during backup.
  4. Tablespace to backup.
  5. Backup method.
  6. Arguments.
  7. Command Style.

Operating System or Host Tasks

These are the tasks that can be run on the host's operating system.

Broadcast Message

This job allows you to submit a message to the selected destinations using the platform-specific mechanism. To send the message to a destination, you may need to have permissions on specific directories. For example, you may need permissions on /dev/console (system console device) to send a message to a Unix destination.

Note:

On an Windows platform, this task sends the message to ALL users on the network. To send a message to specific users/domain, use the Run OS Command task to execute the net command with the send option. See the Windows online help for information on net command line arguments. You can also enter net send /help at the MSDOS command prompt.

Parameters:

Message Text. Enter the message text that you want sent to the selected destinations.

Run OS Command

This is a generic method of running any program or script that is executable on that host, provided your credentials allow you to do that.

Parameters:

OS command or shell script name. The command or script must be accessible from the node where the agent and database reside. You may have to include the path for the agent to locate and execute the command or script. For example: ls

One or more arguments to the command. For example: -l /export/oracle

Run Tcl Script

This job executes a Tcl script. This is a generic method of running any Tcl script that is executable on that host, provided the preferred credentials allow that. See Console User Preferences on page 1-24 for more information.

When you create a Tcl script, save it in the ORACLE_HOME\sysman\scripts\tcl directory on the Console machine to make the script easily accessible.

Parameters:
  1. TCL File Name. The file must be accessible from the Console. Click on the Browse button to display the standard Windows File selection box to locate the name of an existing file. When you click the OK button after locating a Tcl script file, the contents of the file are displayed in the Script Text box.
Note:

If you want to create a new Tcl script file, first click the Save button and enter a file name in the File Name field of the Save As dialog box.

  1. Parameters. One or more command-line arguments that you want the script to use. The arguments must be delimited by quotes.
Note:

Multiple parameters, such as "one two three", are treated as only one parameter. To ensure that the parameters entered in the field are treated as separate arguments and to ensure that the Tcl script functions in future releases, include the following at the beginning of the Tcl script:

set argc [llength $argv] 
if { $argc == 1} { set argv [lindex $argv 0]} 


  • Input Files. Enter the filenames for any input files that are used by the Tcl script.
  • Script Text. You can edit the commands in the Script Text box. Click the Save button to save the updates.
  • Note:

    If you want to save the changes to a different file, you can change the name of the Tcl script file in the File Name field of the Save As dialog box.

    Tcl Script Examples

    For information on writing Tcl job tasks, see the Oracle Enterprise Manager Application Developer's Guide. For information on Tcl, see "Tcl and the Tk Toolkit," by John K. Outsterhout, published by Addison-Wesley Publishing Company, 1994. For examples of Tcl job scripts, review the scripts located in ORACLE_HOME\network\agent\jobs\oracle subdirectories on the machine where an agent has been installed. Do not edit these Tcl scripts.

    The following is an example of a Tcl script (Unix platform) that logs on to a database and runs a SQL statement:

    set argc [llength $argv]
    if {$argc == 1} {set argv [lindex $argv 0]}
    set connect_str [lindex $argv 0]
    set sql_statement [lindex $argv 1]
    set lda  [oralogon $connect_str]
    set cur1 [oraopen $lda]
    orasql $cur1 $sql_statement
    set result_row [orafetch $cur1]
    puts $result_row
    oraclose $cur1
    oralogoff $lda
    
    

    When the script is executed with the Run Tcl Script task, the following are examples of command line arguments that should be entered in the Parameters field:

    "scott/tiger@or803.world" "select * from emp"
    
    

    The following is an example of a Tcl script (Unix platform) that displays the contents of a file if it exists and triggers a third-party event if it does not exist:

    set argc [llength $argv]
    if {$argc == 1} {set argv [lindex $argv 0]}
    set myfile [lindex $argv 0]
    append mymessage "File not found:" $myfile
    if {[file exists $myfile]} {
       catfile $myfile
      } else {
        puts $mymessage
        orareportevent /user/host/file/alert $oramsg(nodename) 1 $mymessage
      }
    
    

    When the script is executed with the Run Tcl Script task, the following is an example of a command line argument that should be entered in the Parameters field:

    "/export/oracle/network/agent/dbsnmp.ver"
    
    
    Note:

    When orareportevent is used to trigger a third-party event with a job script, you need to create and register an event set that has the "Accept third party events" box checked. See Event Set Management General Page on page 5-15.

    Listener Tasks

    These are the tasks that can be run on Listeners. In addition, you can run operating system or host job tasks.

    Shutdown Listener

    This stops the Listener. The preferred credentials for the node must have a user that has system administration privileges. For information on user preferences, see Console User Preferences on page 1-24.

    Parameters:

    Password. Enter a password for the listener if you choose to override the default password.

    Startup Listener

    This can be invoked to start the Listener. The preferred credentials for the node must have a user that has system administration privileges. For information on user preferences, see Console User Preferences on page 1-24.

    Parameters:

    None




    Go to previous file in sequence Go to next file in sequence
    Prev Next
    Oracle
    Copyright © 1997 Oracle Corporation.
    All Rights Reserved.
    Go to Product Documentation Library
    Library
    Go to books for this product
    Product
    Go to Contents for this book
    Contents
    Go to Index
    Index