Create and Monitor Jobs
A job is an Oracle Cloud Infrastructure resource that enables you to create and asynchronously execute SQL jobs on a single Managed Database or all the Managed Databases in a Database Group.
Before you create a job and monitor its runs and executions, you must:
- Review and complete the tasks given in Get Started with Diagnostics & Management. Note that to create Query type jobs, you must have additional Oracle Cloud Infrastructure Object Storage service permissions. For information, see Additional Permissions Required to Use Diagnostics & Management.
- Create a Database Group, if you want to create a job for all the databases in the Database Group.
To go to the Jobs section:
- Sign in to the Oracle Cloud Infrastructure console.
- Open the navigation menu, click Observability & Management. Under Database Management, click Diagnostics & Management.
- Depending on whether you want to create a job for a single Managed
Database or a Database Group, go to one of the following pages:
- Managed database details page. For information, see Monitor and Manage a Specific Managed Database.
- Database group details page. For information, see Create and Use Database Groups.
- On the left pane under Resources, click Jobs.
The following tabs are displayed in the Jobs section:
- Definitions: On this tab, you can create a job and view the jobs that are in the Active state and were created within the time period selected in the Time period field.
- Runs: On this tab, you can monitor job runs and executions.
Create a Job
You can create a SQL job to perform administrative operations on a single Managed Database or a Database Group.
The information provided when creating a job is to enable the following components to connect and interact:
- The single Managed Database or the Database Group on which the job will be executed.
- For External Databases, the Oracle Cloud Infrastructure Management Agent that is installed on a host and has a
connection to the External Database is used to execute the job.
Note
The Management Agent is not required for Oracle Cloud Databases and Autonomous Databases. - The Oracle Cloud Infrastructure Object Storage bucket in which job results for a Query type job are stored.
To create a job:
You can click the Actions icon () for the job and perform the following tasks:
- View details: Click to go to the Job details page and view the details of the job, job runs and executions, the associated Managed Databases on which the job is executed, and perform tag-related tasks. For more information, see Monitor Job Runs and Executions.
- Clone job: Click to clone the job.
- Edit job: Click to edit the details of scheduled repeating jobs in Active state.
- Move job: Click to move the job from the current compartment to another compartment.
- Delete job: Click to delete the job.
On the Runs tab in the Jobs section, you can view the associated job runs and executions. The job runs for the time period selected in the Time period field are displayed along with an overview of the status of the job executions: Succeeded, Failed, and In progress. You can click the execution status links to filter the executions by status.
You can build metric queries and
create alarms on the job execution status in the Oracle Cloud Infrastructure Monitoring service using the
dbmgmtJobExecutionsCount
metric. For more information, see
Database Management Metrics for Oracle Databases.
Here's an example of a query that you can use to create a "failed job" alarm:
dbmgmtJobExecutionsCount[1m]{managedDbId = "<OCID of the Oracle Database>", status = "Failed"}.mean()
In the query, the managedDbId
dimension is used to
notify you of any failed jobs for the Managed Database whose OCID is mentioned in
the query. Similarly, you can use the following dimensions:
managedDbGroupId
: To be notified of failed jobs for all the Managed Databases in a Database Group.jobId
: To be notified if a particular job fails.
For more information on how to create an alarm, see Creating a Basic Alarm.
Monitor Job Runs and Executions
You can monitor the runs and executions of a submitted job for a Managed Database or Database Group. A job execution is created for each of the Managed Databases associated with the job, and a job run is the sum of executions of a specific job that ran on a scheduled date.
To view the job runs and executions:
- Go to the Managed database details or Database group details page.
- On the left pane under Scope, ensure that the compartment in which the job was created is selected.
- On the left pane under Resources, click Jobs.
- In the Jobs section, click the Definitions tab and then click the name of the job. Alternatively, you can also click the corresponding Actions icon () and click View details.
The Job details page is displayed and it provides the details of the job, job runs and executions, and the associated Managed Databases on which the job is executed. On this page, you can perform tasks such as editing, moving, and deleting the job and using tags. In addition, you can also monitor each job execution and its status. To do so:
- In the Job runs section, expand a job
run, and click a job execution link.
The job execution link is in the following format:
<Name of job>_<Name of Managed Database>_YYYY-MM-DD'T'HH:MM:SS.SSS
- On the Job execution details page, review the details such as the job execution status, the SQL associated with the execution, and the duration of the job execution. Note that the duration is the time taken for the entire job execution workflow to complete and not just the time taken for the SQL to execute on the database.
- For a Query type job, click
Download output to download the job
execution output to a
.txt
file.Note
The Download output option is only available for Query type jobs and you can use this option only if you have the required Oracle Cloud Infrastructure Object Storage service permissions. For more information, see Additional Permissions Required to Use Diagnostics & Management.