Automatically backs up the Oracle database and uploads the FTP server using the Bat batch file under Windows

Source: Internet
Author: User
Tags mkdir

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&gt ; >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

Related Article

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.