Automatic oracle Database Backup

Source: Internet
Author: User

@ Echo off
REM ####################################### ####################
REM # Windows Server 2008 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 = pwd
REM creates a backup directory with the directory structure of backup/YYYYMMDD/
If not exist "oracle_backup" mkdir oracle_backup
If not exist "oracle_backup \ % CURDATE %" mkdir oracle_backup \ % CURDATE %
Set CURDIR = oracle_backup \ % CURDATE %
Set FILENAME = % CURDIR % \ % OWNER % _ % CURDATE % _ % CURTIME %. dmp
Set EXPLOG = % CURDIR % \ % OWNER % _ % CURDATE % _ % CURTIME % _ log. log
REM calls the ORACLE exp command to export user data
Exp % USER %/% PASSWORD % @ sid log = % EXPLOG % file = % FILENAME % owner = (% OWNER %)
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.