Parallel sqlldr to load data.

I am using SQLLDR to load data in DB.For parallel loading I'm using nohup command.
The requirement is:
I have different files within a directories.
Ex: 1) Dir/folder_A/AE.txt
2) Dir/folder_A/DM.txt
3) Dir/folder_B/CM.txt
I need to loop through directories and load the data parallelly in Database table.

The problem is: if the file is being loaded I need to check if another file from same directory is still loading then this new file should wait for previous to complete load else this new file will start loading data parallely.

ex : if AE.txt is already loading and DM.txt comes then it should check if DM.txt is also from folder_A,if yes then check if AE.txt is still loading the data ,if yes then wait for it to finish else load DM.txt,when other file CM.txt comes in since it is in folder_B it can start loading data no matter DM.txt is still l loading or not.

Please help!

How many directories you have? Are those fixed?

You can do something like..

for mydir in <dirs>
do 
  load_my_data $mydir &
done
wait

Inside load_my_data,

function load_my_data {
 local dir=$1
 for myfile in $dir
 do
  sqlldr ... ...
 done

}
1 Like