RMAN删除oracle-cdc日志(测试环境:每天生成100M左右的日志)

rman target sys/Admin123

1、先在docker登录

2、删除日志

DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';

3、自动化脚本实现  https://www.dqzboy.com/3963.html

oracle_env() {
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
}
arch_log_dir() {
if [ -d /home/oracle/logs ]; then
echo "true"
else
mkdir -p /home/oracle/logs
fi
}
oracle_clean() {
echo "zjb1"
oracle_env
exec >> /home/oracle/logs/delarch`date +%Y-%T`.log
$ORACLE_HOME/bin/rman target /<<EOF
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt archivelog all completed before 'sysdate - 7';
exit;
EOF
}
main() {
arch_log_dir
oracle_clean
}
main

4.JU XING清理脚本:

cat /home/oracle/del_rman_arch.sh
#!/bin/bash

. ~/.bash_profile

rman target / log /home/oracle/del_rman_arch.log append<<EOF
crosscheck archivelog all;
delete noprompt archivelog until time 'sysdate-3';
EOF

 

 

posted @ 2023-03-17 17:24  zjb480  阅读(54)  评论(0)    收藏  举报