Oracle database Backup Restore tool with batch Write

Source: Internet
Author: User
Tags exit continue goto key oracle database backup
Because of the usual database backup and restore operations, To improve efficiency and save time, you have the following batch process. This is written for Oracle, can be used on different computers, because it will automatically read the current computer environment variables, so as to obtain the Oracle installation path, the only point is that the program running in the process will produce an intermediate text file, but this is not a major problem , the resulting text file will be automatically deleted after the backup or restore is completed, and the code is as follows:

@echo off&setlocal enabledelayedexpansion
Color 0a
: Start
for/f "tokens=2 delims=="%%a in (' Path ') does (
Set "Str=%%a"
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. Back up 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 filename of the spare parts database:
set/p path= Please enter the stored 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= Please drag the database file you want to import into the body of 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



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.