oracle 内置账号 说明Windows环境下Oracle数据库的自动备份脚本

@echo off echo ================================================ echo  Windows环境下Oracle数据库的自动备份脚本echo  1. 使用当前日期命名备份文件。echo  2. 自动删除30天前的备份。echo ================================================::以“YYYYMMDD”格式取出当前时间。set BACKUPDATE=%date:~0,4%%date:~5,2%%date:~8,2%set CURTIME=%time:~0,2%REM 小时数如果小于10,则在前面补0if "%CURTIME%"==" 0" set CURTIME=00if "%CURTIME%"==" 1" set CURTIME=01if "%CURTIME%"==" 2" set CURTIME=02if "%CURTIME%"==" 3" set CURTIME=03if "%CURTIME%"==" 4" set CURTIME=04if "%CURTIME%"==" 5" set CURTIME=05if "%CURTIME%"==" 6" set CURTIME=06if "%CURTIME%"==" 7" set CURTIME=07if "%CURTIME%"==" 8" set CURTIME=08if "%CURTIME%"==" 9" set CURTIME=09set CURTIME=%CURTIME%%time:~3,2%%time:~6,2%::设置用户名、密码和要备份的数据库。set USER=carbon_zhenjiang_bakset PASSWORD=carbon_zhenjiang_bakset DATABASE=orcl::创建备份目录。if not exist "D:\backup\data\%BACKUPDATE% "mkdir D:\backup\data\%BACKUPDATE%if not exist "D:\backup\log\%BACKUPDATE% " mkdir D:\backup\log\%BACKUPDATE%set DATADIR=D:\backup\data\%BACKUPDATE%set LOGDIR=D:\backup\log\%BACKUPDATE%exp %USER%/%PASSWORD%@%DATABASE%  file=%DATADIR%\%USER%_%BACKUPDATE%%CURTIME%.dmp log=%LOGDIR%\log_%BACKUPDATE%%CURTIME%.log::删除30天前的备份。forfiles /p "%DATADIR%" /s /m *.* /d -30 /c "cmd /c del @path"forfiles /p "%LOGDIR%" /s /m *.oracle账号* /d -30 /c "cmd /c del @path"exit

此条目发表在oracle metalink账号分类目录,贴了标签。将固定链接加入收藏夹。