最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

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

业界 admin 11浏览 0评论

一、新建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';
}

 

一、新建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';
}

 

发布评论

评论列表 (0)

  1. 暂无评论