Wednesday, December 12, 2012

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 execute the batch file.

Hopes it will help for anybody :)

No comments:

Post a Comment