Creating an OS Command Job

Use this type of job to run an operating system command or script. Tasks and their dependent steps for creating an OS command are discussed below.

Task 1: Initiate Job Creation

  1. From the Enterprise menu, select Job, then Activity.

  2. Click Create Job. The Select Job Type dialog displays.

  3. Choose the OS Command job type and click Select.

Task 2: Specify General Job Information

Perform these steps on the General property page:

  1. Provide a required Name for the job, then select a Target Type from the drop-down.

    After you have selected a target of a particular type for the job, only targets of that same type can be added to the job. If you change target types, the targets you have populated in the Targets table disappear, as well as parameters and credentials for the job.

    If you specify a composite as the target for this job, the job executes only against targets in the composite that are of the selected target type. For example, if you specify a target type of host and a group as the target, the job only executes against the hosts in the group, even if there are other non-host targets in the group. You can also include clusters in the target list if they are of the same base target type. For example, a host cluster would be selected if the target type is "host" and a RAC database would be selected if the target type is database.

  2. Click Add, then select one or more targets from the Search and Select: Targets pop-up window. The targets now appear in the Targets table.

  3. Click the Parameters property page link.

Task 3: Specify Parameters

Perform these steps on the Parameters property page:
  1. Select either Single Operation or Script from the Command Type drop-down.

    The command or script you specify executes against each target specified in the target list for the job. The Management Agent executes it for each of these targets.

    Depending on your objectives, you can choose one of the following options:

    • Single Operation to run a specific command

    • Script to run an OS script and optionally provide an interpreter, which processes the script; for example, %perlbin%/perl or /bin/sh .

    Sometimes, a single command line is insufficient to specify the commands to run, and you may not want to install and update a script on all hosts. In this case, you can use the Script option to specify the script text as part of the job.

  2. Based on your objectives, follow the instructions in Specifying a Single Operation or Specifying a Script.

  3. Click the Credentials property page link.

Note:

The OS Command relies on the target host's shell to execute the command/interpreter specified. On *nix systems, it is /bin/sh -c and on Windows systems, it is cmd /c. The command line specified is interpreted by the corresponding shell.

Task 4: Specify Credentials - (optional)

You do not need to provide input on this page if you want to use the system default of using preferred credentials.

On the Credentials property page, you can specify the credentials that you want the Oracle Management Service to use when it runs the OS Command job against target hosts. The job can use either the job submitter's preferred host-based credentials for the selected targets, or you can specify other credentials to override the preferred credentials.

You do not need to provide input on this page if you have already set preferred credentials.

Tip:

preferred credentials are useful when a job is submitted on multiple targets and each target needs to use different credentials for authentication.

  • To use preferred credentials:

    1. Select the Preferred Credential radio button, which is the default selection.

      If the target for the OS Command job is a host or host group, the preferred host credentials are used. You specify these for the host target on the Preferred Credentials page, and they are different from the host credentials for the host on which the database resides.

    2. Select either Normal Host Credentials or Privileged Host Credentials from the Host Credentials drop-down.

      You specify these separately on the Preferred Credentials page, which you can access by selecting Security from the Setup menu, then Preferred Credentials. The Preferred Credentials page appears, where you can click the Manage Preferred Credentials button to set credentials.

  • To use named credentials:

    1. Select the Named Credential radio button to override database or host preferred credentials.

      The drop-down list is a pre-populated credential set with values saved with names. These are not linked to targets, and you can use them to provide credential and authentication information to tasks.

  • To use other credentials:

    1. Select the New Credential radio button to override previously defined preferred credentials.

      Note that override credentials apply to all targets. This applies even for named credentials.

    2. Optionally select Sudo or PowerBroker as the run privilege.

      Sudo enables you to authorize certain users (or groups of users) to run some (or all) commands as root while logging all commands and arguments. PowerBroker provides access control, manageability, and auditing of all types of privileged accounts.

      If you provide Sudo or PowerBroker details, they must be applicable to all targets. It is assumed that Sudo or PowerBroker settings are already applied on all the hosts on which this job is to run.

      See your Super Administrator about setting up these features if they are not currently enabled.

      Tip:

      For information on using Sudo or PowerBroker, refer to the product guides on their respective product documentation pages.

Task 5: Schedule the Job - (optional)

You do not need to provide input on this page if you want to proceed with the system default of running the job immediately after you submit it.
  1. Select the type of schedule:

    • One Time (Immediately)

      If you do not set a schedule before submitting a job, Enterprise Manager executes the job immediately with an indefinite grace period. You may want to run the job immediately, but specify a definite grace period in case the job is unable to start for various reasons, such as a blackout, for instance.

      A grace period is a period of time that defines the maximum permissible delay when attempting to start a scheduled job. The job system sets the job status to Skipped, if it cannot start the execution between the scheduled time and the time equal to the scheduled time plus the grace period, or within the grace period from the scheduled time.

    • One Time (Later)

      • Setting up a custom schedule:

        You can set up a custom schedule to execute the job at a designated time in the future. When you set the Time Zone for your schedule, the job runs simultaneously on all targets when this time zone reaches the start time you specify. If you select each target's time zone, the job runs at the scheduled time using the time zone of the managed targets. The time zone you select is used consistently when displaying date and time information about the job, such as on the Job Activity page, Job Run page, and Job Execution page.

        For example, if you have targets in the Western United States (US Pacific Time) and Eastern United States (US Eastern Time), and you specify a schedule where Time Zone = US Pacific Time and Start Time = 5:00 p.m., the job runs simultaneously at 5:00 p.m. against the targets in the Western United States and at 8:00 p.m. against the targets in the Eastern United States. If you specify 5:00 p.m. in the Agent time zone, the executions do not run concurrently. The EST target would run 3 hours earlier.

      • Specifying the Grace Period:

        The grace period controls the latest start time for the job in case the job is delayed. A job might not start for many reasons, but the most common reasons are that the Agent was down or there was a blackout. By default, jobs are scheduled with indefinite grace periods.

        A job can start any time before the grace period expires. For example, a job scheduled for 1 p.m. with a grace period of 1 hour can start any time before 2 p.m., but if it has not started by 2 p.m., it is designated as skipped.

    • Repeating

      • Defining the repeat interval:

        Specify the Frequency Type (time unit) and Repeat Every (repeat interval) parameters to define your job's repeat interval.

        The Repeat Until options are as follows:

      • Indefinite: The job will run at the defined repeat interval until it is manually unscheduled.

      • Specified Date: The job will run at the defined repeat interval until the Specified Date is reached.

  2. Click the Access property page link.

Task 6: Specify Who Can Access the Job - (optional)

You do not need to provide input on this page if you want to proceed with the system default of not sharing the job. The table shows the access that administrators and roles have to the job. Only the job owner (or Super Administrator) can make changes on the Job Access page.
  1. Change access levels for administrators and roles, or remove administrators and roles. Your ability to make changes depends on your function.

    If you are a job owner, you can:

    • Change the access of an administrator or role by choosing the Full or View access privilege in the Access Level column in the table.

    • Remove all access to the job for an administrator or role by clicking the icon in the Remove column for the administrator or role. All administrators with Super Administrator privileges have the View access privilege to a job. If you choose to provide access privileges to a role, you can only provide the View access privilege to the role, not the Full access privilege. For private roles, it is possible to grant Full access privileges.

    If you are a Super Administrator, you can:

    • Grant View access to other Enterprise Manager administrators or roles.

    • Revoke all administrator access privileges.

      Note:

      Neither the owner nor a super user can revoke View access from a super user. All super users have View access.

    For more information on access levels, see Access Level Rules.

  2. Click Add to add administrators and roles. The Create Job Add Administrators and Roles page appears.

    1. Specify a Name and Type in the Search section and click Go. If you just click Go without specifying a Name or Type, all administrators and roles in the Management Repository appear in the table.

      The value you specify in the Name field is not case-sensitive. You can specify either * or % as a wildcard character at any location in a string (the wildcard character is implicitly added to the end of any string). For example, if you specify %na in the Name field, names such as ANA, ANA2, and CHRISTINA may be returned as search results in the Results section.

    2. Select one or more administrators or roles in the Results section, then click Select to grant them access to the job. Enterprise Manager returns to the Create Job Access page or the Edit Job Access page, where you can modify the access of administrators and roles.

  3. Define a notification rule.

    You can use the Notification system (rule creation) to easily associate specific jobs with a notification rule. The Enterprise Manager Notification system enables you to define a notification rule that sends e-mail to the job owner when a job enters one of these chosen states:

    • Scheduled

    • Running

    • Suspended

    • Succeeded

    • Problems

    • Action Required

    Note:

    Before you can specify notifications, you need to set up your email account and notification preferences. See Using Notifications for this information.

Task 7: Conclude Job Creation

At this point, you can either submit the job for execution or save it to the job library.
  • Submitting the job

    Click Submit to send the active job to the job system for execution, and then view the job's execution status on the main Job Activity page. If you are creating a library job, Submit saves the job to the library and returns you to the main Job Library page where you can edit or create other library jobs.

    If you submit a job that has problems, such as missing parameters or credentials, an error appears and you will need to correct these issues before submitting an active job. For library jobs, incomplete specifications are allowed, so no error occurs.

    Note:

    If you click Submit without changing the access, only Super Administrators can view your job.

  • Saving the job to the library

    Click Save to Library to the job to the Job Library as a repository for frequently used jobs. Other administrators can then share and reuse your library job if you provide them with access privileges. Analogous to active jobs, you can grant View or Full access to specific administrators. Additionally, you can use the job library to store:

    • Basic definitions of jobs, then add targets and other custom settings before submitting the job.

    • Jobs for your own reuse or to share with others. You can share jobs using views or giving Full access to the jobs.

    • Critical jobs for resubmitting later, or revised versions of these jobs as issues arise.