Scheduled backup Oracle (Windows)

Source: Internet
Author: User

Step One: Create a backup script Oraclebackup.bat

First create a backup bat file, create a new backup directory oraclebackup under D, copy the EXP.EXE from the Oracle installation directory to this directory, and create a new text file Oraclebackup.txt with the following:

@echo off
@echo Delete the spare files and logs from 10 days ago

forfiles/p "D:\oraclebackup"/M *.rar/d -10/c "cmd/c del @path"

Set Filedir=e:\appsdata\works\orclbackup\btms
Set sysdate=%date:~0,4%-%date:~5,2%-%date:~8,2%.%time:~0,2%%time:~3,2%
Set filename=%expuser%~%orclsid%_%sysdate%

@echo backing up your Oracle database, wait a moment ...

Expsystem/[email protected]=d:/oraclebackup/mdb%filename%.dmp Log=d:/oraclebackup/mdb%filename%.log full=y feedback=10000 buffer=65535
@echo Mission Done!

@echo Start compressing database backups ...

"D:\Apps\Tools\WinRAR\Rar.exe" a%filename%.rar%filename%.dmp
"D:\Apps\Tools\WinRAR\Rar.exe" a%filename%.rar%filename%.log
@echo Database backup Compression complete!

When you're done, change the Notepad suffix txt to bat.

Double-click Oraclebackup.bat to test if you can back up normally.

Step Two: Create a new Windows scheduled task

Go to the Windows Control Panel, open the schedule and tasks, create a new task, click Browse, select the Oraclebackup.bat file under the new D-Disk Oraclebackup directory. Then choose 22:00 every night to execute, and then enter the local administrator password can be.

Note: Here I recorded, I encountered the problem, mainly because I have a user there are many tables, but now I do not need to backup all, only need to back up the XXX table,

OK, modify EXP statement exp System/[email protected] tables= (system.xxx%%) file=d:/oraclebackup/mdb%date:~0,4%%date:~5,2%%date:~ 8,2%.dmp Log=d:/oraclebackup/mdb%date:~0,4%%date:~5,2%%date:~8,2%.log full=y buffer=65535,

Note: The% inside the bat file must be%%!

Scheduled backup Oracle (Windows)

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.