Bat writing in dmp format for automatic database backup in window, dmpbat

Source: Internet
Author: User

Bat writing in dmp format for automatic database backup in window, dmpbat

Copy the following command to a txt text file, and modify the corresponding parameters as needed. After everything is completed, save the file in bat format.
In this way, you only need to double-click the bat file every time you need to back up the file. You don't need to use any other files. You just need to wait quietly ......
 
</pre><pre code_snippet_id="494366" snippet_file_name="blog_20141023_4_5799611" name="code" class="plain">
/// The following command can be directly copied and used
@ Echo off echo start REM ################################## ######################### REM # Oracle Database automatic backup batch processing script REM under Windows Server 2003 # ######################################## ################# REM obtains the current system time, the value may vary depending on the operating system. set CURDATE = % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2% set CURMON = % date :~ 0, 4% % date :~ 5, 2% set CURTIME = % time :~ 0, 2% REM hours if less than 10, add 0 if "% CURTIME %" = "0" set CURTIME = 00if "% CURTIME %" = "1" set CURTIME = 01if "% CURTIME %" = = "2" set CURTIME = 02if "% CURTIME %" = "3" set CURTIME = 03if "% CURTIME %" = "4" set CURTIME = 04if "% CURTIME % "=" 5 "set CURTIME = 05if" % CURTIME % "=" 6 "set CURTIME = 06if" % CURTIME % "=" 7 "set CURTIME = 07if" % CURTIME % "=" 8 "set CURTIME = 08if" % CURTIME % "=" 9 "set CURTIME = 09 set CURTIME = % CURTIME % time :~ 3,2% % time :~ 6, 2% REM set OWNER, USER name, and password set OWNER = xxx (enter your database service name here) set USER = xxx (a USER corresponding to the database you want to back up) set PASSWORD = xxx (PASSWORD) REM creates the backup directory, the directory structure is oraclebak/YYYYMMDD/if not exist "oraclebak" mkdir oraclebakcd oraclebakif not exist "% CURMON %" mkdir % CURMON % set FILENAME = % CURMON %/% USER % _ % CURDATE. % _ % CURTIME %. DMP set EXPLOG = % CURMON %/% USER % _ % CURDATE % _ % CURTIME % _ log. log REM calls the ORACLE exp command to export USER data exp % USER %/% PASSWORD % @ % OWNER % file = % FILENAME % log = % EXPLOG % owner = % USER % grants = n


One database automatically backs up and compresses bat.

1.
Set zip_path = "C: \ Program Files (x86) \ HaoZip"

Note that quotation marks are required for rem. Because no quotation marks are added before, the compression command cannot be found later, so the compression is not performed.

2.
Comment out what the compression program is and what the parameters are

3.
No words are followed, just a bunch of %, that is, the command represented by variables.

How can I set Automatic oracle backup and save the three dmp files in the last week?

1. Use the crontab scheduling exp command to export
2. Use the crontab to schedule the find command to delete files you don't want, as shown in figure
Find/logbak/-atime + 5-name 'Log * '-exec/usr/bin/rm {}\;

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.