Oracle Automatic Backup

Source: Internet
Author: User

An excellent Oracle automatic backup script (exp for WINDWS)

Zhu Xiaoque

Time:

2011-5-12

First, the contents of the script

Set mydate=%date:~0,10%

Exp System/[email protected] full=y file=d:\ora_bak\data\hzic_%date%.dmp

Log=d:\ora_bak\log\hzic-log_%mydate%.log

forfiles/p "D:\ora_bak\data"/s/m * */d-7/C "cmd/c del @path"

forfiles/p "D:\ora_bak\log"/s/m * */d-7/C "cmd/c del @path"

Note: You only need to copy the above content to Notepad, save As. bat file, note the line, the above is actually 4 lines of content. Schedule settings for automatic backups that can be easily done with Windows Task Scheduler.

Ii. Explanatory Notes

1, set mydate=%date:~0,10%: Set the date variable, in order to automatically use the current date to name when backing up the exported file. 0 for start position, 10 for 10 characters from start position

2, exp system/[email protected] full=y file=d:\ora_bak\data\hzic_%date%.dmp log=d:\ora_bak\log\hzic-log_%mydate%. Log

Use sytem account to export the whole library, the exported data files are stored in the D:\ora_bak\log directory, the exported log files are stored in the D:\ora_bak\log directory.

3, forfiles/p "D:\ora_bak\log"/s/m * * */d-7/C "cmd/c del @path": Automatic deletion of 7 days ago Backup, detailed instructions see the following accessories

--------------------------------------------

 new text document paste the following script content: 

@echo off
setlocal
set sid=? Modify the SID value according to the actual situation
set username=? Assign a value
set password= according to the actual situation? Assign a value
set bakdir= according to the actual situation? Fill in the backup path according to the actual situation
Set bakdate=%date:~0,10%
Set connect=%username%/%password%@%sid%
Exp%connect% full=y buffer=64000000 file=%bakdir%\%bakdate%.dmp log=%bakdir%\exp%bakdate%.log
forfiles/p%bakdir%/d-10-c "cmd/c del/ f/q @path "//delete files 10 days ago
Endlocal

Save as BAT file (for example: Aa.bat), add tasks to the system's scheduled tasks, specify to run the script 02:00 every day


-------- -----------------------------------------
New text Document paste the following script content:

@echo off
Setlocal
Set sid=? Modify the SID value according to the actual situation
Set username=? Assign value according to actual situation
Set password=? Assign value according to actual situation
Set bakdir=? Fill in the backup path according to the actual situation
Set bakdate=%date:~0,10%
Set connect=%username%/%password%@%sid%
Exp%connect% full=y buffer=64000000 file=%bakdir%\%bakdate%.dmp log=%bakdir%\exp%bakdate%.log
forfiles/p%bakdir%/d-10-c "cmd /C del/f/q @path" //delete files 10 days ago
Endlocal

After you save as a bat file (for example: Aa.bat), add tasks to the system's scheduled tasks, specifying that the script runs 02:00 every day.

Oracle Automatic Backup

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.