473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

using Autonomous transaction

Sam
Guys,
I have a question regarding oracle.

I have a stored procedure executing a number of statements including
delete , select and lots of inserts in one big procedure and main
transaction

I have a stored procedure sp_log_action with a PRAGMA AUTONOMOUS
TRANSACTION defined which is called after each statement in the main
stored procedure(this writes the event to a table).

When i run with one session, the main procedure, it runs as expected
i.e even if there is a error in the main stored Proc, it logs an
error.

But when i run from multiple sessions , it returns me a "deadlock
detected while waiting for resource" error.

It seems to me a locking problem. can u suggest me a way around this.
Or am I doing the right thing to log a event . ???
Any suggestions will be helpful!!

thanks,
Shyam Pillai
Jul 19 '05 #1
2 7861
I doubt that the AUTONOMOUS TRANSACTION has anything to do with the
deadlock error. AUTONOMOUS TRANSACTION can cause deadlock error if it
tries to modify the same record its parent transaction is modifying.
If you are simply doing message logging in the AUTONOMOUS TRANSACTION
routine, deadlock should not occurr. Most likely the deadlock is
caused by the DML statements in the parent transaction. If you have
the following situation, deadlock will occurr:

Session 1 Session 2
--------- --------------
delete row 1
delete row 2
delete row 2
delete row 1
- Jusung Yang
sh******@yahoo.com (Sam) wrote in message news:<56**************************@posting.google. com>...
Guys,
I have a question regarding oracle.

I have a stored procedure executing a number of statements including
delete , select and lots of inserts in one big procedure and main
transaction

I have a stored procedure sp_log_action with a PRAGMA AUTONOMOUS
TRANSACTION defined which is called after each statement in the main
stored procedure(this writes the event to a table).

When i run with one session, the main procedure, it runs as expected
i.e even if there is a error in the main stored Proc, it logs an
error.

But when i run from multiple sessions , it returns me a "deadlock
detected while waiting for resource" error.

It seems to me a locking problem. can u suggest me a way around this.
Or am I doing the right thing to log a event . ???
Any suggestions will be helpful!!

thanks,
Shyam Pillai

Jul 19 '05 #2
sh******@yahoo.com (Sam) wrote in message news:<56**************************@posting.google. com>...
Guys,
I have a question regarding oracle.

I have a stored procedure executing a number of statements including
delete , select and lots of inserts in one big procedure and main
transaction

I have a stored procedure sp_log_action with a PRAGMA AUTONOMOUS
TRANSACTION defined which is called after each statement in the main
stored procedure(this writes the event to a table).
After every statement? You really need that detailed of a trace?
When i run with one session, the main procedure, it runs as expected
i.e even if there is a error in the main stored Proc, it logs an
error.

But when i run from multiple sessions , it returns me a "deadlock
detected while waiting for resource" error.

It seems to me a locking problem. can u suggest me a way around this.
Or am I doing the right thing to log a event . ???
Any suggestions will be helpful!!

thanks,
Shyam Pillai

Is it the called procedure or something else? have you tried removing
the calls to that Proc? What is the specific error message?

Details, Man, we want details! 8^)
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan Loomis | last post by:
Hi guys - I have a weird condition here I'm trying to get resolution on, and unfortunately I'm not getting anywhere with my friends at Oracle. I'm hoping it's something simple, or at the very...
4
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to...
3
by: Saket Mundra | last post by:
I have multiple web forms in my application. The user after logging on is directed to form1 where he enters information desired. Once finished he is directed to form2 and the same procedure goes on...
4
by: Daniel Daoust | last post by:
Hi, knowing that "autonomous transaction" (Oracle concept of) are not yet implemented in PostgreSQL, has anyone found a work-around. I need to preserve database states from a potential rollback...
3
by: Jason Huang | last post by:
Hi, MyForm is a C# Windows Form. MyFom has 3 GroupBoxes. Now I wanna update data from the textboxes in those 3 GroupBoxes. I have function Update1 for GroupBox1 to update table Table1, Update2...
5
by: dilippanda | last post by:
Hi Experts, I want to know what is the use of pragma autonomous transaction in PL/SQL. In which condition should we use this? Please guide me with an example. Thanks, Dilip
1
AdusumalliGopikumar
by: AdusumalliGopikumar | last post by:
Where we can't use Autonomous transaction?
0
debasisdas
by: debasisdas | last post by:
PRAGMA:-Signifies that the statement is a pragma (compiler directive). Pragmas are processed at compile time, not at run time. They pass information to the compiler. A pragma is an instruction to...
2
by: Sam | last post by:
Guys, I have a question regarding oracle. I have a stored procedure executing a number of statements including delete , select and lots of inserts in one big procedure and main transaction I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.