清理脚本
#!/bin/bash
export ORACLE_BASE=/data/u01/app/oracle
export ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
rman target / <<EOF
crosscheck archivelog all ;
delete noprompt archivelog until time 'sysdate-2';
exit;
EOF
备份脚本
cat /data/app/oracle/admin/orcl/dpdump/backup.sh
su - oracle <<EOF
expdp XXXX/YYYYY dumpfile=ncc_`date +20%y%m%d`.dmp logfile=ncc_`date +20%y%m%d`.log
cd /data/app/oracle/admin/orcl/dpdump
gzip ncc_`date +20%y%m%d`.dmp
find /data/app/oracle/admin/orcl/dpdump/ -name "nc*" -mtime +10 -exec rm -f {} \;
EOF
exit
# crontab -l
0 2 * * * /data/app/oracle/admin/orcl/dpdump/backup.sh