Wednesday, June 01, 2011

How to Schedule RMAN Daily Backup???

Steps of Daily Backup: -

Step 1: Change the Database mode to ARCHIVE mode and ENABLE archive mode.

Step 2: Assign new Channel in RMAN.
             Note: If our System doesn’t have enough memory, MAP a new folder from other system and assign that folder. ( This is the role of System Admin or Network Admin ).

Step 3: Create script for RMAN backup and save it as “.sh” extension.
           Script:
                      #!/bin/bash
                      export ORACLE_SID=acogrid
                      export ORACLE_HOME=/app/oracle/product//11.2.0/db_1
                      export  PATH=$ORACLE_HOME/bin:$PATH
                      $ORACLE_HOME/bin/rman target  /<<EOF
                      run {
                       backup database;
                       }

                Note:   Depends on the “bash” file,our ORACLE_SID,ORACLE_HOME,PATH will
                            change. Make sure the executable file (.sh) is working properly.

Step 4: Allow EXECUTION permission on our  “.sh”  file.

Step 5: Create script for SCHEDULER and run in SQLPLUS 
 
  Script:
                        begin
                        dbms_scheduler.create_schedule(
                        schedule_name  =>  'schedulerman',
                        repeat_interval  =>  ' FREQ=DAILY; INTERVAL=1;
BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN;  BYHOUR=15;
BYMINUTE=45;BYSECOND=10',
                        comments   =>   'schedule to run daily at 3.45pm');
dbms_scheduler.create_program
                        (  program_name   =>  'programrman',
                        program_type   =>   'EXECUTABLE',
                        program_action  =>  '/scripts/rmanscript.sh',
                        enabled  =>  TRUE,
                        comments   =>  'Backup of db using rman.'
                        );
                        dbms_scheduler.create_job
                        (  job_name  =>  'daily_backup',
                        program_name   =>  'programrman',
                        schedule_name  =>  'schedulerman',
                        enabled  =>  true,
                        comments  =>  'database daily backup at 3.45pmthrough rman.'
                        );
end;
/
 
 
Regards,
Sukhwinder Singh

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

There was an error in this gadget