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 least it's a
documented bug that I can simply reference and move on.
The following code and session output (I think) documents a condition
where a procedure marked for an automomous commit is commiting an
INSERT over a database link that is outside of its transactional
boundry. In a nutshell, my INSERT is committing when it shouldn't,
*only* in situations where I have an autonomous transaction, *and* I
have an error handler that doesn't gracefully rollback the
transaction. My test case:
--setup only - the actual test run is further down
create table cca_autonomous_ commit_test_9i (
id number,
creation_date date
)
/
create or replace procedure autonomous_inse rt is
PRAGMA AUTONOMOUS_TRAN SACTION;
begin
--insert into local database table
insert into cca_autonomous_ commit_test_9i values ( 1 ,sysdate );
commit;
end;
/
create or replace procedure dloomis_test
is
begin
--reset environment
delete from cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s;
delete from cca_autonomous_ commit_test_9i;
commit;
--insert over database link.
insert into cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s values (
1, sysdate );
--call my autonomous procedure, which should *NOT* commit the record
above
autonomous_inse rt;
--raise error, for testing purposes only
raise NO_DATA_FOUND;
end;
/
--the test output
Session 1:
--Execute dloomis_test, which should throw no_data_found by design:
SQL> exec dloomis_test
BEGIN dloomis_test; END;
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "APPS.DLOOMIS_T EST", line 20
ORA-06512: at line 1
Session 2 - everything looks ok:
SQL> select count(*) from cca_autonomous_ commit_test_9i;
COUNT(*)
----------
1
SQL> select count(*) from
cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s;
COUNT(*)
----------
0
Now, if I Control-C out of session 1, the 8i record is commited
somehow:
Session 2:
SQL> select count(*) from
cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s;
COUNT(*)
----------
1
This is not always reproducable, but if you run the test several times
over you will get the results above. My question is - how is the 8i
record being commited, if the only commit being issued is in the
autonomous procedure? I realize an explicit ROLLBACK command in the
WHEN OTHERS block will fix the issue, but I'd still like an answer on
why this happens under the above condition.
Thanks a bunch -
Dan Loomis
IT Engineer, Cisco Systems 1 4489 dl*****@gmail.c om (Dan Loomis) wrote in message news:<e2******* *************** ****@posting.go ogle.com>... 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 least it's a documented bug that I can simply reference and move on.
The following code and session output (I think) documents a condition where a procedure marked for an automomous commit is commiting an INSERT over a database link that is outside of its transactional boundry. In a nutshell, my INSERT is committing when it shouldn't, *only* in situations where I have an autonomous transaction, *and* I have an error handler that doesn't gracefully rollback the transaction. My test case:
--setup only - the actual test run is further down create table cca_autonomous_ commit_test_9i ( id number, creation_date date ) /
create or replace procedure autonomous_inse rt is
PRAGMA AUTONOMOUS_TRAN SACTION;
begin
--insert into local database table insert into cca_autonomous_ commit_test_9i values ( 1 ,sysdate ); commit;
end; /
create or replace procedure dloomis_test
is
begin
--reset environment delete from cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s; delete from cca_autonomous_ commit_test_9i;
commit;
--insert over database link. insert into cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s values ( 1, sysdate );
--call my autonomous procedure, which should *NOT* commit the record above autonomous_inse rt;
--raise error, for testing purposes only raise NO_DATA_FOUND;
end; /
--the test output Session 1:
--Execute dloomis_test, which should throw no_data_found by design:
SQL> exec dloomis_test BEGIN dloomis_test; END;
* ERROR at line 1: ORA-01403: no data found ORA-06512: at "APPS.DLOOMIS_T EST", line 20 ORA-06512: at line 1
Session 2 - everything looks ok:
SQL> select count(*) from cca_autonomous_ commit_test_9i;
COUNT(*) ---------- 1
SQL> select count(*) from cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s;
COUNT(*) ---------- 0
Now, if I Control-C out of session 1, the 8i record is commited somehow:
Session 2:
SQL> select count(*) from cca_autonomous_ commit_test_8i@ xxcts_sjoe_ccai s;
COUNT(*) ---------- 1
This is not always reproducable, but if you run the test several times over you will get the results above. My question is - how is the 8i record being commited, if the only commit being issued is in the autonomous procedure? I realize an explicit ROLLBACK command in the WHEN OTHERS block will fix the issue, but I'd still like an answer on why this happens under the above condition.
Thanks a bunch -
Dan Loomis IT Engineer, Cisco Systems
Dan, the execution of an anonymous transaction as part of a
distributed transaction in 8i is unsupported. This is stated in the
8i manuals and normally results in an error being raised. Version 9+
does support performing an anonymous transaction as part of a
distributed transaction, but I would expect this to work only when
connecting to another version 9+ database.
It would appear each database is following the rules for its version.
IMHO -- Mark D Powell -- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 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).
|
by: Brent Mondoux |
last post by:
Hey everyone,
I have a set of stored procedures that call each other to perform a
set of tasks. I have decided to do this for database performance
reasons rather than doing it from a ColdFusion page (and to prevent
timeouts, etc.)
These stored procedures run every night and handle scheduled tasks in
a complex system.
|
by: Andrew Mayo |
last post by:
Here's a really weird one for any SQL Server gurus out there...
We have observed (SQL Server 2000) scenarios where a stored procedure
which
(a) begins a transaction
(b) inserts some rows into a table
(c) re-queries another table using a subquery which references the
inserted table (correlated or not)
|
by: _link98 |
last post by:
On Linux or Solaris with UDB 8.2.2, can an SQL/PL stored-procedure
use two-phase-commit with nicknames and if DB2 provides the
Transaction-manager?
i.e. in the same transaction, can an SQL/PL procedure
update a local table and
also update a nicknamed-table (in another database
on the same hostname), before committing ?
Is this possible, or must I have a CLI procedure and not use nicknames?
|
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 and then log
them inside database tables.
What about:
1) using memory structures to hold the info, then
commit to the database just before exit (after the
| |
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
| |
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 least it's a
documented bug that I can simply reference and move on.
The following code and session output (I think) documents a condition
where a procedure marked for an automomous commit is commiting an
INSERT over a database link that is outside...
|
by: Serge Rielau |
last post by:
John Hopfield wrote:
If you were Pinocchio I'd say: "Listen to the grasshopper".
Locks have be held until the transaction commits.
Ideally your application should do this. But you add the COMMIT in your
procedure as well if it encapsulates a complete transaction.
In addition (not as a substitute) you also want to look at setting
DB2_SKIP_INSERTED. Generally a good feature.
Cheers
Serge
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |