Creating Jobs in Oracle Enterprise Manager Grid Control 10g Release 2

This tutorial describes how to use Oracle Enterprise Manager Grid Control 10g Release 2 to use Jobs.

Approximately 1 hour

Topics

This tutorial covers the following topics:

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.

The screenshots will not reflect the specific environment you are using. They are provided to give you an idea of where to locate specific functionality in the Oracle Enterprise Manager 10g Grid Control console.

Overview

Enterprise Manager provides you an efficient job system. A job is a schedulable unit of work that you define to automate commonly run tasks. You can use the job system to create, edit, and manage jobs.


A job will comprise a name, description, owner, parameters, targets, and schedule. A job can consist of a single task or multiple tasks. You can schedule a job to automate the task. A job consists of steps. Each step is an executable unit. You can define jobs of different types. You can use these different types of jobs to automate a process.
A job can be created on the Job Activity page, Job Library page, and on other Enterprise Manager pages.


You can create a job to execute immediately or schedule it at a later time. When creating a job, you define both the job and its schedule. Setting the schedule is optional: If you do not set the job schedule, the job will be executed immediately. You use the scheduling feature to create jobs that you want to run periodically or at a designated time. You can use jobs to accomplish a number of objectives, such as updating product release information and automating patch jobs, among other things. If you would like a job to be available to other users for sharing and reuse, store the job in the job library.


Oracle Management Service centrally controls the jobs. When a job is running, the information about it is dispatched to all the agents. Therefore, it is important to have an uninterrupted network connection between the Management Services and the Agents.

You can create multiple types of jobs. Few examples are: Backup, Backup Management, CloneHome, DBClone, DBConfig, Export, Multi-Task, and so on.

Back to Topic List

Scenario

Linda can set up various administrative jobs for her environments and schedule them to run at a later stage. One of the jobs that she would like to schedule is to back up some of her databases. This involves other tasks, such as shutting down listeners and the databases. Linda can make use of a multitask job for this purpose.


Linda would like to examine the job to see whether the backups were performed successfully and the databases restarted. She would like to see the ones that failed and remedy them.


Back to Topic List

Defining a Backup Job

You can use the Schedule Customized Backup Wizard to back up a database. Alternatively, on the Jobs tabbed page, from the Create Job drop-down list, choose RMAN script to back up a database. You can back up the contents of your database to disk, tape, or both. Online backups are available only when the database is in ARCHIVELOG mode.

A backup job copies important parts of the database such as control files and data files. It safeguards against unexpected data loss and application errors. In case of loss of data, you can reconstruct it by using a backup. The database is shut down and mounted to perform the backup job. You may have to wait for several minutes for the backup operation to complete.

Perform the following steps to create a database backup job:

1.

Open the browser and enter the URL to access the server on which you installed the management service, in the following format:

http://<management service hostname>.<domain>:<port>/em/

The default port value on a machine with no other instances installed on it is 7777. However, if there are other instances running on the machine, then the port may be different.

The Login page will be displayed. Enter the User Name and Password, and then click the Login button.

 

2.

Click Targets.

 

3.

Jobs can be accessed from the Jobs tab or from within the context of a target. You will look at it from a target perspective. Click the Databases tab.

 

4.

Click the database of which you want to take a backup.

 

5.

The home page for the database is displayed. By default, the Home subtab is selected. Click the Maintenance subtab.

 

6.

The Maintenance tab displays links that provide functions that control the flow of data between or outside Oracle databases. It is comprised of several sections that include the following: Data Movement, High Availability, and Software Deployments. Click the Schedule Backup link under the High Availability section to create a database backup job. This link will walk you through a wizard to back up the contents of your database to disk, tape, or both.

 

7.

You are prompted to enter the username and password to verify the database credential. You can save the username and password as the preferred credential. To do this, select the Save as Preferred Credential check box. Only a database administrator can take a backup of a database. Therefore, from the Connect As drop-down list, choose SYSDBA. Click Login.

Note: You will be prompted to enter the username and password only the first time. Thereafter, it will take the database credentials from the cache.

 

8.

From the Schedule Backup Wizard, you can select either Oracle-suggested backup or Customized backup. Oracle-suggested backup is based on your disk, tape, or disk and tape configuration. Using Customized backup, you can schedule your own backup jobs with more flexibility. Customized backup jobs are influenced by the database configuration.

In the Customized Backup section, the Whole Database option is selected by default.

 

9.

Scroll down to enter the Host Credentials.

 

10.

Click the Schedule Customized Backup button.

 

11.

You can use the Options page of the Schedule Customized Backup Wizard to:
Choose a full backup
Choose an incremental backup
Use a proxy copy supported by media management software to perform the backup
Delete obsolete backups

You use the Full Backup option to back up all the blocks into the backup set. It takes a backup of archived redo log files and control files.

 

12.

Click Next.

 

13.

You can use the Settings page of the Schedule Customized Backup Wizard to specify the media type on which to take the backup of the database. You can select either Disk or Tape here. Select Disk as the media on which the backup is to be taken. You can change the default path by clicking the Override Current Settings button. Click Next.

 

14.

Specify a name for the job. Also, in the Job Description field, specify the purpose of this job. Choose the Time Zone. Specify when you want to run this job. The Immediately option is selected by default here. Click Next.

 

15.

On the Review page, you get one last chance to change the job settings. It gives you the summary of the job. You can review the RMAN script and change it if you want. Click Submit job to create the job.

 

16.

You have successfully created the job. Click OK.

 

Back to Topic List

 

Creating a Multitask Job

Multitask jobs enable you to create complex jobs consisting of one or more tasks. You can create multitask jobs against targets of the similar type or of different types. You can create a multitask job consisting of two tasks, each a different job type, operating on two separate (and different) target types. For example,
Task 1 (OS Command job type) performs an operation on Host 1.
If Task 1 is successful, run Task 2 (SQL Script job type) against Database1 and Database 2.

You can run a multitask job against any target. You must select the appropriate targets for a particular job type. Not all job types can be used as tasks. After a target of a particular type is selected for the job using the Target Type drop-down list (for example, Database Instance), only targets of the same type can be added to that job. You can choose to run the job against the same targets for all tasks or different targets for different tasks. Each task of a multitask job is considered a complete job.

Here, you create a multitask job against targets of the similar type.

 

1.

Click the Jobs tab.

 

2.

By default, the Job Activity subtab is selected. From the Create Job drop-down list, select Multitask

 

3.

Click the Go button.

 

4.

The Create Multitask page is displayed. Click the General subtab to enter job-related information. Enter a name for the job and a description. In the Targets drop-down list, you see two options: "Same targets for all tasks" and "Different targets for different tasks." "Same targets for all tasks" enables you to create multitask jobs against targets of the similar type. Using "Different targets for different tasks," you can operate on two separate (and different) target types. Here, select the Same targets for all tasks option. From the Target Type drop-down list, select Database Instance.

 

5.

In the Targets section, click the Add button.

 

6.

A pop-up window appears. The Target Type selected is Database Instance. Select the database for which you want to create a job.
Note: You can choose more than one database instance here.

 

7.

Click the Select button.

 

8.

Select the database selected under the Targets section.

 

9.

Click the Tasks subtab.

 

10.

Under the Type drop-down list, select Shutdown Database.

 

11.

Click the Add button to add the job type.

 

12.

The Add ' Shutdown Database' Task page is displayed. On the General subtabbed page, specify a name to the job in the Name field. Click the Parameters subtab.

 

13.

A database can be shut down in four different ways:
Normal: Before the database is shut down, Oracle waits for all currently connected users to disconnect from the database.
Transactional: No new connections are allowed. However, it waits for the already connected clients to finish the transaction before disconnecting.
Immediate: No new connections are allowed. Any uncommitted transactions are rolled back.
Abort: Oracle does not wait for users currently connected to the database to disconnect. Oracle implicitly disconnects all connected users.
Select Immediate because the next startup of the database will not require any instance recovery procedures.

 

14.

Click the Credentials subtab.

 

15.

Under Credentials, you can either use the preferred credentials or override them. Here, select Override Preferred Credentials. Enter the host credentials as well as the database credentials. Under SYSDBA Database Credentials, from the Role drop-down list, select SYSDBA.

 

16.

Click Continue.

 

17.

The Tasks page is displayed again. You can select the second task here. Select Startup Database from the Type drop-down list.

 

18.

Click the Add button.

 

19.

Specify a name for the task.

 

20.

Click the Parameters tab.

 

21.

In the Startup mode section, select Open the database. This will start the instance, and mount and open the database.

 

22.

Click the Credentials subtab.

 

23.

Click Override Preferred Credentials. Enter the host credentials and the database credentials. From the Role drop-down list, under SYSDBA Database Credentials, select SYSDBA.

 

24.

Click Continue.

 

25.

On the Tasks page, you can set task condition and dependency logic. You can also add task initialization error–handling process.
To set Condition and Depends On options, you need to have at least two tasks. Task conditions define states in which the task will be executed.
Always: Task is executed each time the job is run.
On Success: Task execution depends on the successful execution of another task.
On Failure: Task execution depends on the execution failure of another task.

You need to specify the condition for the Database Startup job. In the Condition column, select On Success.

 

26.

In the Depends On column, select the DATABASE SHUTDOWN task.

 

27.

Click the Schedule tab.

 

28.

If you do not set a schedule before submitting a job, Enterprise Manager will execute the job immediately with an indefinite grace period. Grace period is the maximum permissible delay allowed when attempting to execute a job. If Enterprise Manager is unable to execute the job within the grace period, the job will be skipped.
One Time (Immediately) is selected by default to run the job once. For Grace Period, Indefinite is selected by default. You can use these default selections.

 

29.

Click the Access subtab.

 

30.

You can add administrators here by clicking the Add button. You can select either the Full permission or the View permission. Super administrators always have View access on any job. The Enterprise Manager administrator who owns the job can make any access changes to the job except revoking View from super administrators.

 

31.

Click the Submit button to create the job.

 

32.

You have successfully created a multitask job.

 

 

Back to Topic List

Analyzing a Running Job


The status of a job or a task changes several times during its life cycle. A job can have the following as its status:

Scheduled: The job is created and will run at the specified time.
Running: The job is being executed and is in progress.
Initialization Error: The job or step could not be run successfully. If a step in a job fails initialization, the job status is Initialization Error.
Failed: The job was executed but failed.
Succeeded: The job was executed completely.
Stopped: The user canceled the job.
Stop Pending: The user has stopped the job. The already running steps are completing execution.
Suspended: This indicates that the execution of the job is deferred.
Inactive: This status indicates that the target has been deleted.
Reassigned: The owner of the job has changed.
Skipped: The job was not executed at the specified time and has been omitted.

You now see the progress of the jobs that you created and the status change of these jobs.

Analysis of backup job

Analysis of multitask job

Note: Because the job is scheduled to run immediately, you need to check the status as soon as you create the job.

Analysis of a Backup Job

 

1.

Click the Jobs tab. By default, the Job Activity subtab is selected. You can see the backup job that you created. The status of the job shows running. Click the job.

 

2.

You can see the status of the job. It shows Running.

 

3.

A job can have multiple steps. Here, you can see the steps used for backing up the database. The job is running but not complete.

 

4.

You can further drill down to the steps. The status for Step: Backup still shows running. You can drill down further by clicking this link.

 

5.

You can see the job status here. You can even see the progress of the job.

 

6.

You can stop the job by clicking the Stop button.

 

7.

You can see that the job has completed successfully.

 

Analysis of a Multitask Job

You now see the multitask job analysis.

1.

Click the Jobs tab, and then the Job Activity subtab. Click the multitask job that you created.

 

2.

You can see that the job is running. The database shutdown task is completed. You can see that the database startup task is in progress.

 

3.

You can drill down the Database Startup step to see the progress of the job. Click the Task: DATABASE STARTUP link.

 

4.

The step has completed successfully.

 

5.

You can drill down further to see the process. Click Step: Command to see the steps.

 

6.

Here, you see the complete information about the progress of the job.

 

7.

The home page shows you that all the steps of this job are now complete.

 

 

Back to Topic List

Saving a Job to the Library

The Job Library enables you to share and reuse jobs that have been created. You can save a job in the Job Library. You can use the Job Library page to display and manage jobs in the Enterprise Manager Job Library.

In this section, you learn to save the multitask job that you created to the library.

1.

Here, you see the multitask job that you created. You add this job to the Job Library.

 

2.

Select the job that you just created. Click the Copy To Library button.

 

3.

Provide a different name to the job to avoid any conflicts. Select the database against which you want to create the job.

 

4.

Click the Save To Library button.

 

5.

You have successfully saved the job to the library.

 

6.

You can see the saved job under the Job Library tab.

 

 

Back to Topic List

Running a Job Against a Group and Giving Other Administrators Access to this Job

You can run a job against a group as well, instead of just the target. You can create a regular job as well as a multitask job against a group. You can add other administrators or roles to access this group. The super administrator has the View privilege on the jobs.

In this section, you learn to create a job against a group and add other administrators to access this job.

1.

Click the Jobs tab. From the Create Job drop-down list, select RMAN Script.

 

2.

Click the Go button.

 

3.

The Create Job page is displayed. Provide a name for the job. In the Description field, specify the purpose of this job.

 

4.

Click the Add button to add a group.

 

5.

A pop-up window appears. Here, from the Target Type, select Group.

 

6.

Select the groups for which you want to create the job.

 

7.

Click the Select button to return to the main page.

 

8.

Select the group under the Targets section.

 

9.

Click the Parameters tab.

 

10.

In the RMAN Script field, specify the script.

 

11.

Click Credentials.

 

12.

Select Override Preferred Credentials. Enter the Host Credentials. Next, enter the database credentials. Under Database Credentials, from the Role drop-down list, select SYSDBA.

 

13.

Click the Schedule tab.

 

14.

By default, One Time (Immediately) is selected.

 

15.

Click the Access tab. Here, you give access to other administrators.

 

16.

On the Access tabbed page, you see the administrators and their permissions for the job. By default, the administrators have the View privilege.

 

17.

You can add other administrators also and give them permissions. For this, click the Add button.

 

18.

This takes you to the Add Administrators and Roles page. Here, from the Type drop-down list, select Administrators or Roles.

 

19.

Click the Go button.

 

20.

Select the administrators or roles. These administrators and roles will have the View privilege on the job.

 

21.

Click the Select button.

 

22.

The Access page is displayed again. Here, you can give Full privilege to the administrator.

 

23.

Click the Submit button to create the job.

 

24.

You have successfully created the job for the group.

 

 

Back to Topic List

 

In this lesson, you learned how to:

Define a backup job
Include multiple tasks
Analyze a running job
Save a job to the library
Run a job against a group and give other administrators access to this job

Back to Topic List

Place the cursor over this icon to hide all screenshots.