Windows系统下Oracle每天自动备份
2016-11-30 17:27
357 查看
linux和unix下面使用shell可以很方便实现,如果windows环境下可以结合计划任务实现
创建备份目录d:\backup, 创建批处理命令Bak.bat,编写备份脚本
exp user/passwd@orcl DIRECT=Y BUFFER=100000 FILE=D:\backup\scdd%date:~0,10% OWNER=('scdd') LOG=D:\backup\data.log
forfiles /p "D:\backup" /s /m *.dmp /d -3 /c "cmd /c del @path"
说明:
exp命令是oracle提供的dump备份命令,其中的%date:~0,10%是DOS里取日期的命令,例如:C:\Users\qyy>echo %date:~0,10%得到2016-11-30
forfiles是windows的文件查找命令,查找在backup,dmp后缀产生三天的文件,找到后执行删除操作
2.Windows定时任务每日自动执行批处理文件 3.保留最近三天的文件,自动删除以前日期的备份文件
forfiles参数说明:
/P 可是搜索的路径。在我们这里就是要在哪个目录寻找要删除的文件
/M 根据搜索掩码搜索文件。默认为*,如果要找备份处dump文件,格式为*.dmp
/D 文件修改时间在某个时间之前或者之后。-3 表示3天之前的文件。
/s 包含子目录
/C 表示为每个文件执行的命令,如果要删除该文件可以为"cmd /c del /F /s /q @file"。其中变量@file表示该文件名 f s q表示强制静默删除可以不用;cmd /c表示执行字符串指定的命令然后终断
其中@file可以返还如下结果,我们这里用@path
@file - returns the name of the file.
@fname - returns the file name without extension.
@ext - returns only the extension of the file.
@path - returns the full path of the file.
@relpath - returns the relative path of the file.
@isdir - returns "TRUE" if a file type is a directory, and "FALSE" for files. @fsize - returns the size of the file in bytes.
@fdate - returns the last modified date of the file.
@ftime - returns the last modified time of the file
创建备份目录d:\backup, 创建批处理命令Bak.bat,编写备份脚本
exp user/passwd@orcl DIRECT=Y BUFFER=100000 FILE=D:\backup\scdd%date:~0,10% OWNER=('scdd') LOG=D:\backup\data.log
forfiles /p "D:\backup" /s /m *.dmp /d -3 /c "cmd /c del @path"
说明:
exp命令是oracle提供的dump备份命令,其中的%date:~0,10%是DOS里取日期的命令,例如:C:\Users\qyy>echo %date:~0,10%得到2016-11-30
forfiles是windows的文件查找命令,查找在backup,dmp后缀产生三天的文件,找到后执行删除操作
2.Windows定时任务每日自动执行批处理文件 3.保留最近三天的文件,自动删除以前日期的备份文件
forfiles参数说明:
/P 可是搜索的路径。在我们这里就是要在哪个目录寻找要删除的文件
/M 根据搜索掩码搜索文件。默认为*,如果要找备份处dump文件,格式为*.dmp
/D 文件修改时间在某个时间之前或者之后。-3 表示3天之前的文件。
/s 包含子目录
/C 表示为每个文件执行的命令,如果要删除该文件可以为"cmd /c del /F /s /q @file"。其中变量@file表示该文件名 f s q表示强制静默删除可以不用;cmd /c表示执行字符串指定的命令然后终断
其中@file可以返还如下结果,我们这里用@path
@file - returns the name of the file.
@fname - returns the file name without extension.
@ext - returns only the extension of the file.
@path - returns the full path of the file.
@relpath - returns the relative path of the file.
@isdir - returns "TRUE" if a file type is a directory, and "FALSE" for files. @fsize - returns the size of the file in bytes.
@fdate - returns the last modified date of the file.
@ftime - returns the last modified time of the file
相关文章推荐
- 调用linux日期函数,实现每天自动生成一个oracle备份
- 实现Oracle 10g 每天自动备份数据
- oracle 数据泵 每天自动备份
- 为你介绍Oracle 11g数据库每天自动备份的实现方法
- oracle 自动每天备份数据
- Oracle 11g数据库每天自动备份的实现方法
- Windows系统下Oracle自动备份数据库,删除历史备份数据
- Oracle每天自动备份脚本
- 利用EXP每天晚上12点自动备份Oracle
- Oracle每天凌晨2点的自动备份策略的导致的一系列问题
- 为你介绍Oracle 11g数据库每天自动备份的实现方法
- windows下Oracle 11g数据库每天自动备份的实现方法
- 小数据量Oracle数据库自动备份
- Aix 5.3下自动备份Oracle多个实例
- oracle 自动备份dmp文件
- 教你用Linux完成Oracle自动物理备份
- ORACLE自动备份脚本DMP文件名
- 每天自动备份mysql脚本
- 【错误更正】oracle 备份: 每天备份,全备份,保留七天。
- oracle 数据库手动自动备份详解