How to implement oracle Database backup and restore tool by batch processing
This article mainly introduces how batch processing to achieve oracle database backup and restore tool, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
This is written for oracle and can be used on different computers, because it automatically reads the environment variables of the current computer to obtain the installation path of oracle. The only deficiency is that an intermediate text file will be generated during the running of the program, but this does not hinder the big deal. After backup or restore, the text file will be automatically deleted as follows:
@ echo off&setlocal enabledelayedexpansion
Color 0a
: start
For / f "tokens=2 delims=="% an in ('path') do (
Set "str=%%a"
Set stringent statr: = +!
For I in (! str!) Do (
Set "var=%%i"
Set varicose var. lug =!
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= Please enter the file name of the spare parts database:
Set / p path= Please enter the storage path (remember 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 you want to import into the window:
"% 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
Thank you for reading this article carefully. I hope the article "how to implement the oracle database backup and restore tool for batch processing" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!