Skip Headers

Oracle Enterprise Manager Administrator's Guide
Release 9.0.2

Part Number A95407-01
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

5
Jobs

The Job system allows 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, share jobs with other administrators, 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 Process

The Job process includes:

  1. Creating a job. This involves:

    1. Determining the type and destination of the job.

    2. Determining the tasks.

    3. Determining task dependencies of the job.

    4. Determining the parameters for each task.

    5. Scheduling the times that the job executes.

    6. Assigning permissions to other administrators for notification purposes.

  2. Submitting a job to the selected destinations in the network system.

  3. 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 Intelligent Agent User's Guide.

The tasks are grouped by the target type of the task:


Note:

All target types include Node tasks.


The tasks allow you to perform such operations as:

See the online help for Oracle job tasks and "Oracle Job Tasks" for information on Oracle predefined job tasks and their parameters.

You can combine two or more tasks into one job, called a composite job. Composite jobs consist of separate tasks that are constructed such that some tasks may or may not execute upon completion of another 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. Here, you specify a dependency between the two tasks that determine whether the next task is executed. The Job system allows you to specify one of three dependencies for any task: Always (default), Only on Success, or Only on Failure.

You can create jobs that can be used as fixit jobs that are to be run when a condition is signalled by the Event system. Fixit jobs are not scheduled. See Chapter 6, "Events" 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 the "Configuring a Remote Database for Backup or SYSDBA Administration" in the Oracle Enterprise Manager Configuration Guide for more information.

Writing SQL*Plus Scripts

Creating your own job tasks using the SQL*Plus command language allows you to automate any number of complex database operations via the Job system and Intelligent Agent(s). The success or failure of a given SQL*Plus script is determined by the exit condition returned when the script completes. Because a SQL*Plus script can return an error condition that may not be recognized by the Intelligent Agent, such as a non-ORA error message, your job task can appear to complete successfully even though a command issued from within your script has failed. To avoid this situation, you must specify an operational clause when using a SQL*Plus EXIT command in your script.

For example:

> EXIT sql.sqlcode
> EXIT warning
> EXIT 666

Using the EXIT command without specifying an operational clause (default) commits and exits with a value of SUCCESS. By explicitly defining the conditions under which your script terminates, the Intelligent Agent can ascertain whether your job has succeeded or failed. For more information on SQL*Plus and the SQL*Plus command language, see the SQL*Plus User's Guide and Reference.

Job Credentials

Jobs are normally run with the 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 target they act on, the job system knows what credentials to pass to the Intelligent Agent. The Job system uses Enterprise Manager System Preferences (Preferred Credentials) to determine what preference information needs to be passed. When a job runs on a node, the job system passes the administrator preferences for the managed node. In addition, the Job system gives you the option of overriding the node preferred credentials when defining a job. This allows the creator of the job to run the job on the node using a different username and password. When a job runs on a service, such as a database, the job system also passes the administrator preferences for the service. See "Preferred Credentials" for information on administrator preferences.


Important:

You must set up valid user credentials for the nodes on which you want to run jobs. Node credentials are required for all jobs. If credentials are not set up correctly for an Windows NT node, you may get the "Failed to Authenticate User" error message. Make sure the Windows NT node account specified in your preferred credentials possesses the "log in as batch jobs" user right. See the Enterprise Manager Configuration Guide or your Windows NT documentation for instructions on creating NT user accounts.


Administrator preferences for nodes and/or services are given the following prioritization:

  1. Preferred Credential Overrides (Highest Priority)

  2. Preferred Credentials for the selected node or service.

  3. Preferred Credentials for the Default target.

  4. Null Credentials (Lowest Priority) Note: Jobs and events will fail.

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 targets on which the job will run.

When you submit a job, the Management Server sends the job information to the appropriate Intelligent Agents on the targets you selected. The Intelligent Agents are responsible for executing the job on the specified schedule and returning job status messages to the Console through the Management Server. Once submitted, jobs will run regardless of whether you are logged in or not.


Note:

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


To schedule a job, you do not have to connect at the time of job creation to the node on which the job will be run. You only need to submit the job from the Console and specify the targets on which it should run. The target can include nodes, databases, listeners, user-defined groups that have been created with the Group system, or any other discovered services.

The Job system of Enterprise Manager allows you to efficiently run jobs on multiple remote nodes by transferring job information to the Intelligent Agents servicing the nodes. When a job is executed, it is run by the Intelligent Agent on that node, thus minimizing network traffic between the remote node and the Console and Management Server. In addition, jobs can be run on multiple nodes simultaneously because there is an Intelligent Agent residing on each node. 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 Intelligent Agent is running.

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 Intelligent Agent is down, the Management Server queues any job requests that could not be delivered to the site. Once the site can be contacted, the Management Server submits the queued job to the Intelligent Agent, which in turn executes the job on the node.


Important:

If the Agent goes down for any period of time while the job is running, the Agent will return a job status message "Agent was down." This does not affect job operation, but merely indicates that the repeating job did not run as scheduled during the period the Agent/node was down.


Cancelling Jobs

You can cancel a job by selecting the desired job from the Job Active window and choosing Remove Job from the Job menu. Care should be taken when cancelling a job. Cancelling a job that is currently running will interrupt the job process and terminate the job. Problems can arise when the job is composed of multiple job tasks with sequential dependencies.

Job Detail View

You can view the different pages of job information by selecting the page tabs in the Job detail view. There are two pages in the detail view:

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.

Figure 5-1 Job Detail View in the Console

Text description of job2.gif follows.

Text description of the illustration job2.gif

Active Job Page

The Active 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 page is the one that is currently scheduled or running. You can use the Edit Job menu option to display the details of the selected job. When selecting a job from the Active pane, the only job attribute you can modify is the job permission. See "Creating, Modifying, or Viewing a Job".

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

Name

Name of the job.

Target

Destination of the job. (Displayed only when Show Targets is selected.)

Target Type

database, listener, node, HTTP Server, or other managed targets.

Owner

Administrator submitting the job.

Status

Status of job (Displayed only when Show Targets is checked.) is one of the following:


Note:

Under certain circumstances, a job will remain in a Submitted state. The most likely cause would be the Intelligent Agent on the node to which you are trying to submit the job is down, or the node is not connected to the network.


Date/Time

This is the time the Intelligent Agent returns after the job has been scheduled by the Intelligent Agent.

Context-sensitive Menu options

The following options are available by selecting a job and clicking the right mouse button.

View Published Reports

Displays the Job status report. The Enterprise Manager Reporting environment must be configured before using this menu option. See Chapter 8, "Enterprise Manager Reporting" for more information.

Edit/View Job

Displays the property sheet for the selected job. Only the permissions, notifications, and target list can be changed.

Create Like

Displays a copy of the selected job. You can edit the property sheet and submit this job.

Copy to Library

Copies the selected job to the Job Library if it does not already exist there.

Remove Job

Delete the selected job. If the job has not been saved to the Job Library, a warning dialog appears indicating that you are about to perform a remove operation. You may wish to copy the job to the job library before removing it.

History Page

Job History contains a list of previous job executions. These are jobs that have been submitted to an Intelligent Agent and have executed successfully or unsuccessfully. You cannot modify these jobs.

Refreshing the History Page

You can refresh the job history list at any time by clicking on the Refresh icon in the Console toolbar or choosing Refresh Job History from the Console's Job menu. Job history is automatically refreshed each time you move from the Active tab to the History tab.

Clearing the History Page

You can clear the History page by choosing Clear Job History from the Console's Job menu, or from the context-sensitive menu.

Displaying Job Output

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.

Context Menu options

The following options are available by selecting a job and clicking the right mouse button.

View Job

Displays the property sheet for the selected job.

Create Like

Displays a copy of the selected job. You can edit the property sheet and submit this job.

Copy to Library

Copies the selected job to the Job Library if it does not already exist there.

Remove Job

Delete the selected job. If the job has not been saved to the Job Library, a warning dialog appears indicating that you are about to perform a remove operation. You may wish to copy the job to the job library before removing it.

You can save the jobs from the History page to a file, then clear the jobs from the History page. This prevents the History page from being overloaded with obsolete jobs that occurred in previous days. Choose the Report Job History option from the Job menu to save the history to a report. This report is a file on the machine where the Enterprise Manager Console is running.

You can create a new job similar to a job in the History page with the Create Like option. See "Creating, Modifying, or Viewing a Job" for more information.

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 pane. See Figure 5-1, "Job Detail View in the Console" for an illustration of the Job menu.

Create Job

Allows you to create a new job. See "Creating, Modifying, or Viewing a Job" for more information.

Create Job Like

Allows you to create a new job like the selected job in the Job pane. See "Creating, Modifying, or Viewing a Job" for more information.

Edit Job

Allows you to modify the job selected in the Job pane. The property sheet is the same as the property sheet for creating a new job, however, you can only modify job permissions. See "Creating, Modifying, or Viewing a Job" for more information.

Copy Job to Library

Copies the selected job to the Job Library if it does not already exist there.

View Job

Displays the property sheet for the selected job in the Job pane. The property sheet is in read-only format. Active jobs can be removed but not modified. See "Creating, Modifying, or Viewing a Job" for more information.

Remove Job

Removes the selected job from the Active or History page of the Job pane. When you delete a job, there is usually a slight delay while the request is processed. See "Cancelling Jobs" for specifics on job cancellation.

Job Library

Displays the Job Library dialog. See "Job Library" for more information.

Clear Job History

Clears the jobs listed in the Job History page.

Refresh Job History

Refreshes the job history list. Job history is refreshed each time you move from the Active tab to the History tab. However, to refresh the job history list while currently viewing the History pane, you must select this menu item.

Remove Job

Clears the selected job listed in the Job History page.

Job Library

The Job Library dialog contains a list of the jobs that you have created and saved. In the dialog, you can view summary information about a job:

These jobs can be submitted to the job system with the Submit button. You can use the Edit button to modify a job selected in this page. You can also double-click on a job listed in the Job Library page to edit the job. You can create a new job based on an existing job with the Create Like button.

Creating, Modifying, or Viewing a Job

When you create, modify, or view details of a job, similar property sheets display. See Figure 5-3, "Job Tasks Page" 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

  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. Select the Submit option and click Submit to send the job to the Intelligent Agents at the selected destinations. The job appears in the Active page.

      - OR -

    2. Select the Add to Library option and click Add. The job appears in the Job Library. You can modify or submit a saved job at a later time.

      - OR -

    3. Select the Submit and Add to Library option and click Submit and Add to send the job to the Intelligent Agents at the selected destinations and save the job to the job library. The job appears in the Active page and the Job Library. You can modify or submit a saved job at a later time.

    Note:

    There is usually a slight delay between the time you submit the job and Intelligent Agent notification.

General Page

The General page allows you to specify the primary attributes of a job, such as, job name, description, target type, targets, etc.

Figure 5-2 Job General Page

Text description of jobgen.gif follows.

Text description of the illustration jobgen.gif

Job Name

Enter the name of the new job.

Description

Enter the optional description of the job.

Target Type

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

Override Node Preferred Credentials for Entire Job

Allows the submitted job to bypass the Console's current preferred credential settings and use a specified Username and Password.

Selected Targets/Available Targets

Select the targets of the job in the Available Targets list and click the Add button to move the target to the Selected Targets list. The targets are determined by the Job Type. The targets include databases, listeners, nodes, HTTP Servers, 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 targets. See "Discovering Targets" for more information.

Job Task Page

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

Available Tasks

Tree list of available job tasks. Tasks vary depending on the Target Type selected on the General page. 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. See the online help for Oracle job tasks and "Oracle Job Tasks" for information on Oracle predefined job tasks and their parameters.

Job Tasks

Tasks currently selected for the current job. You can remove tasks from this list by selecting the task and clicking on the >> (Remove) button.

Up/Down Arrows

Use the arrow buttons to change the order of the tasks or to make a task conditional on a previous task. Select a task in the Job Tasks list and click on the up or down arrow button to position the task.

Figure 5-3 Job Tasks Page

Text description of jobtasks.gif follows.

Text description of the illustration jobtasks.gif

Conditions for running a task

Select a task in the Job Tasks window and select from the following:

Note:

If any task does not execute, control moves to the next task on the same level as the task that did not execute.


Important:

If your targets are running with pre-9i Intelligent Agents, you can add up to five job tasks per job. Adding more than five tasks will generate an error message stating the maximum number of input files have been exceeded. This limitation does not apply to targets running 9i Intelligent Agents.



Stopping Jobs

Normally, a job stops when all tasks have been executed. In some cases, you may want the job to stop before completing the task sequence, which might be the case when one task in the sequence fails. To handle situations like this, you can include the Halt Job task as part of a composite job to stop execution at any point within the task sequence. You specify the Halt Job task dependency as you would any other task.

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.

Figure 5-4 Job Parameters Page

Text description of jobparms.gif follows.

Text description of the illustration jobparms.gif

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. See the online help for Oracle job tasks and "Oracle Job Tasks" for information on Oracle predefined job tasks and their parameters.

For some jobs, you can override the preferred credentials for connecting to the service. This allows you to enter a username and password. See "Job Credentials" and "Preferred Credentials" for information on administrator preferences.

Job Schedule Page

The Schedule page allows you to schedule the execution of the job task. Select the frequency that you want the task executed. The choices are Immediately, Once, On Interval, On Day of Week, On Date of Month, or As a Fixit Job.

Figure 5-5 Job Schedule Page

Text description of jobsched.gif follows.

Text description of the illustration jobsched.gif

Immediately

Submits the task as soon as you finish the setup process. The task executes only one time.

Once

Schedules the task only one time at the date and time you choose.

On Interval

Allows you to schedule a specific time interval between task executions. The interval can be a combination of hours and minutes, or number of days. Select the value you want to change and click on the scroll buttons. You can also type in a new value.

On Day of Week

Allows you to schedule the task on one or multiple days (Sunday, Monday, etc.) of the week. Click on the days of the week to select the days you want the task scheduled.

On Date of Month

Allows you to schedule the task on one or multiple days (1 - 31) of the month. Click on the dates of the month to select the dates you want the task scheduled.

Note: If you choose a day, such as 31, that is not in a month, the job will not be run in that month. 

As a 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 target 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 property sheet's Fixit Jobs page after it has been successfully submitted to an Intelligent Agent. For information on fixit jobs with events, see "Event Fixit Jobs Page".

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.

Select the month, day, or year in the Date field and click on the scroll buttons to change the value. You can also type in new values.

Select the hour, minute, or AM/PM in the Time field and click on the scroll buttons to change the value. You can also type in new values.

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

Static text displaying the time zone to be used for job execution.


Note:

Only the Agent time zone is available with this release. Here, the Intelligent Agent schedules the task execution at each target based on the actual system time of each Intelligent Agent. Tasks are not necessarily run simultaneously.


Job Access Page

Determine the permissions that you want to assign to administrators with the Access page. This allows other administrators to view or modify the job. Notifications can be assigned with this page. Any permissions assigned on this page supersede any user default permissions that have been assigned with User Preferences.

Figure 5-6 Job Access Page

Text description of jobacces.gif follows.

Text description of the illustration jobacces.gif

None

Does not allow the administrator to view this job anywhere.

View

Allows the administrator to view the job and inspect job properties.

Modify

Allows the administrator to suspend and resume the job. The administrator will also be able to enable notifications for active jobs.

Full

Allows the administrator to delete the job from the Active or History pages of the Job window, modify permissions for other administrators, and enable notification.

Notify

Allows the administrator to receive enhanced notifications (paging and email) for the job. Notify permission cannot be assigned if the administrator's permission level is set to None.


Note:

All administrators possessing at least the View permission will receive notifications through the Console when a job is executed.


Any permissions assigned on this page supersede any administrator default permissions. See "Access" for more information.

Show Notification Schedule

Show Notification Schedule displays when administrators are scheduled to receive notifications.

To remove an administrator from receiving an enhanced notification, display the context menu (press the right mouse button) on any time block. The context menu provides options for adding and removing recipients of the notifications. Administrators that appear via the Add Recipient and Remove Recipient menu options are those whose schedules match the selected time slot.

Skipped Job Notification

When using a 9i version of the Intelligent Agent, notifications are also sent to administrators whenever a job is skipped, as might be the case when the Intelligent Agent is unavailable, when the target is blacked out (see the Intelligent Agent User's Guide for more information), or when the length of previous job executions run beyond the time the next execution is scheduled to begin.

Job Progress Page

The Job Progress page is available for jobs in the Active and History pages of the Job window. The Progress page provides a log of the job's activities.

The Progress page contains all status changes 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, Started, and Completed or Failed statuses for that execution. If you display an execution from the Active Jobs page, the Progress page displays only those status changes that have been received.

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

The following options are available on the Progress page:

Target

Select the target 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 List

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

Notification Details

This option displays the notifications for this job.

Show Output

If output exists for the selected occurrence of a job, you can display the output in the Output dialog box. You can also double-click on a selected job to display output.

The columns in the Progress page contain the following information:

Status

See "Active Job Page" and "History Page" for information on the status of a job.

Target

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

Date/Time

This is the time the Management Server was notified by the Intelligent Agent that a status change had occurred.

Job Output Dialog Box

The Output dialog box is displayed by double-clicking on an entry in the Progress page, or selecting an entry and clicking on the Show Output button, if enabled. This dialog displays any output, including error messages, as a result of the execution of an occurrence of a job. If no output is produced by a job, a message displays stating 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:

Close

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

Save As

Select the Save As button to save the contents of the dialog box to a text file.

Changing the Maximum Limit for Job Output

Because the output of some jobs may be quite large, Oracle Enterprise Manager provides you with the option of specifying the maximum size for any job output returned by the Intelligent Agent. If the job output exceeds the maximum limit, any output generated beyond this maximum is truncated. By default, the maximum job output size is set to 128K (smallest allowable value). The largest permissible value is two megabytes.

You can set this parameter (oms.vdg.joboutput.maxsize) in the following file:

$ORACLE_HOME/sysman/config/omsconfig.properties

Example omsconfig.properties entry:

oms.vdg.job_output_maxsize=128K

Units must be specified in kilobytes (K) or megabytes (M).

Modifying Active Jobs

Certain job properties can be dynamically modified for submitted jobs in the Active Jobs page. These job properties are: job targets, job permissions, and enabling notification. Dynamic modification of these properties means you can select the active job, change the properties and apply the changes. The changes will be dynamically applied to all targets of the job. The other job properties (tasks, task parameters, and job schedule) are currently not dynamically modifiable. See the next section Modifying Active Jobs for more information.

The owner of the job, i.e., the Enterprise Manager administrator that submitted the job, can change any of the dynamically modifiable properties: targets, permissions, notification. Administrators who have "Full" permission for the job can change the job permissions and enable notifications for any administrator. Administrators who have "Modify" permissions.

Alternative Method of Modifying an Active Job

If you want to change other job attributes besides targets, permissions, and notifications, you need to first delete the job from the Active page, then re-submit the job with the necessary changes. It is more convenient to save the job definition first in the Job Library, and then make the necessary changes. You must be the job owner in order to modify it.

  1. If you have not already done so, copy the job to the Job Library using the Copy to Library menu option.

  2. Select Job Library from the Job menu. The Job Library dialog appears.

  3. Select the job from the library.

  4. Click Edit. The Job property sheet appears.

  5. Update the pages of the Job property sheet and determine whether the job is ready to submit.

    1. Select the Submit option and click OK to submit the job to the Intelligent Agents at the selected destinations. The job appears in the Active window.

      - OR -

    2. Select the Save to Library option and click OK. The job appears in the Job Library. You can modify or submit a saved job at a later time.

      - OR -

    3. Select the Submit and Save to Library option and click OK to submit the job to the Intelligent Agents at the selected destinations and save the job to the job library. The job appears in the Active window and the Job Library. You can modify or submit a saved job at a later time.

Viewing Job Details

To view the details of a particular job, double-click on a job in the Active or History Job pane. The Job property sheet for that job appears.

Example: Creating a Job

This example illustrates how to complete the General, Tasks, Parameters, and Schedule Pages when creating a job. It also describes how to save and submit a job.

  1. Select Create from the Job menu to create a new job. The Create Job property sheet displays.

  2. Enter a name for the new job in the Job Name field of the General Page. You may also enter a description for the job in the Description field.

  3. Select Database from the Target Type pull-down list.

  4. Select a target from the Available Targets list, then click on the << (Add) button to add the target to the Selected Targets list. These are targets where an Intelligent Agent is running. The Job Credentials must be set up correctly for these targets. See "Job Credentials" for more information.

  5. Repeat the previous step for another target. You are choosing the targets where the job will be run.

  6. Click on the Task Page tab of the Create Job property sheet.

  7. Select Run SQL*Plus Script from the Available Tasks list, then click the << (Add) button to add the task to the Selected Tasks list. For this example, add only the Run SQL*Plus task. You can specify multiple tasks for a job and make a task conditional on a previous task.

  8. Make sure the task is set to run Always. If you specified multiple tasks for this job, you could make a task conditional on a previous task.

  9. Click on the Parameters Page tab of the Create Job property sheet to set the parameters:

    • Enter "SELECT * FROM dba_users;" in the Script Text box.

    • Do not check the Override Preferred Credentials box. If you do not override the credentials, the information that is set up with the administrator Preferred Credentials property sheet is used. See "Job Credentials" for permissions needed to run job tasks. This particular job task requires database credentials that permit access to the data dictionary views. Make sure the Preferred Credentials for the chosen target have this.

  10. Click on the Schedule Page tab of the Create Job property sheet to schedule the execution of the job.

  11. Select the On Interval under Run Job to execute the job on a specific interval.

  12. Set the Start Execution Date of the job to 9/1/2001. Select the month value in the Start Execution Date field and enter 7. You can also click the up and down arrows to change the value when a number is selected.

  13. Repeat the process in the previous step for the day and year values of the Start Execution Date.

  14. Change the Start Execution Time to 12:00 AM. Use the same procedure that you used to set the date.

  15. Check the End Execution box to set a final execution date for this job.

  16. Set the End Execution Date of the job to 9/3/2001. Set the End Execution Time of the job to 12:00 AM.

  17. The Time Zone should be set to Intelligent Agent (currently static text). This job will execute at the local time zone where the Intelligent Agent is located. This is the time zone of the destination.

  18. Select the Every ... Days button to set the job frequency for day interval. Click on the up arrow to change the value to 3 days.

  19. Click on the Access Page tab of the Create Job property sheet to assign permissions on this job for other administrators.

  20. Allow all other Enterprise Manager administrators to view and receive notifications for this job.

  21. Click the Submit and Add to Library button to save the new job in the Job Library and submit the job to the selected destinations.

  22. If you want to modify this job later, select the job in the Job Library dialog and choose the Edit option. You can also double-click on the job.

A submitted job is sent to the Intelligent Agents at the selected destinations. The Intelligent Agent for a target begins processing the job, the job appears in the Active Jobs page in the Job window. If the job is processed successfully, the job will start executing on 9/1/2001 at 12:00 AM. After an execution of a job, it is moved to the Job History page of the Job window. You can view the progress of the job and any output in the Job Progress Page.


Note:

If you have a domain user set up, you must set the domain password to be the same as the local password in order for scheduled jobs to run when they are submitted using the domain user account. (Windows NT only)


Required Administrator Permissions

The following table summarizes the permissions required to perform various activities against jobs in the Enterprise Manager Console. The owner of a job refers to the Enterprise Manager administrator that submitted the job.

Table 5-1 Administrator Permissions for Jobs
Action None View Modify Full Owner Super User Comments

JOBS - Dynamic modification

Add/remove targets

No

No

No

No

Yes

No

 

Change permissions, including your own permissions

No

No

No

Yes

Yes

Yes

 

Set Notification checkbox for any administrator

No

No

Yes

Yes

Yes

Yes

 

Change all other job properties: tasks, parameters, fixit job, schedule

No

No

No

No

No

No

Not supported in 9i

Change owner

No

No

No

No

No*

No

* New behavior. When and administrator is deleted, all jobs are reassigned to the new owner.

JOBS - In the Library

Change owner (library)

No

No

No

Yes

Yes

Yes

 

Add/remove targets

No

No

Yes

Yes

Yes

Yes

 

Change description, tasks, parameters,

schedule, fixit job

No

No

Yes

Yes

Yes

Yes

 

Change permissions; enable/disable

Notify preferences

No

No

Yes

Yes

Yes

Yes

 

Delete job

No

No

No

Yes

Yes

Yes

 

Submit job from the library

No

Yes

Yes

Yes

Yes

Yes

 

JOBS - In the Console

Delete active job

No

No

No

No

Yes

Yes

 

Clear history

No

No

No

Yes

Yes

Yes

 

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.

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 the Oracle Enterprise Manager Configuration Guide for more information.

Enterprise Manager Wizard Database Tasks

Specific database job tasks are used by the Enterprise Manager data and backup management wizards that are accessed through the Console Navigator popup and main menus. The job tasks are:

Since these job tasks are used only by their respective wizards, the tasks will not have directly editable parameters. To modify parameters for any Wizard database task, click on the Load Wizard button located on the Parameters page of the Job property sheet to activate the associated Wizard. For more information about these wizards and associated job tasks, see the Enterprise Manager online help.

Run SQL*Plus Script

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 copy and paste the text of the script into the Script Text box of the Parameters page (Create Job property sheet), or simply type SQL commands in the Script Text box.

Parameters:
  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 "Preferred Credentials" for more information.

  3. Script Text. You can copy and paste your script into the Script Text 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.

Parameters:
  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 "Preferred Credentials" for more information.

  2. Script Text. You can copy and paste your script into Script Text box.

Shutdown Database

This job task shuts down an Oracle database instance.

Parameters:
  1. Mode:

    • Immediate

    • Abort

  2. Connect As:

    • SYSDBA

    • SYSOPER

  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 "Preferred Credentials" 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:

    • Startup instance, mount, and open database

    • Startup instance and mount database

    • Startup instance only

  2. Parameter File. Enter the initialization parameter filename you want to use for the database. This file is located on the node where the Intelligent Agent and database reside. For example with a database on a Unix platform:

    /private/oracle/admin/ora8db/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 "Preferred Credentials" for more information.

  4. Mount Mode. Select the mount option from the pull-down list:

    • Exclusive

    • Normal

    • Parallel

  5. Connect As. Select the connecting role from the pull-down list:

    • SYSDBA

    • SYSOPER

  6. Restrict Connections. Check this box if you want to start the database in Restricted mode.

  7. Force Startup. Check this box if you want to start up the database with the Force option. Refer to the Oracle 8i Administrator's Guide for more information on startup options.

Halt Job

Normally, a job stops when all tasks have been executed. In some cases, you may want the job to stop before completing the task sequence, which might be the case when one task in the sequence fails. To handle situations like this, you can include the Halt Job task as part of a composite job to stop execution at any point within the task sequence. You specify the Halt Job task dependency as you would any other task.

Operating System or Node 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 target using the platform-specific mechanism. To send the message to a target, 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 a Windows platform, this task sends the message to ALL users on the network. To send a message to specific users, 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:
  1. OS command or shell script name. The command or script must be accessible from the node where the Intelligent Agent and database reside. You may have to include the path for the Intelligent Agent to locate and execute the command or script. For example: ls

  2. 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 "Preferred Credentials" for more information.

Parameters:
  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]}


  1. Script Text. Type or copy the Tcl script into the Script Text box. To use an existing script file, click Import to display the Import File dialog.

Tcl Script Examples

For information on writing Tcl job tasks, see the Intelligent Agent User'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 Intelligent 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]
while {$oramsg(rc) == 0} {
   puts $result_row
   set result_row [orafetch $cur1]
}
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@or817.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 that has the "Unsolicited events" box checked. See "Event General Page" for more information.

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. See "Preferred Credentials" for information on user preferences.

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. See See "Preferred Credentials" for information on user preferences.

Parameters:

None


Important:

See "Numeric Pager Job/Event Ids" for specific ids.


HTTP Servers

These job tasks provide limited control your web servers. Although you can start or stop a managed HTTP server directly from the Console Navigator, you can also use the Job system directly to schedule web server shutdowns or startups.

No parameters are required for either job task.

Job Tasks Run through Wizards

Some Enterprise Manager wizards and applications use the job system to perform specific operations. Job tasks used by these wizards/applications appear in the job tasks list, but cannot be used directly as with regular job tasks discussed in the previous section. If one of these job tasks is selected, a button appears on the Job property sheet Parameters page allowing you to start the related application/wizard. The following job tasks are used in conjunction with specific wizard/applications:


Go to previous page Go to next page
Oracle
Copyright © 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index