How to lock Oracle table through UNIX?

Hi frndz,

Can anyone provide me some input or pseudo code for my req as mentioned below...

I am loading 2 files through unix script into oracle table...as i am doing some updates also i am getting an error where both files try to update the table simultaneously and my script fails..

so i need to put some logic where if one file is updating the table then no other other try to load and once previous file loaded successfully then only second file try to load the table..
I have to use only one script so dont have an option to create new script and run sequentially..

Plese provide some input on this..
TIA

Are you using sqlldr to load the tables? Highly recommended.

Can you post the part of the script that does updates? - things like select for update will lock a table. And may leave it locked.

How can you update a table from two files in one script in parallel/simultaneously? If you put one "load" into background and then lock the table, in effect the "loads" will run sequentially.
Select ... for update will lock the table for the entire transaction (ended by commit/rollback/ending the session), so if you make very small transactions for "parallel" (in fact "ping pong") updates, you'll pay a price in transaction speed.

Hi,

i guess i couldnt explain correctly..please ignore my previous post my actual req is as below mentioned..

load_cdr-->main script
Source Feeds are A & B.
File in A-akm.dat
File in B-bkm.dat
Now my script runs through cron jobs everyday...and for both A&B it runs parllely...i.e script will start loading data from akm also and bkm also...prob is these two files try to update same table at some point and gives an error.

for eg: i use one script named as daily.sh which consist of commands which start my script

nohup opt/app/dev/scripts/load_cdr.sh A > opt/app/dev/logs &
nohup opt/app/dev/scripts/load_cdr.sh B > opt/app/dev/logs &

I cannot go with an option where i run my script sequentially for each source Feeds. So need smthing like sleep command usage ..

**when ever any feed's file start loading it creates some lock file..
eg: if akm.dat dile of source feed A is getting loaded in temp dir A.lck file gets created and similarly for B feed also..

Now i want that my script should check if A.lck file exist in that folder and if it is present and B feed try to load then script loading B feed should go into sleep mode and check in every 5 min if A.lck file got removed or not..once it got removed B file starts loading

It might be bit confusing ..so please let me knw if i missed ny pt.

TIA