Home » SQL & PL/SQL » SQL & PL/SQL » Truncat partition - resource busy (Oracle 9i)
Truncat partition - resource busy [message #473993] Wed, 01 September 2010 21:26 Go to next message
RMSoares
Messages: 46
Registered: September 2010
Location: Lisboa
Member
Hi,
i have one procedure that run at same time for two different partition.
In the begin of the processes i do the truncate partition and after that the insert of data in the partition.
Since i have two processes running at the same time, i will fill up data in two different partition.

But it occurred one error :
"ORA-00054: resource busy and acquire with NOWAIT specified"

The problem is caused by the truncate partition. I'm doing two simultaneous execution of the same process, but when one process is doing the truncate other is insert data.

How can i do the truncate of this two partition, or insert in to, without get any error. I think the two simultaneous insert is not a problem.

So how can i lock the table in the first truncate and after that release the table for the next truncate ?

Any ideas ? Any other ideas ?

regards
Re: Truncat partition - resource busy [message #473998 is a reply to message #473993] Wed, 01 September 2010 22:21 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
> I think the two simultaneous insert is not a problem.
The error would indicate that Oracle disagrees with you & it wins!

>So how can i lock the table in the first truncate and after that release the table for the next truncate ?
Manual LOCK is almost ALWAYS a bad idea in Oracle.

>Any ideas ? Any other ideas ?
Does any GLOBAL INDEX exist on this table?

It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/
Re: Truncat partition - resource busy [message #474008 is a reply to message #473998] Thu, 02 September 2010 00:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
I'm doing two simultaneous execution of the same process, but when one process is doing the truncate other is insert data.
How can i do the truncate of this two partition, or insert in to, without get any error.


Very simple, comment the insert statements, after all you don't care if something is inserted or not as you will immediately remove (truncate) it.n ;l)

Quote:
So how can i lock the table in the first truncate and after that release the table for the next truncate ?

Use GTT (Global Temporary Table) instead of permanent and no more truncate.
Now the question is, why do you need a temporary table? Most often the answer is: becasue you bad (Oracle) coded.

Regards
Michel

[Updated on: Thu, 02 September 2010 00:46]

Report message to a moderator

Re: Truncat partition - resource busy [message #474024 is a reply to message #473993] Thu, 02 September 2010 02:05 Go to previous messageGo to next message
RMSoares
Messages: 46
Registered: September 2010
Location: Lisboa
Member
Hi BlackSwan
thanks for your awnser.

No, we don't have any GLOBAL INDEX on that tables

Regards

Re: Truncat partition - resource busy [message #474026 is a reply to message #474024] Thu, 02 September 2010 02:12 Go to previous messageGo to next message
Michel Cadot
Messages: 68767
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Read my answer.

Regards
Michel
Re: Truncat partition - resource busy [message #474034 is a reply to message #473993] Thu, 02 September 2010 02:58 Go to previous message
RMSoares
Messages: 46
Registered: September 2010
Location: Lisboa
Member
You said :
"Very simple, comment the insert statements, after all you don't care if something is inserted or not as you will immediately remove (truncate) it.n ;l)"

It's not correct, i will insert 100000 rows in each partition

I will try the GTT (Global Temporary Table)

Why i need the temporary table? well i'm doing massive transformation to a Data Mart, where i used same process that could be executed at the same time, to different partition.
Actually only two partition, but the number of partition will be increase.

Why i don't do everything in only one process ? Because it will be a very complex process and will be very difficult the is maintenance.


thanks for your support
Previous Topic: Multilevel Collection Comparison using sets
Next Topic: Finding the Cost of Query
Goto Forum:
  


Current Time: Fri Aug 22 18:06:45 CDT 2025