oracle异地备份

一、安装oracle客户端


右键以管理员身份运行

选择管理员


跳过软件更新


选择语言,默认中文


指定安装位置


检查当前环境


安装

二、使用exp命令备份

exp 用户名/密码@IP地址/数据库 owner=所有者 file=%filename%.dmp log=%filename%.log
 
三、新建批处理文件
@echo off
set logfile=.\oraback.log      (指定备份日志文件名)
set filename=.\%date:~0,4%%date:~5,2%%date:~8,2%    (指定备份文件名,以当前日期命名)
set nowdate=%date:~0,4%%date:~5,2%%date:~8,2%       (获取当前日期)
echo the BK is begining,Pls Waiting.... >>%logfile%         (echo内容到日志文件)
echo The Time is %nowdate%---%time% now! >> %logfile%       (把当前时间输入到日志文件)
exp 用户名/密码@IP地址/数据库  owner=所有者  file=%filename%.dmp log=%filename%.log     (执行备份命令)
echo The Oracle Backup has completed.Bye! >>%logfile%         (echo内容到日志文件)
echo the Completed time is %nowdate%---%time% >>%logfile%     (把当前时间输入到日志文件)
echo line of demarcation*******************************>>%logfile%      (echo内容到日志文件)
echo ***>>%logfile%    (echo内容到日志文件)
echo ***>>%logfile%    (echo内容到日志文件)
forfiles /p "." /s /m *.dmp /d -15 /c "cmd /c del @path"       (删除15天前,后缀名为dmp的文件)
forfiles /p "." /s /m *.log /d -15 /c "cmd /c del @path"       (删除15天前,后缀名为log的文件)

三、添加批处理文件到任务计划

猜你喜欢

转载自www.cnblogs.com/zhenwei66/p/10498848.html
今日推荐