The important of enabling autobackup in rman:
BY enabling few default parameters of RMAN it will save the life of dba significantly.
RMAN has following default parameters and its default values:
RMAN> show all;
Using target database controlfile instead of recovery catalogue
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO /app/oracle/dbs/snapcf_EHEALTH.f'; # default
I would be talking the benefits of CONTROLFILE AUTOBACKUP.
By default CONTROLFILE AUTOBACKUP is OFF. Oracle strongly recommend enabling CONTROLFILE AUTOBACKUP ON.
I edited the above setting as follows,
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored.
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'C:\rman\idea_%F';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'C:\rman\idea_%F';
new RMAN configuration parameters are successfully stored.
RMAN>
Note:-
All autobackup formats must include %F variable. %F expands to “C-XXXXXXXXX-YYYYMMDD-NN”, where:
XXXXXXXXX – DBID
YYYYMMDD – day, when backed up
NN – change number during day, starts with 00, and represented in hexadecimal
A quick test to make sure the backup works and is on disk,
RMAN> backup datafile 1;
Starting backup at 24-DEC-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=4 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=E:\DATA\IDEA\SYSTEM01.DBF
channel ORA_DISK_1: starting piece 1 at 24-DEC-12
channel ORA_DISK_1: finished piece 1 at 24-DEC-12
piece handle=E:\APP\ADMIN\PRODUCT\11.2.0\DBHOME_1\DATABASE\01NTMC5P_1_1 tag=TAG20121224T180649 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
Finished backup at 24-DEC-12
Starting Control File and SPFILE Autobackup at 24-DEC-12
piece handle=C:\RMAN\idea_C-1142773416-20121224-00 comment=NONE
Finished Control File and SPFILE Autobackup at 24-DEC-12
C:\rman>del idea_C-1142773416-20121224-00 -- i deleted the autobackup file .
Next we need to make a structural change to the database to see if the control file is automatically backed up. For this example i'll add a small datafile to the system tablespace.
SQL> alter tablespace SYSTEM add datafile 'E:\DATA\IDEA\SYSTEM02.DBF' size 100M;
Tablespace altered.
Starting with Oracle 11g Release 2, RMAN creates a single autobackup file encompassing all of the structural changes that have occurred within a few minutes of each other rather than creating a new backup of the controlfile on each structural change to the database. Also this will happen on the next log switch, so switch the logfile,
SQL>alter system switch logfile;
C:\rman>dir
Volume in drive C is OS
Volume Serial Number is E258-0ED0
Directory of C:\rman
24-12-2012 18:59 <DIR> .
24-12-2012 18:59 <DIR> ..
24-12-2012 18:59 9,830,400 idea_C-1142773416-20121224-02
1 File(s) 9,830,400 bytes
2 Dir(s) 99,976,085,504 bytes free
C:\rman>
Benefits:
With a control file autobackup, RMAN can recover the database even if the current control file, recovery catalog, and server parameter file are inaccessible.
A control file autobackup lets you restore the RMAN repository contained in the control file when the control file is lost and you have no recovery catalog. You do not need a recovery catalog or target database control file to restore the control file autobackup.
The control file is also automatically backed up after database structural changes such as adding a new tablespace, altering the state of a tablespace or datafile (for example, bringing it online), adding a new online redo log, renaming a file, adding a new redo thread, and so on. Losing this information would compromise your ability to recover the database.
If CONFIGURE CONTROLFILE AUTOBACKUP is ON, then RMAN automatically backs up the control file and the current server parameter file (if used to start up the database) in one of two circumstances: when a successful backup must be recorded in the RMAN repository, and when a structural change to the database affects the contents of the control filewhich therefore must be backed up.
Conclusion:
You can turn the autobackup feature on or off by running the following commands through RMAN utility:CONFIGURE CONTROLFILE AUTOBACKUP ON;CONFIGURE CONTROLFILE AUTOBACKUP OFF;
Rman backup through batchfile how to?
We can use rman along with batch file to take the database backup.
First you have to create a rcv with following contents . I name it as bkp.rcv and kept in d: drive.
The contents of my bkp.rcv is given below
backup datafile 1 format 'c:\rman\datafile_1_%D%M%Y%U';
backup datafile 2 format 'c:\rman\datafile_2_%D%M%Y%U';
backup datafile 3 format 'c:\rman\datafile_3_%D%M%Y%U';
backup datafile 4 format 'c:\rman\datafile_4_%D%M%Y%U';
backup datafile 5 format 'c:\rman\datafile_5_%D%M%Y%U';
backup datafile 6 format 'd:\rman\datafile_6_%D%M%Y%U';
backup datafile 7 format 'c:\rman\datafile_7_%D%M%Y%U';
exit;
Next create a file named rman_backup.txt , and insert the following contents ,set the PATH and ORACLE_SID accordingly .
set PATH=C:\oracle\product\10.2.0\Asm_1\bin;%PATH%
set ORACLE_SID=oracle1
C:\oracle\product\10.2.0\Asm_1\bin\rman target sys/sys cmdfile d:\bkp.rcv log d:\rmanbkp.log
pause
After creating the file rename it as rman_backup.bat and executes the batch file.