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 *.dmp/d -10/c "cmd/c del @path"
forfiles/p "D:\oraclebackup"/M *.log/d -10/c "cmd/c del @path"
Echo is backing up the Oracle database, please wait a moment ...
Expsystem/[email protected]=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
The echo task is 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 that at that time I was added tables= (system.xxx%), the result bat file can not be executed, the original bat ' file% must be a percent, this problem I have been engaged for a long time to understand ~~~~~
Add a task Schedule Oraclebackup
Start > All Programs > Accessories > System Tools > Task Scheduler > Add Task Schedule > Next > Browse to find the Oraclebackup.bat file you just wrote > Task Name Input Oraclebacku P, perform this task select daily, Next > Start time 12:00, start date 2009-7-11, Next > enter username and password, username required is Administrator rights user name, Next > Complete
After clicking "Finish", a task plan named "YTCN" is added under the Task Scheduler to indicate that it has been configured.
Note: Sometimes after clicking "Done", the system warns
"A new task has been created, but may not run because the account information cannot be set.
The specified error is:
Ox80041315: The Task Scheduler service is not running "
This is because the Task Scheduler service of the computer does not start up. Start > All Programs > Administrative Tools > Services, find the "task Scheduler" service, find that the startup type is "disabled", right-click Change to "Auto", start it up, and then add the Task Scheduler again oraclebackup.
Scheduled daily backup of Oracle database under Windows system