I want to schedule backups in Oracle 12c. I currently work with Windows task manager. Now I want to do it internally in Oracle to have backups every 10 minutes. Could anyone help me with that?

closed as too broad by hot2use, mustaccio, McNets, LowlyDBA, Mr.Brownstone Dec 7 at 22:24

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Hi, welcome to dba.stackexchange. Asking questions are great, however its expected that some research is done before asking - scheduling backups is a relatively common tasks, for which there are lots of articles and guides available through quick internet searches. I suggest doing some research of your own, then asking more targeted questions based on any specific issues you have after researching. Have a look through dba.stackexchange.com/help to help your experience of the site! – Ian_H Dec 6 at 15:35
  • 1
    Why do you think you need a backup every 10 minutes? Perhaps you are looking for the flashback feature. – mustaccio Dec 6 at 17:00
  • As @mustaccio mentions, you don't want to do a backup every 10 minutes. Flashback is what you might want, but what you first want to do is ensure your database is in archvelog mode via select NAME, LOG_MODE from v$database; -- and if log_mode is not ARCHIVELOG then enable it. Then you need to archive your logs on a frequent basis (a few times a day) and do an incremental level 0 (logcially like a full backup) perhaps weekly, and an incremental level 1 (back up just what has changed since the level 0) perhaps daily. – Mark Stewart Dec 10 at 15:57

To be honest, there is no such thing, as internal backup*. You either schedule an RMAN backup (and RMAN is an external tool, you can't use it directly from the database), or user-managed backup, where you are responsible for copying the files with some custom scripts. Whatever method you choose, you will end up calling some external script.

*Not counting the undocumented methods such as the DBMS_BACKUP_RESTORE package..

But the actual scheduling can be done inside the database.

Starting with Oracle 12c, you can specify the job_type of a DBMS_SCHEDULER job as BACKUP_SCRIPT, and this actually hides the fact that it uses an external job, and you can use inline scripts instead of storing them outside the database.

Below output is taken from: Scheduler (DBMS_SCHEDULER) Enhancements in Oracle Database 12c Release 1 (12.1)

First create a credential:

    credential_name => 'oracle_ol6_121',
    username        => 'oracle',
    password        => 'oracle'

Then create a job:

-- Create a job with an RMAN script defined in-line,
-- including an explicit connect.
  l_job_name VARCHAR2(30);
  l_script   VARCHAR2(32767);
  l_job_name := DBMS_SCHEDULER.generate_job_name;
  DBMS_OUTPUT.put_line('JOB_NAME=' || l_job_name);

  -- Define the backup script.
  l_script := 'connect target /
run { 
  backup archivelog all delete all input;

    job_name        => l_job_name,
    job_type        => 'BACKUP_SCRIPT',
    job_action      => l_script,
    credential_name => 'oracle_ol6_121',
    enabled         => TRUE

You can customize it for your needs.

Another example on My Oracle Support (requires a support contract to access):

An Example to Schedule RMAN Backup Using 12c DBMS_SCHEDULER BACKUP_SCRIPT (Doc ID 2102623.1)

Not the answer you're looking for? Browse other questions tagged or ask your own question.