4 Replies Latest reply: Jun 21, 2009 3:39 PM by 587815 RSS

    Automatic Backups

    587815
      How to generate automatic backups with RMAN in Oracle XE?

      Roberto.
        • 1. Re: Automatic Backups
          Paul M.
          You can use DBMS_SCHEDULER.CREATE_JOB procedure, and schedule a batch file wich runs rman commands.
          • 2. Re: Automatic Backups
            587815
            Hi, i submited the PL/SQL block:

            begin
            dbms_scheduler.create_schedule(
            schedule_name   => 'daily_at_4am_include_monday',
            repeat_interval => _'FREQ=DAILY; INTERVAL=8;_
            BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN; BYHOUR=12,18,22',_
            comments        => 'schedule to run daily at 4am except on mondays');
            dbms_scheduler.create_program
            *( program_name => 'backup_database',*
            program_type   => 'EXECUTABLE',
            program_action => 'C:\oraclexe\app\oracle\product\10.2.0\server\BIN\backup.bat >
            nul',
            enabled        => TRUE,
            comments       => 'Backup dw database using rman and then backup rman
            database via hot backup.'
            *);*



            dbms_scheduler.create_job (
            job_name=>'daily_backup',
            program_name =>'backup_database',
            schedule_name=> 'daily_at_4am_include_monday',
            enabled      => true,
            comments     => 'backs up the dw and rman databases daily at 4am
            except on for mondays.'
            *);*
            end;
            */*

            select owner,job_name from dba_scheduler_jobs;

            Results:

            anonymous block completed

            SYS                            DAILY_BACKUP

            select job_name,status,error#,run_duration
            from all_scheduler_job_run_details

            DAILY_BACKUP     FAILED     27369     0 0:0:2.0

            Help me please.

            Roberto
            • 3. Re: Automatic Backups
              Paul M.
              You don't need all that stuff. The following is a working example :
              begin
              DBMS_SCHEDULER.create_job(
              job_name => 'Daily_Backup',
              job_type => 'executable',
              job_action => 'c:\backup\back.bat',
              start_date => sysdate,
              repeat_interval => 'freq=daily;byhour=10;byminute=30',
              enabled => TRUE);
              end;
              /
              • 4. Re: Automatic Backups
                587815
                Thank's Paul.

                Roberto.