Oracle RAC ARCHIVELOG устгах

##1. Oracle RAC дээр байршиж байгаа инстасын архив логыг сүүлийн 10 хоногийнхийг үлдээж устгах файл.

rman_delete_archivelog.sh

export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
export ORACLE_PATH=/u01/app/common/oracle/sql
export ORACLE_BASE=/u01/app/oralce
export TNS_ADMIN=/u01/app/11.2.0.4/grid/network/admin
export LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0.4/dbhome_1/lib:/gg/gg_source:/u01/app/oracle/product/11.2.0.4/dbhome_1/oracm/lib:/lib:/usr/lib:/usr/local/lib
export PATH=.:/usr/local/java/bin:/usr/local/bin:/bin:/usr/bin:/home/oracle/bin:/u01/app/oracle/product/11.2.0.4/dbhome_1/bin:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin:/u01/app/common/oracle/bin:/gg/gg_source
export TZ=Asia/Ulaanbaatar

export ORACLE_SID=mysid1
rman  <<EOF
connect target /
run {
DELETE NOPROMPT  ARCHIVELOG UNTIL TIME 'SYSDATE-10';
}
EXIT
EOF

export ORACLE_SID=mysid2
rman  <<EOF
connect target /
run {
DELETE NOPROMPT  ARCHIVELOG UNTIL TIME 'SYSDATE-10';
}
EXIT
EOF

##2. Cron ажилуулах

crontab -u oracle -e
00 01 * * * sh  /path_to/rman_delete_archivelog.sh
4 Likes