Page 1 of 1

Table Locking in Oracle

Posted: Thu Jan 16, 2014 2:59 am
by IBMDS4KK
Hi,

We have 3 jobs and in all 3 jobs target table is same. After successfully finished of each job, one record will insert in target table. Means total 3 records. But 3 jobs are different. Is there any possibility of locking the table while inserting 3 records at a time from 3 jobs.

please suggest!

Re: Table Locking in Oracle

Posted: Thu Jan 16, 2014 8:00 am
by thompsonp
I am confused.
All 3 jobs have the same target table. After each finishes you want to insert one record into the target table. Are these the same target table? Do the jobs already insert data into the target table when they are running?

What is the requirement to lock the table? Is this lock designed to stop something else happening at the same time?

Have you considered performing the insert through a package that controls the locking?

Posted: Thu Jan 16, 2014 8:21 am
by chulett
They're asking if there will be a locking issue in this scenario, not looking for a way to lock the table. The answer is no, you'll be fine.

Posted: Thu Jan 16, 2014 3:50 pm
by ray.wurlod
What I'm reading is a desire to take a table level lock for the duration of all three jobs running. Basically, the answer is no, because the three jobs will use separate connections (separate database user numbers), and they can't all own the same lock.

If you want to build transactions of this kind you need all the logic in one job.

Posted: Fri Jan 17, 2014 12:02 am
by IBMDS4KK
Hi,

Thanks for all.

Posted: Fri Jan 17, 2014 9:51 am
by chulett
So... you've got three people with varying answers and interpretations of your post. Out of curiousity what was the actual resolution to your question?