@ Echo off
Rem ####################################### ####################
Rem # Windows Server 2003 Oracle Database automatic backup batch processing script
Rem ####################################### ####################
Rem obtains the current system time. The value may vary depending on the operating system.
Set curdate = % Date :~ 0, 4% % Date :~ 5, 2% % Date :~ 8, 2%
Set curtime = % time :~ 0, 2%
If the REM hours are less than 10, add 0 before
If "% curtime %" = "0" set curtime = 00
If "% curtime %" = "1" set curtime = 01
If "% curtime %" = "2" set curtime = 02
If "% curtime %" = "3" set curtime = 03
If "% curtime %" = "4" set curtime = 04
If "% curtime %" = "5" set curtime = 05
If "% curtime %" = "6" set curtime = 06
If "% curtime %" = "7" set curtime = 07
If "% curtime %" = "8" set curtime = 08
If "% curtime %" = "9" set curtime = 09
Set curtime = % curtime % time :~ 3,2% % time :~ 6, 2%
Rem sets the owner, user name, and password
Set owner = owner
Set User = user
Set Password = Password
Set prefix = owner
Rem creates a backup directory with the directory structure of backup/yyyymmdd/
If not exist "% curdate %" mkdir % curdate %
Set curdir = % curdate %
Set filename = % curdir %/% prefix % _ % curdate % _ % curtime %. dmp
Set explog = % curdir %/% prefix % _ % curdate % _ % curtime % _ log. Log
Rem calls the Oracle exp command to export user data
Exp % USER %/% password % @ devdb file = % filename % log = % explog % owner = % owner % grants = N
Cd % curdate %
"C:/program files/WinRAR/winrar.exe" a-DF character prefix1__character curdate1__character curtime=.rar *-R
Exit