Write an Oracle backup tool using batch processing

Source: Internet
Author: User

This article describes how to create an Oracle backup tool. It mainly uses common batch processing methods to create an Oracle backup tool. Hope to help you.

This is written for Oracle and can be used on different computers, because it will automatically read the environment variables of the current computer to obtain the Oracle installation path, the only drawback is that an intermediate text file will be generated during the running process of the program, but this does not affect the event. After the backup or restoration is complete, the generated text file will be automatically deleted. The Code is as follows:

 
 
  1. @ Echo off & setlocal enabledelayedexpansion
  2. Color 0a
  3. : Start
  4. For/f "tokens = 2 delims =" % a in ('path') do (
  5. Set "str = %"
  6. Set str =! Str: = +!
  7. For % I in (! Str !) Do (
  8. Set "var = % I"
  9. Set var =! Var: + =!
  10. Echo! Var!> Change.txt
  11. For/f "delims =" % I in ('findstr "oracle" change.txt ') do set var = % I
  12. )
  13.  
  14. )
  15.  
  16. Set/p choice = 1. Backup 2. Restore 3. Press any key to exit:
  17. If % choice % = 1 goto exp
  18. If % choice % = 2 goto imp
  19. : Exp
  20. Del/q change.txt
  21. Set/p file = enter the file name of the spare parts database:
  22. Set/p path = enter the storage path (remember to enter the colon :):
  23. "% Var %" \ exp.exe smhr/smhr file = % path % \ % file % full = n
  24. Set/p choice = 1. Continue 2. Press any key to exit:
  25. If % choice % = 1 goto start
  26. : Imp
  27. Del/q change.txt
  28. Set/p file = drag the database file to be imported into the form:
  29. "% Var %" \ imp.exe smhr/smhr file = % file % full = y
  30. Set/p choice = 1. Continue 2. Press any key to exit:
  31. If % choice % = 1 goto start

Through this article, I hope you will have a better understanding of Oracle backup tools.

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.