备份Oracle数据库的脚本

时间:2021-12-23 06:11:48

@echo off
goto bakoracle

:bakoracle
echo.
echo ★☆★  自动备份Oracle数据库   ★☆★
echo.
set backpath=E:\Oracle_bak
echo.
echo 准备开始备份数据库...

rem 7天一个循环
if exist %backpath%\1 goto 1
if exist %backpath%\2 goto 2
if exist %backpath%\3 goto 3
if exist %backpath%\4 goto 4
if exist %backpath%\5 goto 5
if exist %backpath%\6 goto 6
if exist %backpath%\7 goto 7
echo E > %backpath%\1
:1
set backpath_full=%backpath%\1
ren %backpath%\1 2
goto back
:2
set backpath_full=%backpath%\2
ren %backpath%\2 3
goto back
:3
set backpath_full=%backpath%\3
ren %backpath%\3 4
goto back
:4
set backpath_full=%backpath%\4
ren %backpath%\4 5
goto back
:5
set backpath_full=%backpath%\5
ren %backpath%\5 6
goto back
:6
set backpath_full=%backpath%\6
ren %backpath%\6 7
goto back
:7
set backpath_full=%backpath%\7
ren %backpath%\7 1
goto back

:back
exp yssh/yssh file=%backpath_full%.dmp
set backpath=
set backpath_full=
exit