Thursday, November 27, 2008

DB - Import Oracle DB Script

@echo off
SETLOCAL

Set USERNAME=userid
Set PASSWORD=ps
Set SID=artd
Set DATA_FILE=outdat

@rem Check all value exist before we start the process

if "%USERNAME%" == "" goto formaterror
if "%PASSWORD%" == "" goto formaterror
if "%SID%" == "" goto formaterror
if "%DATA_FILE%" == "" goto formaterror

goto main

:formaterror
echo Usage: import [username] [password] [sid] [data_filename]
@echo off
goto finish

:main
SQLPLUS %USERNAME%/%PASSWORD%@%SID%
cd ..
imp %USERNAME%/%PASSWORD%@%SID% file=%DATA_FILE%.dmp log=%USERNAME%imp.log fromuser=%USERNAME% touser=%USERNAME% ignore=y

:finish

No comments: