Today you need to write a oracle10g backup script on an old Windows2003.
IP1 is a Windows2003 system with a 10G database installed (D:dbbackup is the database backup directory), IP2 to a normal Windows2003 system without installation (D:DBBACKUP2 is the database backup directory). Make a backup on the Oracle-installed machine and write a bat script that reads:
@echo off Echo is backing up the Oracle database, wait a moment ... set mydate=%date:~0,10%//2016-1-6 date format exp user/[email protected] full=y File=d : \dbbackup\orc_%mydate%.dmp buffer=655350000 Log=d:\dbbackup\orc_%mydate%.log//Not explained very simple forfiles/p "D:\dbbackup"/s/m * */d-7//"cmd/c del @path"//delete files from 7 days ago Echo task complete!
Just add the bat to the scheduled task.
I have shared a directory of IP2 to ip1 mapped to x disk, ip1 backup database file copy to IP2 for backup, dual backup purposes.
The script is as follows
@echo off Echo is copying the database, wait a moment ... set mydate=%date:~0,10%copy d:\dbbackup\orc_%mydate%.dmp \\192.168.1.2\dbbackup2copy D:\dbbackup\orc_%mydate%.log \\192.168.1.2\dbbackup2//This can not directly write the mapped x disk because the Windows2003 scheduled task will not be executed, must write the network URC address echo task complete!
then I added a task on the IP2 to delete the 7-day backup, I added a ip1 on the non-implementation, had to use this method, on the local delete
The script is as follows:
@echo off ECHO is deleting the Oracle database 7 days ago, please wait ... forfiles/p "D:\dbbackup2"/s/m * * */d-7/"cmd/c del @path" Echo task completed!
The use of the Windows console's copy command to modify the file creation time can be used to test the successful operation of the Forfiles script, as follows:
1. Modify the system time for the target time you need to change to;
2. Run the command: Copy file name +, (note is two consecutive commas).
WINDOWS2003 on 10G Oracle Backup