Automated backup scripts for Oracle databases in Windows environments

Source: Internet
Author: User

@echo off Echo ================================================ Echo automatic backup script for Oracle database in Windows echo 1. Use the current date to name the backup file. Echo 2. Automatically delete backups up to 30 days ago. echo ================================================:: Remove the current time in "YYYYMMDD" format. Set Backupdate=%date:~0,4%%date:~5,2%%date:~8,2%set Curtime=%time:~0,2%rem hours if less than 10, 0if "%curtime%" = = "0" set in front of Curtime=00if "%curtime%" = "1" Set curtime=01if "%curtime%" = = "2" Set curtime=02if "%curtime%" = = "3" Set Curtime=03if "%CU  Rtime% "= =" 4 "Set curtime=04if"%curtime% "= =" 5 "Set curtime=05if"%curtime% "= =" 6 "Set curtime=06if"%curtime% "= =" 7 "Set Curtime=07if "%curtime%" = = "8" Set curtime=08if "%curtime%" = = "9" Set Curtime=09set curtime=%curtime%%time:~3,2%%time:~ 6,2%:: Sets the user name, password, and database to be backed up. Set User=carbon_zhenjiang_bakset password=carbon_zhenjiang_bakset DATABASE=ORCL:: Create a backup directory. If not exist "D:\backup\data\%BACKUPDATE%" mkdir D:\backup\data\%BACKUPDATE%if not Exist "D:\backup\log\%BACKUPDATE%" mkdir D:\backup\log\%BACKUPDATE%set Datadir=d:\backup\data\%backupdate%set LOgdir=d:\backup\log\%backupdate%exp%user%/%password%@%database% File=%datadir%\%user%_%backupdate%%curtime%.dmp Log=%logdir%\log_%backupdate%%curtime%.log:: Delete the backup 30 days ago. forfiles/p "%datadir%"/s/m * */d-30/c "cmd/c del @path" forfiles/p "%logdir%"/s/m * */d-30/c "cmd/c del @path The exit

Automated backup scripts for Oracle databases in Windows environments

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.