Oracle 11gR2 RMAN batch script

>>>>>>>>> rman_archivelog.bat <<<<<<<<

cd /d D:\app\product\11.2.0\dbhome_1\BIN
rman target sys/oracle@BRSSTBY  catalog rman/rman001@rmandb  @'F:/delete.rmn'

>>>>>>>>> execution script: delete.rmn <<<<<<

RMAN> run{

allocate channel t1 device type disk;
delete noprompt archivelog until time 'sysdate-1';
DELETE FORCE NOPROMPT OBSOLETE;
CROSSCHECK ARCHIVELOG ALL;
DELETE EXPIRED ARCHIVELOG ALL;
release channel t1;

}

Clean up the archivelog at the interval of 2 hours

RMAN> run{
allocate channel t1 device type disk;
delete noprompt  archivelog all completed before 'SYSDATE-2/24' ; 
DELETE FORCE NOPROMPT OBSOLETE;
CROSSCHECK ARCHIVELOG ALL;
DELETE EXPIRED ARCHIVELOG ALL;
release channel t1;
}

They have to be separate when done .

 

#!/bin/sh

. /u01/app/oracle/.profile1

${ORACLE_HOME}/bin/rman <<EOF

connect target sys/syspassword@cricprod_prim

connect auxiliary sys/syspassword@cricprod_logstdby

show all;

EOF

 

*********************************************************

http://www.oracle-base.com/articles/misc/oracle-shell-scripting.php

 

posted @ 2014-09-05 09:26  jefflu99  阅读(417)  评论(0编辑  收藏  举报