首页 > 代码库 > oracle自动备份脚本

oracle自动备份脚本

echo 设置数据服务名
set dcibkdatasource=orcl

echo 设置要导出的数据库用户名
set dcibkuser=**mis

echo 设置要导出的数据库用户密码
set dcibkpwd=**mis

set dcibkpath=%~sdp0备份数据

set dcizipname=%dcibkpath%\%dcibkuser%%date:~0,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%:%time:~3,2%:%time:~6,2%.zip

echo 删除10天前的备分文件和日志

forfiles /p %dcibkpath% /m *.zip /d -10 /c "cmd /c del @path" 

md %dcibkpath%

exp %dcibkuser%/%dcibkpwd%@%dcibkdatasource% file=%dcibkpath%\%dcibkuser%.dmp log=%dcibkpath%\%dcibkuser%.log

zip %dcizipname% %dcibkpath%\*.dmp %dcibkpath%\*.log

  

oracle自动备份脚本