ORACLE远程DMP备份策略
1.制作一个批处理,代码如下:
@echo off
color 0A
echo JCFW数据库备份开始,请稍等……
if “%time:~0,1%”==” ” (set backup_file=jcfw%date:~0,4%%date:~5,2%%date:~8,2%-0%time:~1,1%%time:~3,2%%time:~6,2%) else (set backup_file=jcfw%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%)
exp ‘sys/oracle@sxjt as sysdba’ owner=jcfw file=D:/DataBak/数据库备份/rar/%backup_file%.dmp log=D:/DataBak/数据库备份/rar/%backup_file%.log
echo priv数据库备份开始,请稍等……
if “%time:~0,1%”==” ” (set backup_file=priv%date:~0,4%%date:~5,2%%date:~8,2%-0%time:~1,1%%time:~3,2%%time:~6,2%) else (set backup_file=priv%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%)
exp ‘sys/oracle@sxjt as sysdba’ owner=priv file=D:/DataBak/数据库备份/rar/%backup_file%.dmp log=D:/DataBak/数据库备份/rar/%backup_file%.log
echo xtcms数据库备份开始,请稍等……
if “%time:~0,1%”==” ” (set backup_file=xtcms%date:~0,4%%date:~5,2%%date:~8,2%-0%time:~1,1%%time:~3,2%%time:~6,2%) else (set backup_file=xtcms%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%)
exp ‘sys/oracle@sxjt as sysdba’ owner=xtcms file=D:/DataBak/数据库备份/rar/%backup_file%.dmp log=D:/DataBak/数据库备份/rar/%backup_file%.log
echo gispriv数据库备份开始,请稍等……
if “%time:~0,1%”==” ” (set backup_file=gispriv%date:~0,4%%date:~5,2%%date:~8,2%-0%time:~1,1%%time:~3,2%%time:~6,2%) else (set backup_file=gispriv%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%)
exp ‘sys/oracle@sxjt as sysdba’ owner=gispriv file=D:/DataBak/数据库备份/rar/%backup_file%.dmp log=D:/DataBak/数据库备份/rar/%backup_file%.log
echo gisapp数据库备份开始,请稍等……
if “%time:~0,1%”==” ” (set backup_file=gisapp%date:~0,4%%date:~5,2%%date:~8,2%-0%time:~1,1%%time:~3,2%%time:~6,2%) else (set backup_file=gisapp%date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%%time:~3,2%%time:~6,2%)
exp ‘sys/sys@orcl as sysdba’ owner=test file=D:/DataBak/数据库备份/rar/%backup_file%.dmp log=D:/DataBak/数据库备份/rar/%backup_file%.log
“C:\Program Files\WinRAR\rar.exe” a -rr10p -ag[yyyy-mm-dd] D:\DataBak\数据库备份\rarback\数据库备份.rar
del *.dmp y
del *.log y
echo ==================备份完成========================
2.WINDOWS计划任务添加这个批处理,设定好执行频率
批处理将自动完成指定用户的DMP备份,并存储压缩包形式!
弊端:不能控制备份文件的无限制膨胀。
目前这篇文章有3条评论(Rss)评论关闭。