首页 » ORACLE 9i-23ai » ORACLE远程DMP备份策略

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)评论关闭。

  1. Donald Haddick | #1
    2011-12-21 at 08:31

    Great content and nice discussion on the list of comments.

  2. admin | #2
    2011-08-17 at 18:06

    无限制膨胀? exp 文件大小要限制因为windows对单个文件大小有限制分片,rar 最好大小也要分卷,备份目录里的文件可以在备份时文件名包含日期,后期删除方便

    • Morrie | #3
      2011-09-03 at 13:30

      THX that’s a great awnesr!