How to Schedule Oracle RMAN Backup Jobs Using Oracle Scheduler Tools?

Scheduling Oracle RMAN backups protects your data and saves time. This guide explains the steps to automate RMAN jobs with Oracle's built-in schedulers. Learn methods for both modern and legacy environments.

download-icon
Free Download
for VM, OS, DB, File, NAS, etc.
roy-caldwell

Updated by Roy Caldwell on 2026/03/17

Table of contents
  • What Is an Oracle RMAN Scheduler Job?

  • How to Create an Oracle RMAN Scheduler Job with DBMS_SCHEDULER?

  • How to Schedule an Oracle RMAN Job with DBMS_JOB?

  • How to Protect Oracle Database with Vinchin?

  • Oracle RMAN Scheduler Job FAQs

  • Conclusion

Automating Oracle RMAN backups is essential for any database administrator who values data protection and operational efficiency. Manual backups are not only time-consuming but also prone to human error—especially when managing multiple databases or tight maintenance windows. By scheduling Oracle RMAN jobs, you ensure regular, reliable protection for your data without constant oversight. But how do you set up an oracle rman scheduler job using Oracle’s built-in tools? Let’s walk through the process step by step.

What Is an Oracle RMAN Scheduler Job?

An oracle rman scheduler job is a scheduled task that runs RMAN backup commands automatically at set times or intervals. This automation helps maintain consistent backup routines across environments of all sizes. Oracle provides two main ways to schedule these jobs: DBMS_SCHEDULER (the modern approach) and DBMS_JOB (the legacy method). Both allow you to automate RMAN scripts so you can run full or incremental backups, manage archive logs, and clean up old backups—all without manual intervention.

DBMS_SCHEDULER offers advanced features like flexible scheduling options, external script execution with credentials, logging integration, and better error handling compared to DBMS_JOB. For most environments today, DBMS_SCHEDULER is the recommended choice.

How to Create an Oracle RMAN Scheduler Job with DBMS_SCHEDULER?

DBMS_SCHEDULER is Oracle’s advanced job scheduling package introduced in 10g and enhanced in later versions. It lets you define what to run (a script or command), when to run it (using calendar expressions), and under which credentials if needed.

Before starting:

  • Make sure your RMAN script is tested.

  • Store scripts securely on disk if running OS-level commands.

  • Ensure your account has the required privileges: CREATE JOB for basic jobs; CREATE EXTERNAL JOB plus access to credentials for OS-level scripts.

Here’s how you create an oracle rman scheduler job using DBMS_SCHEDULER:

1. Create a Credential (for External Scripts):

If your job will execute a shell or batch file outside the database environment—for example /home/oracle/rman_backup.sh—you need a credential object that stores the OS username and password securely within Oracle.

   BEGIN
     DBMS_SCHEDULER.create_credential(
       credential_name => 'ORACLE_CREDENTIAL',
       username       => 'oracle',
       password       => 'your_password'
     );
   END;
   /

Credentials are only required when running external executables—not for inline PL/SQL or pure database-side scripts.

2. Write Your RMAN Script:

Place your tested RMAN commands in a shell script file such as /home/oracle/rman_backup.sh (Linux) or C:\scripts\rman_backup.bat (Windows). Make sure this script sets environment variables correctly and calls RMAN with proper parameters.

Example shell script (rman_backup.sh) with logging:

   #!/bin/bash
   set -o errexit
   export ORACLE_SID=orcl
   export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

   LOGFILE="/backup/logs/rman_$(date +%Y%m%d_%H%M%S).log"

   $ORACLE_HOME/bin/rman target / <<EOF >> $LOGFILE 2>&1
   run {
     backup database format '/backup/DB_%d_%T_%s.bkp';
     backup archivelog all delete input format '/backup/ARC_%d_%T_%s.arc';
     delete noprompt obsolete;
   }
   exit
   EOF

   echo "Backup completed at $(date)" >> $LOGFILE
  • Ensure this file is executable by running chmod +x /home/oracle/rman_backup.sh.

  • Store scripts in secure directories accessible only by authorized users.

  • Always test scripts manually before automating them via scheduler jobs.

3. Create the Scheduler Job:

Use DBMS_SCHEDULER.create_job to define your job:

  • Set job_type to 'EXECUTABLE' if calling an OS-level script.

  • Use 'PLSQL_BLOCK' or 'BACKUP_SCRIPT' (Oracle 12c+) if embedding commands directly.

  • Assign credential_name only when running external executables.

Example for an external shell script:

    BEGIN
      DBMS_SCHEDULER.create_job(
        job_name        => 'RMAN_BACKUP_JOB',
        job_type        => 'EXECUTABLE',
        job_action      => '/home/oracle/rman_backup.sh',
        credential_name => 'ORACLE_CREDENTIAL',
        repeat_interval => 'FREQ=DAILY;BYHOUR=2;BYMINUTE=0;BYSECOND=0',
        enabled         => FALSE
      );
      DBMS_SCHEDULER.enable('RMAN_BACKUP_JOB');
    END;
    /

Example for an inline backup command (Oracle 12c+):

    DECLARE
      l_script VARCHAR2(32767);
    BEGIN
      l_script := 'connect target / 
      run {
        backup database plus archivelog;
        delete noprompt obsolete;
      }';
      DBMS_SCHEDULER.create_job(
        job_name        => 'RMAN_INLINE_JOB',
        job_type        => 'BACKUP_SCRIPT',
        job_action      => l_script,
        -- Omit credential_name unless accessing OS resources --
        repeat_interval => 'FREQ=DAILY;BYHOUR=2;BYMINUTE=0;BYSECOND=0',
        enabled         => TRUE
      );
    END;
    /

4. Monitor and Manage the Job:

Check status using:

SELECT job_name, status, run_duration FROM dba_scheduler_job_run_details WHERE job_name = 'RMAN_BACKUP_JOB';

You can enable or disable jobs using DBMS_SCHEDULER.enable('jobname'), DBMS_SCHEDULER.disable('jobname'), or remove them entirely with DBMS_SCHEDULER.drop_job('jobname').

For detailed logs—including errors—query:

SELECT * FROM dba_scheduler_job_log WHERE job_name = 'RMAN_BACKUP_JOB' ORDER BY log_date DESC;

How to Schedule an Oracle RMAN Job with DBMS_JOB?

DBMS_JOB is Oracle’s legacy scheduler available since early versions of Oracle Database. While still supported for backward compatibility, it lacks many features found in DBMS_SCHEDULER such as complex calendars or robust logging.

Use this method mainly in older environments where migration isn’t possible yet.

1. Create a PL/SQL Wrapper:

Declare a variable for capturing the assigned JOB number:

DECLARE 
  v_jobno NUMBER;
BEGIN 
  DBMS_JOB.submit(
     job       => v_jobno,
     what      => 'host(''/home/oracle/rman_backup.sh'');', 
     next_date => SYSDATE,
     interval  => 'SYSDATE + 1'
  ); 
  COMMIT; 
END;
/

This schedules your shell script to run daily at roughly the same time each day after its last completion.

2. Monitor the Job:

Check status using:

SELECT job, last_date, next_date, failures, broken FROM dba_jobs WHERE what LIKE '%rman_backup%';

If a job fails repeatedly it may become marked as BROKEN—reset this flag after resolving issues by executing:

BEGIN 
  DBMS_JOB.BROKEN(job=>12345,FALSE); 
END;
/

While functional for simple tasks, remember that Oracle recommends migrating all new automation work toward DBMS_SCHEDULER due to its flexibility.

How to Protect Oracle Database with Vinchin?

Beyond manual checks and scripts, organizations seeking robust enterprise-level protection should consider Vinchin Backup & Recovery—a professional solution supporting today’s leading databases including Oracle, MySQL, SQL Server, MariaDB, PostgreSQL, PostgresPro, and TiDB—with advanced features tailored especially well for Oracle environments. Among its capabilities are advanced source-side compression and incremental backup options designed specifically for Oracle workloads alongside batch database backup management, flexible GFS-based retention policies, and comprehensive integrity checks—all working together seamlessly so administrators maximize efficiency while ensuring reliable recoverability across complex infrastructures.

With Vinchin Backup & Recovery's intuitive web console interface protecting an Oracle database typically involves four straightforward steps: 

Step 1 – Select the Oracle database to back up; 

Select the Oracle database to back up

Step 2 – Choose the desired storage location; 

Choose the desired storage location

Step 3 – Define custom strategies such as schedules or retention rules; 

Define custom strategies such as schedules or retention rules

Step 4 – Submit the job.

Submit the job

Recognized globally among enterprise IT professionals—with thousands of satisfied customers worldwide—Vinchin Backup & Recovery consistently earns top industry ratings. Experience complete peace of mind risk-free with their 60-day full-featured free trial—just click download below!

Oracle RMAN Scheduler Job FAQs

Q1: How do I change when my existing oracle rman scheduler job runs?

A1: Use DBMS_SCHEDULER.SET_ATTRIBUTE with your JOB_NAME plus new REPEAT_INTERVAL value—for example:

BEGIN 
  DBMS_SCHEDULER.SET_ATTRIBUTE(name=>'RMAN_BACKUP_JOB',attribute=>'repeat_interval',value=>'FREQ=WEEKLY;BYDAY=TUE');
END;
/

Q2: Can I force my oracle rman scheduler job to start right now?

A2: Yes—run DBMS_SCHEDULER.RUN_JOB specifying JOB_NAME plus USE_CURRENT_SESSION=>TRUE if needed.

Q3: What should I do if my oracle rman scheduler job keeps failing unexpectedly?

A3: Check both DBA views (dba_scheduler_job_run_details) AND any generated log files from executed scripts—they often reveal permission errors or missing paths.

Conclusion

Automating oracle rman scheduler jobs ensures reliable protection against data loss while reducing manual effort across IT teams everywhere! Whether using built-in schedulers—or leveraging advanced solutions like Vinchin—you gain peace of mind knowing critical information stays safe around-the-clock no matter what happens next!

Share on:

Categories: Database Tips