Can I use Pragma Autonomous Transactions for Performance Improvement? [message #178326] |
Tue, 20 June 2006 11:16 |
Abhishek_Gupta
Messages: 3 Registered: June 2006 Location: India
|
Junior Member |
|
|
Hi,
I am having a performance issue while launching a concurent program which uses certain insert/update statements in oracle base tables like ra_interface_lines_all, as well as some custom tables. I am planning to fire 5 (the number may increase) parallel instances of that concurrent program. But since that conc program uses insert statements in tables, the programs error out with error of No wait: resources busy, which shows that insert statements have locked the tables. I want to accomplish this by using Pragma Autonomous_transaction command in start of the procedures in package which have insert statements. Is this possible?
Please post a reply to my id to : Abhigupta008@gmail.com
Thanks in Advance,
Abhishek
|
|
|
Re: Can I use Pragma Autonomous Transactions for Performance Improvement? [message #178806 is a reply to message #178326] |
Thu, 22 June 2006 17:22 |
andrew again
Messages: 2577 Registered: March 2000
|
Senior Member |
|
|
Using autonomous transactions in pl/sql will allow you to commit certain records without committing the whole transaction, but you need to be 100% sure that's what you want. If you commit those locked rows, you can't roll them back.
you can implement lock retry logic or just serialze the jobs you currently have in parallel.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:4515126525609
To serialize some pl/sql try this type of approach...
declare
v_busy_xyz_processes number;
begin
for i in 1..100 loop
-- is a copy of this code running already?
select count(*) into v_busy_xyz_processes
from v$session where user_info = 'XYZ process';
if v_busy_email_processes = 0
then
-- No running copy of this code found in v$session, so put
-- signature on this session to signal other processes
-- that we are busy with XYZ.
-- Now this signature will be visible in v$session.
dbms_application_info.set_client_info( 'XYZ process' );
--==================
-- run XYZ here
--==================
...
-- remove signature - or if this code only runs
-- in dbms_job, then it'll end naturally
dbms_application_info.set_client_info( 'done' );
exit; <-- XYZ done, so exit loop
else
-- Sleep 5 sec, then try again. Hopefully the blocking
-- session will be done.
dbms_lock.sleep(5);
end if;
end loop;
end;
/
|
|
|