Home » SQL & PL/SQL » SQL & PL/SQL » Insert Hangs (Oracle 10.0.2)
icon8.gif  Insert Hangs [message #625495] Thu, 09 October 2014 04:04 Go to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
Hello All,

I do an insert in a table tab1 which has 2 unique keys
unique key 1 : col1, col2, col3
unique key 2 : col1, col2, col3, col4

Insert into tab1 (col1, col2, col3, col4) values (1,2,3,4);


first time it gave me an error ORA-02049

The application rolled back

Now if I re execute the query it hangs! there is no error message!

I thought there is a lock in the table row but there is no lock.


select a.sid, a.serial#,sql_id ,(case LOCKED_MODE when 0 then 'none'
when 1 then 'null'
when 2 then 'row-S'
when 3 then 'row-x'
when 4 then 'share'
when 5 then 'S/Row-X'
when 6 then 'exclusive'
end ) LOCKED_MODE
from v$session a, v$locked_object b, dba_objects c
where b.object_id = c.object_id
and a.sid = b.session_id;


Any body has an idea what this is waiting for. Where can I find this?

Please help me....

I have posted this in development forum also cas I don't know in which categorie to add.

Sorry for my english...
Dan.


Edited by Lalit : Added code tags

[Updated on: Thu, 09 October 2014 04:35] by Moderator

Report message to a moderator

Re: Insert Hangs [message #625497 is a reply to message #625495] Thu, 09 October 2014 04:36 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
Welcome to the forum!

Please read and follow the OraFAQ Forum Guide and How to use [code] tags, to enable us to help you.

Your query after formatting looks like this :

SELECT a.sid, 
       a.serial#, 
       sql_id, 
       ( CASE locked_mode 
           WHEN 0 THEN 'none' 
           WHEN 1 THEN 'null' 
           WHEN 2 THEN 'row-S' 
           WHEN 3 THEN 'row-x' 
           WHEN 4 THEN 'share' 
           WHEN 5 THEN 'S/Row-X' 
           WHEN 6 THEN 'exclusive' 
         END ) LOCKED_MODE 
FROM   v$session a, 
       v$locked_object b, 
       dba_objects c 
WHERE  b.object_id = c.object_id 
       AND a.sid = b.session_id; 
Re: Insert Hangs [message #625498 is a reply to message #625495] Thu, 09 October 2014 04:44 Go to previous messageGo to next message
sandeep_orafaq
Messages: 88
Registered: September 2014
Member
My question: why there are 2 unique keys when only one is sufficient to take care of both

unique key 1 : col1, col2, col3 -- this should be sufficient
unique key 2 : col1, col2, col3, col4


this issue seems to be like related to distributed transaction where DB_LINKS are involved.

Please check this link, it might help.
http://www.dba-oracle.com/e_ora_02049_timeout_distributed_transaction.htm
Re: Insert Hangs [message #625499 is a reply to message #625495] Thu, 09 October 2014 04:48 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
nnr420 wrote on Thu, 09 October 2014 14:34


first time it gave me an error ORA-02049

The application rolled back

Now if I re execute the query it hangs! there is no error message!



The error you got first time is
ORA-02049: timeout: distributed transaction waiting for lock


Check My Oracle support for OERR: ORA 2049 "timeout: distributed transaction waiting for lock" (Doc ID 19332.1)
Re: Insert Hangs [message #625501 is a reply to message #625498] Thu, 09 October 2014 05:07 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
Thanks for your reply. 2 unique keys is a mistake from the development side.
There are no db links.
Re: Insert Hangs [message #625504 is a reply to message #625501] Thu, 09 October 2014 05:54 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Post the actual statement.

Re: Insert Hangs [message #625524 is a reply to message #625504] Thu, 09 October 2014 09:41 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
i have transaction in the v$transaction table with a status prepared. does this means something? Thanks for your help
Re: Insert Hangs [message #625525 is a reply to message #625524] Thu, 09 October 2014 09:52 Go to previous messageGo to next message
Roachcoach
Messages: 1576
Registered: May 2010
Location: UK
Senior Member
Any triggers doing anything daft on the table?
Re: Insert Hangs [message #625526 is a reply to message #625524] Thu, 09 October 2014 09:53 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

It means you have a distributed transaction that is a transaction that accesses to more than one database and that means you have database links in action.

Once again, post the actual statement.

Re: Insert Hangs [message #625527 is a reply to message #625525] Thu, 09 October 2014 09:54 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
https://www.google.com/webhp?hl=en&tab=ww#hl=en&q=v%24transaction+status+prepared
Re: Insert Hangs [message #625528 is a reply to message #625527] Thu, 09 October 2014 10:04 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Actually you can get a distributed transaction with a single DB and a connection pool. Something about the pool set up can lead the DB to think the client session is interacting with more than one DB. Don't ask me what set up mind, we never got to the bottom of it.
Re: Insert Hangs [message #625530 is a reply to message #625526] Thu, 09 October 2014 10:16 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
@Michel: Thanks for your reply I dont understand what do you mean by original staement!
It is a simple "insert into" that hangs with out any error message
Re: Insert Hangs [message #625531 is a reply to message #625530] Thu, 09 October 2014 10:17 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Yes, so post it.

Re: Insert Hangs [message #625532 is a reply to message #625531] Thu, 09 October 2014 10:23 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
Michel:
insert into FIL_INFO(COMP,MONT,FILNO,ARTICLE,INFOTYP,KEYTT) values ('88','4','1510635','HEADER','KFC','TEST JM') ;
This is what you want to see!!
Re: Insert Hangs [message #625533 is a reply to message #625532] Thu, 09 October 2014 10:26 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Yes and: (read How to use [code] tags and make your code easier to read)
select owner, object_name, object_type from dba_objects where object='FIL_INFO';


Re: Insert Hangs [message #625534 is a reply to message #625533] Thu, 09 October 2014 10:36 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
I have one object type table and 10 views created for 10 users!
Re: Insert Hangs [message #625535 is a reply to message #625534] Thu, 09 October 2014 10:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Please post the result of the query I asked.
In addition, give the user of the session that "hangs".

Re: Insert Hangs [message #625536 is a reply to message #625535] Thu, 09 October 2014 10:54 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
There is no hanging session.
Re: Insert Hangs [message #625537 is a reply to message #625536] Thu, 09 October 2014 11:13 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Problem Exists Between Keyboard And Chair
icon11.gif  Re: Insert Hangs [message #625538 is a reply to message #625537] Thu, 09 October 2014 11:23 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
Great Thanks, I undersatnd your standard
Re: Insert Hangs [message #625539 is a reply to message #625536] Thu, 09 October 2014 11:36 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
nnr420 wrote on Thu, 09 October 2014 17:54
There is no hanging session.


Title is: Insert Hangs

Re: Insert Hangs [message #625556 is a reply to message #625539] Fri, 10 October 2014 02:06 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
@Michel: Sorry for my answer. Since it took lot of time I killed the session. So the moment I replied you I did not really verified the quary was running or not. It is the problem when we do to many things at the same time. Also I am on the infrastructure side. I am helping our dba who is on vacation!
So here is the answer:
QTS$USR1 FIL_INFO VIEW
KOMENTO FIL_INFO TABLE

SADDR SID SERIAL# AUDSID PADDR USER# USERNAME COMMAND OWNERID TADDR LOCKWAIT STATUS SERVER SCHEMA# SCHEMANAME OSUSER PROCESS MACHINE TERMINAL PROGRAM TYPE SQL_ADDRESS SQL_HASH_VALUE SQL_ID SQL_CHILD_NUMBER PREV_SQL_ADDR PREV_HASH_VALUE PREV_SQL_ID PREV_CHILD_NUMBER PLSQL_ENTRY_OBJECT_ID PLSQL_ENTRY_SUBPROGRAM_ID PLSQL_OBJECT_ID PLSQL_SUBPROGRAM_ID MODULE MODULE_HASH ACTION ACTION_HASH CLIENT_INFO FIXED_TABLE_SEQUENCE ROW_WAIT_OBJ# ROW_WAIT_FILE# ROW_WAIT_BLOCK# ROW_WAIT_ROW# LOGON_TIME LAST_CALL_ET PDML_ENABLED FAILOVER_TYPE FAILOVER_METHOD FAILED_OVER RESOURCE_CONSUMER_GROUP PDML_STATUS PDDL_STATUS PQ_STATUS CURRENT_QUEUE_DURATION CLIENT_IDENTIFIER BLOCKING_SESSION_STATUS BLOCKING_INSTANCE BLOCKING_SESSION SEQ# EVENT# EVENT P1TEXT P1 P1RAW P2TEXT P2 P2RAW P3TEXT P3 P3RAW WAIT_CLASS_ID WAIT_CLASS# WAIT_CLASS WAIT_TIME SECONDS_IN_WAIT STATE SERVICE_NAME SQL_TRACE SQL_TRACE_WAITS SQL_TRACE_BINDS
C00000002CA87D10 437 36395 86410131 C00000002C760830 208 KOMENTO 2 2147483644 C0000000297F5BD0 C00000002CC61DA8 ACTIVE SHARED 208 KOMENTO FR05910 5328 FINL075 unknown SQL Developer USER C0000000603345D8 3666136071 14bhd37d89m07 0 C00000002B827F28 1294316032 7r2cna16kbch0 0 SQL Developer 0 0 609934884 81690 58 28680 0 10/10/14 127 NO NONE NONE NO DISABLED ENABLED ENABLED 0 NO HOLDER 173 184 enq: TX - row lock contention name|mode 1415053316 0000000054580004 usn<<16 | slot 327716 0000000000050024 sequence 877085 00000000000D621D 4217450380 1 Application 0 127 WAITING FINL99 DISABLED FALSE FALSE

I appriciate your help.
Re: Insert Hangs [message #625560 is a reply to message #625556] Fri, 10 October 2014 02:49 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Do you think your post is readable?

Quote:
In addition, give the user of the session that "hangs".


And now post the definition of the view.
Before, Please read How to use [code] tags and make your code easier to read.

[Updated on: Fri, 10 October 2014 02:49]

Report message to a moderator

Re: Insert Hangs [message #626274 is a reply to message #625560] Fri, 24 October 2014 03:03 Go to previous messageGo to next message
nnr420
Messages: 14
Registered: September 2014
Junior Member
Hello,
For those who are interested by this problem, this is a bug of the version 10.2.
I got this information after working with oracle support.

Bug 5917836 : CHANGED V$LOCK BEHAVIOR FOR XA TRANSACTION AFTER UPGRADE FROM 9.2 TO 10.2

Thanks for your help
Re: Insert Hangs [message #626275 is a reply to message #626274] Fri, 24 October 2014 03:11 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Ah! You didn't say you use XA. It is a quite important information.

Previous Topic: SET Autocommit XXXX
Next Topic: how to write return in the function
Goto Forum:
  


Current Time: Fri Apr 26 10:40:17 CDT 2024