- 整个目录结构如下:
卷 新加卷 的文件夹 PATH 列表
卷序列号为 9C81-5005
D:.
│ backup.log
│ oracledatabackup.bat
│ tree.txt
│
├─20161207
│ ├─data
│ │ XXX20161207.dmp
│ │
│ └─logs
│ XXX20161207.log
│
│_________________________________________________________
-
oracledatabackup.bat文件的内容
@echo off
echo 正在进行准备工作,请稍等......
if not exist "\dbbackup\data" md "\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\data"
if not exist "\dbbackup\logs" md "\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\logs"
echo 备份文件夹已创建成功!
echo 当前目录是:D:\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\data
Rem echo.>>%cd%\\dbbackup\backup.log
echo 数据库备份开始,开始时间:%DATE% %time%>>%cd%\\dbbackup\backup.log
exp userid='XXX/pwd@172.17.1.4/orcl' file=D:\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\data\XXX%date:~0,4%%date:~5,2%%date:~8,2%.dmp log=D:\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\logs\\XXX%date:~0,4%%date:~5,2%%date:~8,2%.log
forfiles /p D:\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\data /s /m *.* /d -3 /c "cmd /c del @path"
forfiles /p D:\dbbackup\%date:~0,4%%date:~5,2%%date:~8,2%\logs /s /m *.* /d -3 /c "cmd /c del @path"
echo 数据库备份结束,结束时间:%DATE% %time%>>D:\dbbackup\backup.log
echo ------------------------------------------------------>>D:\dbbackup\backup.log
Rem 使用Ping命令延时5秒后退出
ping 127.0.0.1 -n 10>nul
echo \dbbackup完成!
- backup.log文件的内容:
------------------------------------------------------
网友评论