使用dbsyncer增量同步oracle数据开启存档定时删除过期存档文件windows bat rman
@echo off
set oracle_home=C:\oracle\product\11.2.0\dbhome_1
set rman_home=%oracle_home%\bin
set oracle_sid=ORCL
set log_dir=D:\dbsyncer\logs
set log_file=%log_dir%\delete_expired_arch.log
echo Start deleting expired archivelogs at %date% %time% >> %log_file%
%rman_home%\rman.exe target / nocatalog <<EOF >> %log_file%
run{
allocate channel ch1 type disk;
delete noprompt archivelog all completed before 'sysdate-30';
release channel ch1;
}
exit;
EOF
echo Finished deleting expired archivelogs at %date% %time% >> %log_file%
这段代码使用了RMAN的命令来删除Oracle中超过30天的过期归档日志。它首先设置了Oracle Home、SID、日志目录和日志文件路径,然后通过RMAN命令删除指定时间之前的归档日志。这个脚本在Windows环境下运行,适合于定期执行来管理Oracle的归档日志文件。
评论已关闭