exp username/password@tnsname file=d:\oa_db_bak\oauser%date:~0,10%.dmp owner=username log=d:\oa_db_bak\oauser%date:~0,10%.log ::将rar的可执行文件rar.exe的路径添加到系统的path里 Rar.exe a d:\oa_db_bak\oauser%date:~0,10%.rar d:\oa_db_bak\oauser%date:~0,10%.dmp del d:\oa_db_bak\*%date:~0,10%.dmp
新建一个bat文件,根据自己的环境修改上面的内容。在windows的建立定时任务定时备份
注意:在部分系统上时间格式是2013/xx/xx,导致脚本不能正确运行,故修改成如下:
exp username/password@tnsname file=E:\oa_db_bak\oauser%date:~0,4%%date:~5,2%%date:~8,2%.dmp owner=username log=E:\oa_db_bak\oauser%date:~0,4%%date:~5,2%%date:~8,2%.log ::将rar的可执行文件rar.exe的路径添加到系统的path里 Rar.exe a E:\oa_db_bak\oauser%date:~0,4%%date:~5,2%%date:~8,2%.rar E:\oa_db_bak\oauser%date:~0,4%%date:~5,2%%date:~8,2%.dmp del E:\oa_db_bak\*%date:~0,4%%date:~5,2%%date:~8,2%.dmp