步骤:制作前准备->准备文本文件->编写代码->变身计划
首先我们要查看下我们的电脑“环境变量”:“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数据库备份和还原向导 clsecho.echo Welcome to use the ORACLE database backup and restore wizard echo to backup and restore the ORACLE database echo.echo Author:伊夏诺^&紫色年华 --- 2014/02/27echo.echo Operational preparation: echo 使用前请大家确认一下系统环境变量'Path'中没有自己安装的目录的BIN路径, echo 还有环境变量'PATHEXT'中已经配置了'.EXE;'或'.exe;'echo.echo == STEP 1 == Choose the kind operationecho 1) exp: export oracle data backup;echo 2) imp: import the oracle database backup;echo 3) exit: The end of the;echo.:opset /p operation=Your operation option: if '%operation%'=='exp' goto exportif '%operation%'=='imp' goto importif '%operation%'=='exit' goto endif 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:exportecho You select the export operation, please continue to export conditions according to the guide configuration; We will provide better service for you! REM :reSetExpecho.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 fullif '%scope%'=='B' goto ownerif '%scope%'=='C' goto tablespace:fullecho.echo == STEP 5 == Configure the database name set /p database=Database: exp %username%^/%password%@%database% file=%file% full=yecho.echo Export to complete!echo Backup file storage path: %file%pausegoto end:ownerecho. exp %username%^/%password% file=%file% owner=%username%echo Export to complete!echo Backup file storage path: %file%pausegoto end:tablespaceecho.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%pausegoto end@REM import the oracle database backup:importecho You chose the import operation, please continue to import conditionsaccording to the guide configuration; We will provide better service for you!:reSetImpecho. 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 pathset /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=ypausegoto end@REM The end of the:endecho The upcoming wizard...exit下面是最终的文件:
如果大家觉得好请关注一下!