[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 * * * nstg/bin/del_arc.sh
oracle设置自动清理归档日志脚本
最新推荐文章于 2024-09-26 09:10:00 发布
本文介绍了一个用于Oracle数据库归档日志清理的Shell脚本,通过定时任务自动执行,实现对过期和已完成的归档日志进行清理,以释放存储空间并保持良好的数据库管理状态。
419

被折叠的 条评论
为什么被折叠?



