ITPub博客

首页 > 数据库 > Oracle > windowns系统,oracle数据库expdp自动备份

windowns系统,oracle数据库expdp自动备份

原创 Oracle 作者:许愿流星1号 时间:2014-11-20 16:29:39 0 删除 编辑

Create directory scott as 'D:\';

Grant read,write on directory scott to scott;

 

写个.bat的程序,内容为

 

set backupfile=scott_%date:~0,4%-%date:~5,2%-%date:~8,2%.dmp

set logfile=scott_%date:~0,4%-%date:~5,2%-%date:~8,2%.log

D:\app\Administrator\product\11.2.0\dbhome_1\BIN\expdp scott/tiger@192.168.56.11/prod directory=scott  dumpfile=%backupfile%  logfile=%logfile%

 

rem delete 10days files

forfiles /p "d:\bak" /d -10  /c "cmd /c echo deleting @file ... && del /f @path"

 

备份出来的是:scott_2014-10-27.dmp

 

 

 

set backupfile=full_%date:~0,4%-%date:~5,2%-%date:~8,2%.dmp

set logfile=full_%date:~0,4%-%date:~5,2%-%date:~8,2%.log

D:\app\Administrator\product\11.2.0\dbhome_1\BIN\expdp system/oracle@192.168.56.11/prod directory=full full=y  dumpfile=%backupfile%  logfile=%logfile%

 

导整个数据库

 

删掉十天前的备份,执行下面的命令,就会把10天前d:\bak\的所有文件都给删除了。所以这个文件下只能放备份

把这个命令也放到.bat里

forfiles /p "d:\bak" /d -10  /c "cmd /c echo deleting @file ... && del /f @path"

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29893219/viewspace-1340556/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-09-18

  • 博文量
    46
  • 访问量
    430278