windows系统删除oracle归档日志脚本

一、新建bat脚本 oracle_archivelog_delete.bat

@echo off
::以“YYYYMMDD”格式取出当前时间.
set BACKUPDATE=%date:~0,4%%date:~5,2%%date:~8,2%

set DATADIR=D:\app\archivelog_backup
set ARCHIVELOG_FILE=D:\app\new_Administrator\fast_recovery_area\dzjg\ARCHIVELOG
rman cmdfile=D:\oracle_bat\oracle_archivelog_delete.txt

forfiles /p "%DATADIR%" /s /m *.* /d -7 /c "cmd /c del @path"
forfiles /p "%ARCHIVELOG_FILE%" /s /m *.* /d -7 /c "cmd /c del @path"
pause
::exit

 

二、新建txt文件 oracle_archivelog_delete.txt

connect target /
run{

backup format 'D:\app\archivelog_backup\arch-%T_%s_%U' incremental level=1 archivelog all;
crosscheck archivelog all;
delete noprompt expired archivelog all;

delete noprompt archivelog until time 'SYSDATE-7';
}

 

你可能感兴趣的:(windows系统删除oracle归档日志脚本)