Automatic Backup batch processing script for Oracle databases in Windows

Source: Internet
Author: User

@ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.