Backing up Oracle with a bat batch file (provided the Oracle database client is configured)
Create a dbbackup directory under the D-Disk directory to build a Dbbak.bat
@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 15 days ago. echo ================================================:: Remove the current time in "YYYYMMDD" format. Set backupdate=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%:: Create a backup directory. If not exist ' D:\dbbackup\data ' mkdir D:\dbbackup\data if not exist ' D:\dbbackup\log ' mkdir D:\dbbackup\log set D Atadir=d:\dbbackup\dataset logdir=d:\dbbackup\logexp userid= ' ntes/[email protected] ' file=%DATADIR%\njtes_% Backupdate%.dmp log=%logdir%\njtesog_%backupdate%.log:: Delete the backup 15 days ago. forfiles/p "%datadir%"/s/m * */d-15/c "cmd/c del @path" forfiles/p "%logdir%"/s/m * */d-15/c "cmd/c del @pa Th ":: Upload file to FTP server echo open IP address >ftpupload.txtecho user username password >>ftpupload.txtecho binary>>ftpupload.txt Set to transfer files in binary mode echo hash>>ftpupload.txt//Switch the digital signature (#) of each data block that has been transferred print Echo put%datadir%\njtes_%backupdate%.dmp> ; >FTPUPLOad.txt//Upload file echo bye>>ftpupload.txtftp-n-s:ftpupload.txtdel ftpupload.txt/q.//Delete generated ftpupload.txt file, this Files are the above information can not be reserved exit
Note: The Dbbak.bat backup script is placed in D:\dbbackup, which is generated in the Dbbak.bat script's (D:\dbbackup) sibling directory if the Ftpupload.txt file is not deleted.
Automatically backs up the Oracle database and uploads the FTP server using the Bat batch file under Windows