# APEX Background Jobs #JoelKallmanDay

# Introduction

I recently watched an excellent presentation by Carsten Czarski from the APEX Development Team on [All Things Background](https://www.linkedin.com/events/7074615676371423232). In his presentation, Carsten touched on several DBMS Scheduler jobs which APEX uses to a) Perform Maintenance activities in your APEX environment and b) Launch scheduled processes such as APEX Automations, REST Source Synchronizations, and Page Background Processes.

In this post, I will review these jobs and explain what they do and when they are scheduled to run.

# Scheduler / Co-Ordinator Jobs

The most interesting jobs for an APEX developer are what Carsten called Scheduler or Co-Ordinator Jobs. These jobs run on a scheduled basis to check if some of your code needs to be run, such as APEX Automations, REST Data Synchronizations, and Background Page Processes.

<div data-node-type="callout">
<div data-node-type="callout-emoji">🕐</div>
<div data-node-type="callout-text">You may notice that when you schedule an APEX Automation or REST Data Source Synchronization for a specific time, your code does not necessarily start at the exact time you specify. This is because the Scheduler / Co-Ordinator Job kicks off your code, and this job has its own schedule.</div>
</div>

## ORACLE\_APEX\_REST\_SOURCE\_SYNC

This job runs every 10 minutes and checks to see if you have scheduled any REST Source Synchronizations to run at that time (or before). If there are any scheduled REST Source Synchronizations, then it runs them.

![Screenshot of REST Data Syncronization](https://cdn.hashnode.com/res/hashnode/image/upload/v1688949139412/a78148ea-4a9b-4675-aa6d-1dd2286c9d52.png align="center")

## ORACLE\_APEX\_AUTOMATIONS

This job runs every 2 minutes (at 5 seconds past the minute) and checks to see if you have scheduled any APEX Automations to run at that time (or before). If there are any scheduled APEX Automations, then it runs them.

![Scheduled APEX Autoomations](https://cdn.hashnode.com/res/hashnode/image/upload/v1688949442044/e6fb270e-ea7e-40da-b9e3-f456b6629d78.png align="center")

## ORACLE\_APEX\_BG\_PROCESSES

This job runs every 2 minutes (at 45 seconds past the minute) and checks to see if any Background Page Processes need to be run. If there are any, then it runs them.

![Oracle APEX Background Page Process](https://cdn.hashnode.com/res/hashnode/image/upload/v1688949638104/0100153a-256c-4f56-b486-128ab9cda83e.png align="center")

## Schedule for Co-Ordinator Jobs

The table below shows the precise schedule that the Co-Ordinator jobs run on.

![Oracle APEX Schedule for Co-Ordinator Jobs](https://cdn.hashnode.com/res/hashnode/image/upload/v1689427360031/ff0664a8-7698-4d7e-be00-db5e8ac0040f.png align="center")

<div data-node-type="callout">
<div data-node-type="callout-emoji">📖</div>
<div data-node-type="callout-text">See the end of this post for the SQL I used to get the job schedules and how to view these scheduled from APEX.</div>
</div>

# Queue Handlers

What I call Queue Handler jobs are jobs that manage the various queues within your APEX Environment. These include jobs that send out PWA Push Notifications and Emails sent out using the `APEX_MAIL` API.

## ORACLE\_APEX\_PWA\_PUSH\_QUEUE

This job runs every 2 minutes (at 0 seconds past the minute) and sends out any pending PWA Push Notifications.

![Oracle APEX PWA Push Notificaton Queue](https://cdn.hashnode.com/res/hashnode/image/upload/v1689047331401/177a58bd-b8a4-4f52-9c78-06723399aba7.png align="center")

## ORACLE\_APEX\_MAIL\_QUEUE

This job runs every 5 minutes (at 0 seconds past the minute) and sends out any pending emails.

![Oracle APEX Email Queue](https://cdn.hashnode.com/res/hashnode/image/upload/v1689047400157/28198639-f27e-414f-b1f7-1eb3593ac977.png align="center")

## ORACLE\_APEX\_WS\_NOTIFICATIONS

This job runs on the hour and the half hour and sends out Interactive Report Subscriptions.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1689048112902/56717c9c-45dd-40cb-a678-493ac8291e33.png align="center")

## ORACLE\_APEX\_AUTO\_APPROVAL

This job runs every two minutes and creates requested and approved Workspaces.

![Oracle APEX Workspace Requests](https://cdn.hashnode.com/res/hashnode/image/upload/v1689048456590/224362f7-af97-4f0d-887e-8ab97ed8b4a8.png align="center")

## ORACLE\_APEX\_ISSUE\_EMAILS

This job runs every hour on the hour and sends out emails initiated from APEX Teams Development.

![Oracle APEX Team Development.](https://cdn.hashnode.com/res/hashnode/image/upload/v1689048512355/f767864d-dee4-4038-a181-3b91735db9fb.png align="center")

## Schedule for Queue Handler Jobs

![Oracle APEX Schedule for Queue Handler Jobs](https://cdn.hashnode.com/res/hashnode/image/upload/v1689427526533/c63678b7-cfda-4632-acd9-d33498251415.png align="center")

# Maintenance Jobs

Maintenance jobs are jobs that perform maintenance activities within your APEX environment.

## ORACLE\_APEX\_PURGE\_SESSIONS

This job purges expired APEX Sessions and runs every hour, on the hour.

![Oracle APEX Purge Expired Sessions](https://cdn.hashnode.com/res/hashnode/image/upload/v1689427930699/57588fcd-ca81-49cc-8cdc-a76118c1de77.png align="center")

## ORACLE\_APEX\_DAILY\_MAINTENANCE

This job performs activities such as Archiving Activity Summary, purging REST Source Cache, purging Stale Page/Region Cache, purging Uploaded Files, etc. It runs every day at 1 a.m. database time (usually UTC).

## ORACLE\_APEX\_DAILY\_METRICS

This job gathers aggregated workspace, schema, and instance-level metrics. It runs every day at 2 a.m. database time (usually UTC).

![Oracle APEX Workspace Metrics](https://cdn.hashnode.com/res/hashnode/image/upload/v1689428878982/9d881891-8c97-4b04-abee-60572f23bf02.png align="center")

## ORACLE\_APEX\_DICTIONARY\_CACHE

This job caches database dictionary objects related to APEX Workspaces. It runs every day at 1 a.m. database time (usually UTC).

Who knows why?

## ORACLE\_APEX\_BACKUP

This job performs backups of your APEX Applications that changed in the previous 24 hours. It runs every day at 2 a.m. database time (usually UTC).

![Oracle APEX Job to Manage APEX App Backups](https://cdn.hashnode.com/res/hashnode/image/upload/v1689429060012/5128e278-ec6c-4bad-8242-0210a913a36e.png align="center")

# Workflow Related Jobs

## ORACLE\_APEX\_TASKS\_PURGE

This job deletes APEX Workflow Approval tasks that have been Canceled, Errored, or Completed that are beyond the retention period. It runs every day at 2 a.m. database time (usually UTC). Read more on Workflow Task Retention and purge rules [here](https://docs.oracle.com/en/database/oracle/apex/23.1/htmdb/about-the-retention-and-archival-of-tasks.html).

![Oracle APEX Workflow Tasks](https://cdn.hashnode.com/res/hashnode/image/upload/v1689428488244/701a57d2-a2ce-407f-af0e-26a34c44a01c.png align="center")

![Oracle APEX Builder showing config for Task Expiration](https://cdn.hashnode.com/res/hashnode/image/upload/v1722297173898/c1abcdfb-d61f-45cc-9dd7-8046f6ed9517.png align="center")

## ORACLE\_APEX\_TASKS\_EXPIRE

Similar to the previous job, this job is also related to APEX Workflow Tasks. It handles re-processing expired Workflow tasks. The job runs every hour on the hour.

![Oracle APEX Task Expiration](https://cdn.hashnode.com/res/hashnode/image/upload/v1722296957400/e2f0c031-9434-438f-a883-e7462da0f868.png align="center")

## ORACLE\_APEX\_WF\_TIMEOUT

This job handles timing out APEX Workflows that have timed out. It runs every 5 minutes.

## ORACLE\_APEX\_WFS\_PURGE

This job handles purging completed APEX Workflows. It runs once a day at 3 a.m. This is controlled by the 'Workflow Retention Period Days' setting under Instance Settings.

![Oracle APEX Builder showing Workflow Expiration Configuration](https://cdn.hashnode.com/res/hashnode/image/upload/v1722297057575/b4f71bdf-3bc0-47f2-afe1-ee04046c529f.png align="center")

# Monitoring APEX Jobs

You can use the following SQL (run as the SYSTEM or SYS user) to get a list of scheduler jobs owned by APEX:

```sql
SELECT job_name
,      job_action
,      repeat_interval
FROM   all_scheduler_jobs
WHERE  owner = 'APEX_230100';  -- Change based on your APEX Version.
```

You can also view APEX Jobs from the INTERNAL / Administration Services Workspace by navigating to Monitor Activity &gt; Jobs.

![Oracle APEX Jobs from Administration Services](https://cdn.hashnode.com/res/hashnode/image/upload/v1689046715324/69ee6b7f-25cb-443a-b91d-c39b52595930.png align="center")

<div data-node-type="callout">
<div data-node-type="callout-emoji">💡</div>
<div data-node-type="callout-text">You can expose many additional details about each job using the Interactive Report. These details include the PL/SQL package &amp; procedure run by the job and the job schedule.</div>
</div>

Clicking on a specific job will show details about its individual executions. This can be helpful when tracking down issues.

![Oracle APEX Jobs details shown from Administration Services](https://cdn.hashnode.com/res/hashnode/image/upload/v1689046877275/6dd99ee3-1731-405d-81d0-b96e94fe7b0b.png align="center")

In later versions of APEX, you can also find APEX job information under Monitor Activity &gt; Administrator Digest &gt; System Schedule Jobs:

![Oracle APEX Monitor Activity > Administrator Digest > System Schedule Jobs](https://cdn.hashnode.com/res/hashnode/image/upload/v1689047661618/9e903670-ca83-415f-9aa5-ac6e3e8a86c7.png align="center")

# Don't Forget ORDS

Also, don't forget that ORDS has a background job that performs administrative tasks. This job is called `ORDS_HOUSEKEEPING_JOB`, and it runs from the `ORDS_METADATA` schema. This job runs every hour on the hour.

![Oracle ORDS Background Job](https://cdn.hashnode.com/res/hashnode/image/upload/v1689441078664/41c80864-96ca-4876-b653-28b791091dbb.png align="center")

# Conclusion

I believe that it is important for developers to understand what is happening under the APEX hood. I know that I have learned a lot just by writing this blog post.

## 🔗 Read More

* 🩳 [APEX Shorts](https://blog.cloudnueva.com/series/apex-shorts)
    
* 📝 [APEX Posts](https://blog.cloudnueva.com/tag/orclapex)
