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:
- @ Echo off & setlocal enabledelayedexpansion
- Color 0a
- : Start
- For/f "tokens = 2 delims =" % a in ('path') do (
- Set "str = %"
- Set str =! Str: = +!
- For % I in (! Str !) Do (
- Set "var = % I"
- Set var =! Var: + =!
- Echo! Var!> Change.txt
- For/f "delims =" % I in ('findstr "oracle" change.txt ') do set var = % I
- )
-
- )
-
- Set/p choice = 1. Backup 2. Restore 3. Press any key to exit:
- If % choice % = 1 goto exp
- If % choice % = 2 goto imp
- : Exp
- Del/q change.txt
- Set/p file = enter the file name of the spare parts database:
- Set/p path = enter the storage path (remember to enter the colon :):
- "% Var %" \ exp.exe smhr/smhr file = % path % \ % file % full = n
- Set/p choice = 1. Continue 2. Press any key to exit:
- If % choice % = 1 goto start
- : Imp
- Del/q change.txt
- Set/p file = drag the database file to be imported into the form:
- "% Var %" \ imp.exe smhr/smhr file = % file % full = y
- Set/p choice = 1. Continue 2. Press any key to exit:
- If % choice % = 1 goto start
Through this article, I hope you will have a better understanding of Oracle backup tools.