I am using shell scripts to export and import data from oracle tables using expdp and impdp oracle data pump utilities.
Having written shell scripts to do the export part, my export file names are in the format
exp_groupn_mmddyy where
i) groupn can be group0,group1,group2,group3 or group4 (n=0,1,2,3 or 4)
ii) mmddyy indicates the date the export was taken
For example, the files can be (all sitting in one directory - /usr/export )
exp_group0_031107.dmp
exp_group4_031507.dmp
exp_group1_031807.dmp
Now, in my import script, upon running the script, I would like to pass 2 parameters, the group number and
the date. Once, a file found with the group number and the date passed, it must process that file(which was exported earlier).
For example, if the script name is imp_data.ksh,
If I run by passing 2 parameters like:
imp_data.ksh group1 031807
This script should search for the file exp_group1_031807 in the /usr/export directory and on finding it,
should substitute a script variable called $DUMPFILE in the script with this value.
In other words, when the script executes, exp_group1_031807.dmp will be value for $DUMPFILE
The script I have written so far for the import is :
-----------------------------------------------------------------
#!/bin/ksh
LOG_FILE=imp_`date +%m%d%y`.log
ST=`date`
impdb username/password@database file=$DUMPFILE log=$LOG_FILE directory=EXPORT_DIR
fromuser=from_user_name touser=to_user_name
tables=table1,table2 feedback=1000 buffer=20000000 ignore=y
ET=`date`
echo "Start Time=$ST" >>$LOG_FILE
echo "End Time=$ET" >>$LOG_FILE
-----------------------------------------------------------------
Please help. Thanks