欢迎您访问我爱IT技术网,今天小编为你分享的电脑教程是:Oracle数据库还原和备份向导文件制作,在平时使用电脑中总免不了某些软件的激活、甚至备份等,比如:辛辛苦苦写的程序没做好备份丢失了,那是很难受的事儿。本文针对这些诸多问题,由我爱IT技术网电脑教程小编,精心整理并收集网络上这些有用的知识分享给大家,注意知识来源于互联网,是有用的知识收集整理,如果你觉得有侵犯你的权利的,请你及时联系本站的相关负责人,我们会在第一时间为你处理,谢谢你的配合!
Oracle数据库还原和备份向导文件制作
Oracle数据库软件从官方那边出来在大家的印象中都是命令操作数据库的,当然这里我也可以告诉大家其实oracle也有可视化软件比如“PLSQL Developer”和“Toad”这两个软件都是比较好用的,具体的使用方法我这里就不写了!作为一个网络网站系统的软件工程师我喜欢使用黑色界面的窗体(DOS界面)操作命令代码,这里就有一个难题如何使用oracle自带的导入工具imp.exe和导出工具exp.exe达到导入和导出数据库的效果呢?直接Win+R运行cmd命令吗?这个样要是我们对命令不是很熟悉怎么办?有没有更好的向导性工具吗?答案是有的,那就是接下来大家和我一起来制作属于自己的DIY ORACLE数据库导入和导出向导吧!【本人:伊夏诺&紫色年华】
前期准备工作(包括相关工具或所使用的原料等)
步骤:制作前准备->准备文本文件->编写代码->变身计划
详细的操作方法或具体步骤
首先我们要查看下我们的电脑“环境变量”:“Path”和“PATHEXT”,保证imp命令和exp命令在cmd DOS界面中可以正常使用。
1、“Path”环境变量:作用是告诉系统当遇到无法识别的命令时自动去Path所列出的目录中寻找相应文件(程序);
2、“PATHEXT”环境变量:作用是告诉系统当遇到无法识别的命令时自动补全PATHEXT中所列的后缀名并寻找相应的文件(程序);
查看和编辑环境变量的步骤详情请见当前方法步骤配的图片,总共5张图片;
win7:右键点击【计算机】——>【高级系统设置】——>【高级】——>【环境变量】
xp:右键【我的电脑】——>【高级】——>【环境变量】
“Path”环境变量只要写到你oracle安装路径下的BIN文件夹即可;“PATHEXT”环境变量要看看是否已经有“.EXE;”或者“.exe”即可,如果没有请添加“.EXE;”





我们先来看下制作完成的界面:黑色的DOS界面,大家只要根据该向导就可以导出我们oracle数据库的备份了!

首先创建一个txt文本文档,将下面的代码拷贝进去,然后把后缀名改为".bak"的就可以了!这样一个简单的oracle数据库导出向导就这样的完成了!
代码:
@echo offtitle ORACLE数据库备份和还原向导
cls
echo.
echo Welcome to use the ORACLE database backup and restore wizard
echo to backup and restore the ORACLE database echo.
echo Author:伊夏诺^&紫色年华 --- 2014/02/27
echo.
echo Operational preparation:
echo 使用前请大家确认一下系统环境变量"Path"中没有自己安装的目录的BIN路径,
echo 还有环境变量"PATHEXT"中已经配置了".EXE;"或".exe;"
echo.
echo==STEP 1==Choose the kind operation
echo 1) exp: export oracle data backup;
echo 2) imp: import the oracle database backup;
echo 3) exit: The end of the;
echo.
:op
set /p operation=Your operation option: if "%operation%"=="exp" goto export
if "%operation%"=="imp" goto import
if "%operation%"=="exit" goto end
if not "%operation%"=="exp" (
if not "%operation%"=="imp" (
if not "%operation%"=="exit" (
echo Wrong, there is no "%operation%" options! Please "imp" from the "exp" options, options, options in the "exit" select your operating options! echo.
goto op
)
)
)
@REM export oracle data backup
:export
echo You select the export operation, please continue to export conditions according to the guide configuration; We will provide better service for you!
REM :reSetExp
echo.
echo==STEP 2==Configure the account
set /p username=UserName:
set /p password=Password:
echo.
echo==STEP 3==Configuration to export the database backup file storage path
set /p file=Storage Path:
echo.
echo==STEP 4==Choose export data range
echo A) Export the entire database
echo B) All the table space which belongs to user
echo C) Export to specify the tablespace
set /p scope=Export data range:
if "%scope%"=="A" goto full
if "%scope%"=="B" goto owner
if "%scope%"=="C" goto tablespace
:full
echo.
echo==STEP 5==Configure the database name
set /p database=Database:
exp %username%^/%password%@%database% file=%file% full=y
echo.
echo Export to complete!
echo Backup file storage path: %file%
pause
goto end
:owner
echo.
exp %username%^/%password% file=%file% owner=%username%
echo Export to complete!
echo Backup file storage path: %file%
pause
goto end
:tablespace
echo.
echo==STEP 5==Configure the database name and tablespaces
set /p database=Database:
set /p tablespace=Tablespace:
exp %username%^/%password%@%database% file=%file% tablespaces=%tablespace%
echo Export to complete!
echo Backup file storage path: %file%
pause
goto end
@REM import the oracle database backup
:import
echo You chose the import operation, please continue to import conditions
according to the guide configuration; We will provide better service for you!
:reSetImp
echo.
echo==STEP 2==Configure the account
set /p username=UserName:
set /p password=Password:
echo.
echo==STEP 3==Configure the database name
set /p database=Database:
echo.
echo==STEP 4==Configuration to import the database backup file storage path
set /p file=Storage Path:
echo.
echo==STEP 5==Choose import data range
echo 1) full: Import the entire database
echo 2) part: Import, part of the data in the database can not be used at present
set /p scope=Import data range:
imp %username%^/%password%^@%database% file=%file% full=y
pause
goto end
@REM The end of the
:end
echo The upcoming wizard...
exit
下面是最终的文件:

注意事项
如果大家觉得好请关注一下!
本文仅供参考,如果您需解决具体问题(尤其法律、医学等领域),建议您详细咨询相关领域专业人士。作者声明:本文系本人依照真实经历原创,未经许可,谢绝转载。以上就是关于Oracle数据库还原和备份向导文件制作的分享,如果你有更好的经验或者补充,请在下面评论框中发表你的答案。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
