Today's Birthday
Quote of the Day
This Day in History

Tuesday, May 8, 2007

Import through UNIX pipe

This script imports through an UNIX pipe.This is useful when space is at a premium or when you are dealing with an export dump file that is larger than 2GB and you are working on a file system that can not handle files larger than 2GB in size.


#!/bin/ksh
. ~/.profile

##
## script name : imp_pipe.ksh
## Author : Ramakrishna Nemani
##
## Purpose :
## This script imports from an oracle export dump file through a UNIX pipe.
## This is useful when space is at a premium or when you are dealing with an export dump file
## that is larger than 2GB and you are working on a file system that can not handle files
## larger than 2GB in size
##
##
##
## Note :
## There are a bunch of modifiable parameters in this script that you should modify to
## reflect your environment.
## I have tested this script on UNIX/LINUX.
## Use it at your own risk.
##
## This is an example or sample script
##

## ----------------------------------------------------------------------------
## Begining of modifiable parameters
## ----------------------------------------------------------------------------


ORACLE_SID=slsd; export ORACLE_SID

##
## name the directory that has the import dump file
##

IMP_DIR="/u01/import/"

##
## name a directory where you want to create the export logs, errors and pipes
##

LOG_DIR="/u01/log/"


##
## name your export dump file here
##

EXPDUMPFILE=${IMP_DIR}slsp_exp.dmp.gz

##
## name your pipe - you can give any name, I prefer to give ORACLE_SID.pipe
##

PIPEFILE=${LOG_DIR}slsd.pipe

##
## name your import parameters file (parfile) here
##

PARFILE=${LOG_DIR}imp_slsd.par

##
## name your Error log files here
##

ERRFILE=${LOG_DIR}imp_slsd.out
LOGFILE=${LOG_DIR}imp_slsd.log

## ----------------------------------------------------------------------------
## End of modifiable parameters
## ----------------------------------------------------------------------------

##
## Create a pipe
##

rm $PIPEFILE
mknod $PIPEFILE p

##
## unzip and read the compressed dump file to the screen
## and redirect the screen output to the pipe . This process
## is run in the background
##

gunzip -c $EXPDUMPFILE > $PIPEFILE &

##
## Import from pipe
##

imp parfile=$PARFILE log=$LOGFILE file=$PIPEFILE 2> $ERRFILE

exit

No comments:

Post a Comment