root用户下

[root@localhost ~]# mkdir /nstg
[root@localhost ~]# cd /nstg/
[root@localhost nstg]# mkdir bin log tmp
[root@localhost nstg]# chown -R oracle:oinstall  /nstg
[root@localhost nstg]# su - oracle
[oracle@localhost ~]$ cd /nstg/bin

 vi del_arch.sh
#!/bin/bash
echo "----------------------------------------`date`---------------------------------------"
source ~/.bash_profile
rman target / <<EOF
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate-7';
EOF
echo -e "\n"
echo "------------------------------------ FINISHED ------------------------------------"

[oracle@localhost bin]$ crontab -e

* 1 * * *  sh nstg/bin/del_arc.sh 

 

posted on 2018-01-23 11:31  年少太公  阅读(1394)  评论(0编辑  收藏  举报