Works in sql not in apex: ORA-02049 distributed transaction waiting lock

Hi,
I get this error
failed to parse SQL query:
ORA-02049: timeout: distributed transaction waiting for lockwhen trying to run this query from it's page. But it works fine if I run it in the SQL console...
failed to parse SQL query:
ORA-select distinct n.notif_no,
       n.maint_work_centre,
       n.maint_work_centre_text,
       n.raised_by,
       n.notif_text,
       (select  (SAP_LONG_TEXT.NOTIFICATION_TEXT_1||SAP_LONG_TEXT.NOTIFICATION_TEXT_2||SAP_LONG_TEXT.NOTIFICATION_TEXT_3||SAP_LONG_TEXT.NOTIFICATION_TEXT_4||SAP_LONG_TEXT.NOTIFICATION_TEXT_5||SAP_LONG_TEXT.NOTIFICATION_TEXT_6||SAP_LONG_TEXT.NOTIFICATION_TEXT_7||SAP_LONG_TEXT.NOTIFICATION_TEXT_8||SAP_LONG_TEXT.NOTIFICATION_TEXT_9||SAP_LONG_TEXT.NOTIFICATION_TEXT_10||SAP_LONG_TEXT.NOTIFICATION_TEXT_11||SAP_LONG_TEXT.NOTIFICATION_TEXT_12||SAP_LONG_TEXT.NOTIFICATION_TEXT_13||SAP_LONG_TEXT.NOTIFICATION_TEXT_14||SAP_LONG_TEXT.NOTIFICATION_TEXT_15||SAP_LONG_TEXT.NOTIFICATION_TEXT_16||SAP_LONG_TEXT.NOTIFICATION_TEXT_17||SAP_LONG_TEXT.NOTIFICATION_TEXT_18||SAP_LONG_TEXT.NOTIFICATION_TEXT_19||SAP_LONG_TEXT.NOTIFICATION_TEXT_20||SAP_LONG_TEXT.NOTIFICATION_TEXT_21||SAP_LONG_TEXT.NOTIFICATION_TEXT_22||SAP_LONG_TEXT.NOTIFICATION_TEXT_23||SAP_LONG_TEXT.NOTIFICATION_TEXT_24||SAP_LONG_TEXT.NOTIFICATION_TEXT_25||SAP_LONG_TEXT.NOTIFICATION_TEXT_26||SAP_LONG_TEXT.NOTIFICATION_TEXT_27||SAP_LONG_TEXT.NOTIFICATION_TEXT_28||SAP_LONG_TEXT.NOTIFICATION_TEXT_29||SAP_LONG_TEXT.NOTIFICATION_TEXT_30||SAP_LONG_TEXT.NOTIFICATION_TEXT_31||SAP_LONG_TEXT.NOTIFICATION_TEXT_32||SAP_LONG_TEXT.NOTIFICATION_TEXT_33||SAP_LONG_TEXT.NOTIFICATION_TEXT_34||SAP_LONG_TEXT.NOTIFICATION_TEXT_35||SAP_LONG_TEXT.NOTIFICATION_TEXT_36||SAP_LONG_TEXT.NOTIFICATION_TEXT_37||SAP_LONG_TEXT.NOTIFICATION_TEXT_38||SAP_LONG_TEXT.NOTIFICATION_TEXT_39||SAP_LONG_TEXT.NOTIFICATION_TEXT_40||SAP_LONG_TEXT.NOTIFICATION_TEXT_41||SAP_LONG_TEXT.NOTIFICATION_TEXT_42||SAP_LONG_TEXT.NOTIFICATION_TEXT_43||SAP_LONG_TEXT.NOTIFICATION_TEXT_44||SAP_LONG_TEXT.NOTIFICATION_TEXT_45||SAP_LONG_TEXT.NOTIFICATION_TEXT_46||SAP_LONG_TEXT.NOTIFICATION_TEXT_47||SAP_LONG_TEXT.NOTIFICATION_TEXT_48||SAP_LONG_TEXT.NOTIFICATION_TEXT_49||SAP_LONG_TEXT.NOTIFICATION_TEXT_50) from sap_long_text@genadm where sap_long_text.notification = n.notif_no) "long",
       n.notif_date,
       n.funct_loc,
       n.order_no,
       n.notif_status,
       n.room,
       n.notif_type
from   notifications@amt n, SAP_LONG_TEXT@genadm
where  instr(':'||:P9_NOTIFTYPE||':',':'||n.NOTIF_TYPE||':')>0 and
       instr (':'||:P9_SITE||':',':'||n.site||':') > 0 and
       n.notif_date BETWEEN :P9_DATEFROM and :P9_DATETO and
       n.notif_status not like '%NOCO%'I've had this error before but I don't remember why/what happened. The page has been working fine, the error just randomly cropped up today.
And a secondary question, is there a better way to write the query (it's a copy/paste from an older query). That select within the select is ugly...

Hello,
Take a look at the following thread -
help ORA-02049
Is it really necessary that you always query across the DBLink? Is using local materialized views not an option for you?
John.
http://jes.blogs.shellprompt.net
http://apex-evangelists.com

Similar Messages

  • OWB9.0.4-- ORA-02049: timeout: distributed transaction waiting for lock

    I'm running a simple mapping that copies all columns of data (using a filter on date for just current records) from one table in SQL Server into a staging table on my Oracle DW schema. It's using a dblink with transparent gateway for SQL Server, which works fine from SQL*plus.
    The map is in default mode (bulk-failoverto-row) with bulk size and commit frequency = 1000.
    The audit details show the first 1000 rows selected on the source, with an error on both the source and target tables:
    Target--
    ORA-02049: timeout: distributed transaction waiting for lock
    Source--
    ORA-01002: fetch out of sequence ORA-02063: preceding line from INTERGRATION@JXNSQL01
    (INTERGRATION@JXNSQL01 is the dblink name)
    Any ideas on how I can clear this up?
    Thanks,
    Paul

    Hi,
    After having upgraded to 9.0.4 (from 9.0.3) I'm running into exactly the same problems with some of my mappings. Actually I don't get any rows transferred from the mappings that fail.
    Out of 7 mappings, 3 worked just liked before while the 4 others just keep on running until I cancel them and I then see the BUSY/ORA-02049 in the Audit Browser.
    When comparing the mappings I see that the 3 that works all use some custom Procedures I have made.
    The 4 that doesn't work are all very simple - one of them just loads all the content from a table with two columns in my source to another table with two columns in my target! Two of the other mappings that doesn't work includes some simple CASE-expressions.
    Both my source and my target resides in a Oracle 9.2.0.3 database (not the same).
    Regards,
    Bent Madsen

  • ORA-02049: timeout: distributed transaction waiting for lock

    Hi,
    My name is Guneet and I'm working on an application running on BEA Weblogic Server 9.2 running on a Red Hat Linux box using Oracle 10g as the database. My problem is that recently our code started getting the following exception while updating a database table.
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-02049: timeout: distributed transaction waiting for lock
    Application Details
    * Using Stateless Session EJB
    * Only one Business method in this EJB with transaction attribute set to "required"
    * This method executes two select queries & one update query
    * We are using JDBC to access the database.
    * We have configured a Data Source & are using it to get a database connection.
    * Weblogic's Oracle Driver is being used.
    More details
    * The application has been running well since a month.
    * Two days ago,the update query failed with the above error.
    * At that time, a single client was accessing the system.
    * Once this problem occurs, it starts appearing frequently.
    * Eventually a request to get a connection from the Data Source times out & the exception copied at the end is thrown
    * At this stage the application gets stuck and all requests trying to get a connection end up with this exception.
    * Fortunately, Restarting the Weblogic Server gets us out of this problem and transactions resume normally.
    Now my questions are
    # Why is this error happening & what does it mean?
    # It looks like the second exception (unable to get a connection from ds) is an after effect of the first problem (ORA-02049) once it appears for a couple of times. Can somebody validate this?
    # Though I don't understand JTA well but I don't think this application needs distributed transactions so, I'm thinking of modifying the driver type to non-XA oracle driver. Any advise/pointers/comments on this front is welcome !!!!!!!!
    Thanks
    Guneet Sahai
    Exception Trace
    Dec 27, 2006 4:47:50 PM | com.gisil.themis.db | SEVERE | Unable to load merchant DEL = 911168900164. Reason - java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_RMERR start() failed on resource 'themis-ds': XAER_RMERR : A resource manager error has occured in the transaction branch
    javax.transaction.xa.XAException: Unexpected error during start for XAResource 'themis-ds': Transaction timed out after 29 seconds
    BEA1-252DE51AC930078CA638
    at weblogic.jdbc.wrapper.XA.createException(XA.java:103)
    at weblogic.jdbc.jta.DataSource.start(DataSource.java:753)
    at weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1182)
    at weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1115)
    at weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:274)
    at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:497)
    at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:429)
    at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1408)
    at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1332)
    at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:440)
    at weblogic.jdbc.jta.DataSource.connect(DataSource.java:396)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
    at com.gisil.themis.db.impl1.DbManagerImpl.isPinValid(DbManagerImpl.java:872)
    at com.gisil.themis.ejb.ThemisBean.isPinValid(ThemisBean.java:185)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl.isPinValid(Themis_aqqc4k_EOImpl.java:207)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
    at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
    at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1413)
    at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1332)
    at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:440)
    at weblogic.jdbc.jta.DataSource.connect(DataSource.java:396)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
    at com.gisil.themis.db.impl1.DbManagerImpl.isPinValid(DbManagerImpl.java:872)
    at com.gisil.themis.ejb.ThemisBean.isPinValid(ThemisBean.java:185)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl.isPinValid(Themis_aqqc4k_EOImpl.java:207)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
    at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
    at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

    guneet sahai wrote:
    Hi,
    My name is Guneet and I'm working on an application running on BEA Weblogic Server 9.2 running on a Red Hat Linux box using Oracle 10g as the database. My problem is that recently our code started getting the following exception while updating a database table.
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-02049: timeout: distributed transaction waiting for lock
    Application Details
    * Using Stateless Session EJB
    * Only one Business method in this EJB with transaction attribute set to "required"
    * This method executes two select queries & one update query
    * We are using JDBC to access the database.
    * We have configured a Data Source & are using it to get a database connection.
    * Weblogic's Oracle Driver is being used.
    More details
    * The application has been running well since a month.
    * Two days ago,the update query failed with the above error.
    * At that time, a single client was accessing the system.
    * Once this problem occurs, it starts appearing frequently.
    * Eventually a request to get a connection from the Data Source times out & the exception copied at the end is thrown
    * At this stage the application gets stuck and all requests trying to get a connection end up with this exception.
    * Fortunately, Restarting the Weblogic Server gets us out of this problem and transactions resume normally.
    Now my questions are
    # Why is this error happening & what does it mean?
    # It looks like the second exception (unable to get a connection from ds) is an after effect of the first problem (ORA-02049) once it appears for a couple of times. Can somebody validate this?
    # Though I don't understand JTA well but I don't think this application needs distributed transactions so, I'm thinking of modifying the driver type to non-XA oracle driver. Any advise/pointers/comments on this front is welcome !!!!!!!!
    Thanks
    Guneet SahaiHi Guneet. If you want to debug the JTA issue, I suggest opening an official
    support case. They will lead you through producing the JTA debug information.
    However, I believe you are correct that the transaction you describe is
    completely doable with a simple local transaction, so if you were to alter
    your pool to use the non-XA driver, it would probably be faster, simpler,
    and just work.
    Let me know...
    Joe
    >
    Exception Trace
    Dec 27, 2006 4:47:50 PM | com.gisil.themis.db | SEVERE | Unable to load merchant DEL = 911168900164. Reason - java.sql.SQLException: Unexpected exception while enlisting XAConnection java.sql.SQLException: XA error: XAResource.XAER_RMERR start() failed on resource 'themis-ds': XAER_RMERR : A resource manager error has occured in the transaction branch
    javax.transaction.xa.XAException: Unexpected error during start for XAResource 'themis-ds': Transaction timed out after 29 seconds
    BEA1-252DE51AC930078CA638
    at weblogic.jdbc.wrapper.XA.createException(XA.java:103)
    at weblogic.jdbc.jta.DataSource.start(DataSource.java:753)
    at weblogic.transaction.internal.XAServerResourceInfo.start(XAServerResourceInfo.java:1182)
    at weblogic.transaction.internal.XAServerResourceInfo.xaStart(XAServerResourceInfo.java:1115)
    at weblogic.transaction.internal.XAServerResourceInfo.enlist(XAServerResourceInfo.java:274)
    at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:497)
    at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:429)
    at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1408)
    at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1332)
    at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:440)
    at weblogic.jdbc.jta.DataSource.connect(DataSource.java:396)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
    at com.gisil.themis.db.impl1.DbManagerImpl.isPinValid(DbManagerImpl.java:872)
    at com.gisil.themis.ejb.ThemisBean.isPinValid(ThemisBean.java:185)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl.isPinValid(Themis_aqqc4k_EOImpl.java:207)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
    at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
    at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1413)
    at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1332)
    at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:440)
    at weblogic.jdbc.jta.DataSource.connect(DataSource.java:396)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:359)
    at com.gisil.themis.db.impl1.DbManagerImpl.isPinValid(DbManagerImpl.java:872)
    at com.gisil.themis.ejb.ThemisBean.isPinValid(ThemisBean.java:185)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl.isPinValid(Themis_aqqc4k_EOImpl.java:207)
    at com.gisil.themis.ejb.Themis_aqqc4k_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:517)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:224)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:407)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:403)
    at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:56)
    at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:934)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)

  • DatabaseError: ORA-02049: timeout: distributed transaction waiting for lock

    Hi all
    There is script running in my database 'A' that will select some data from tables in other database through DBLINK and update some tables too. The script which 6 I am running for the past 6 monts succesfully. Yesterday I got error saying that,
    DatabaseError: ORA-02049: timeout: distributed transaction waiting for lock
    ORA-02063: preceding line from test
    I have tested the Link and its active no issues in DBLINk
    I understand the objects which I am accessing the table in locked mode,
    SQL> select OBJECT_ID,SESSION_ID,PROCESS,LOCKED_MODE from v$locked_object where
    SESSION_ID=121;
    OBJECT_ID SESSION_ID PROCESS LOCKED_MODE
    77391 121 21394 3
    i
    I killed the session 121 and in v$session status is Killed, but I am getting the same error repeating while running the script. And the session_id is still in locked_mode.
    Could please add some light on this?
    -Thanks
    Antony

    Hi,
    I have killed the session which caused blocking and the status is KILLED for the past two days. But still the object is in locked mode
    SQL> select OBJECT_ID,SESSION_ID,PROCESS,LOCKED_MODE from v$locked_object where
    SESSION_ID=121;
    OBJECT_ID SESSION_ID PROCESS LOCKED_MODE
    77391 121 21394 3
    How would I resolve this any idea
    -Thanks & Cheers
    Antony

  • REGEXP works in PL/SQL not in Apex

    Hi,
    I have a regular expression that works in PL/SQL yet in APex it doesn't work.
    1) Have to be numeric
    2) Have to have 1-2 digits
    3) Optional to have up to 1 decimal points
    Can anyone please let me know if this is good? Thanks.
    regexp_like(v_expr, '^(\d{0,2})+(\.[0-9]{1})?$')

    In what way doesn't it work in APEX?
    APEX runs PL/SQL, there should be no reason why it doesn't. Are you running this as a validation?

  • Problem with ORA-02046: distributed transaction already begun

    I can use db link from the source machine but not the vice versa, throws ORA-02046. I restarted Oracle, rebooted the
    machine, yet ORA-02046 persists. No entries in dba_2pc_pending in any (target, db-linking) machines. Can anybody suggest how
    can I resolve this issue? It is eating out our production time.
    Thanks in advance,

    I had already checked the link, Thanks.
    I bounced Oracle in the suspicious (one that was doubted to have started the distributed transaction) machine, then it resolved the issue.
    Thanks

  • Linked Server : SQL 2012 to 2000 error - Microsoft Distributed Transaction Coordinator (MS DTC) has stopped this transaction.

    Hi all,
      If any one has worked around this error and can help ?
    Msg 8522, Level 16, State 3, Line 1
    Microsoft Distributed Transaction Coordinator (MS DTC) has stopped this transaction.
      I am trying to connect from sql 2012 to 2000 server. Established linked server using native client 10. I am able to see catalogs and database and table. Just when I am trying to query i am getting above error. 
    any help is really appreciated. 
    Thanks
    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach

    Hi Logicinisde,
    What the new error message do you get after using the workarounds in this
    blog? Please post it for analysis.
    Besides, as SQL Server 2012 has stopped connecting to SQL Server 2000 via linked servers, personally I recommend you upgrade SQL Server 2000 to a higher version to make your queries or ETLs efficient.
    Thanks,
    Lydia Zhang
    Lydia Zhang
    TechNet Community Support

  • Working in Sql, not working in Stored procedure

    Dear friends,
    I am puzzled about this strange working of Oracle , although I know that there is some problem with my code. I paste my code here. The delete statement is working properly in SQL Plus 8.0, but it is not working when I call this stored procedure from the Form.
    FUNCTION delete_record_treaty (
    p_treaty_id T_RIN_TREATY_MST.TRTY_ID_GV%TYPE, p_value VARCHAR2,p_block VARCHAR2 )
    RETURN BOOLEAN IS
    v_treaty_type varchar2(5);
    BEGIN
    v_treaty_type := substr(p_treaty_id,1,3);
    if p_block !='T_RIN_GRP_DTL' and p_block != 'T_RIN_XOLSLAB_DTL' and p_block!='T_RIN_PMTSCHD_DTL' then
    delete from T_RIN_TREATY_MST where TRTY_ID_GV=p_treaty_id ;
    commit;
    end if;
    if v_treaty_type = 'QTA' then
    delete from T_RIN_GRP_DTL where TRTY_ID_MV=p_treaty_id and T_RIN_GRP_DTL.ROWID = p_value;
    commit;
    elsif v_treaty_type = 'XOL' then
    delete from T_RIN_XOLSLAB_DTL where TRTY_ID_MV=p_treaty_id ;
    delete from T_RIN_PMTSCHD_DTL where TRTY_ID_MV=p_treaty_id ;
    elsif v_treaty_type = 'FAC' then
    delete from T_RIN_PMTSCHD_DTL where TRTY_ID_MV=p_treaty_id ;
    end if;
    RETURN(TRUE);
    END delete_record_treaty;
    Thanks in advance.
    All the paramaters that I pass, are correctly being passed to this stored procedure.
    null

    I solved it.One parameter I was passing it wrongly.
    Gee :D
    Subramanian V.

  • ORA-02046:distributed transaction already begun

    Hi!
    I have a serious problem in my j2ee application. The description of the situation :
    1)There is a PL/SQL procedure in the local database which calls a remote procedure (which is in a different database). The remote procedure then updates certain tables in that remote database.
    2)In most cases it all works just fine. But after some time i keep getting ORA-02046 errors in the logfile.
    Is it somehow related to the fact that Oracle uses two phase committing?

    Are you using connection pooling?
    if you do, what happens if you disable connection pooling?

  • ORA-02049

    HI,
    I get the "ORA-02049: timeout: distributed transaction waiting for lock" error message when i run the query
    it works fine when i run it in pl/sql developer but in apex.... no bueno
    what does this error mean and how can i fix it???
    select a.object_name, b.cogipf_username, trunc(c.cogipf_localtimestamp), count(trunc(c.cogipf_localtimestamp)) logon_count
    from cognos_security_groups a, prod_coglog.cogipf_userlogon@cognosp b, prod_coglog.cogipf_runreport@cognosp c
    where b.cogipf_sessionid = c.cogipf_sessionid
    and a.object_name = :P1_Object_Name
    and c.cogipf_localtimestamp <= sysdate
    and c.cogipf_localtimestamp >= add_months(sysdate, -1)
    group by a.object_name, b.cogipf_username, trunc(c.cogipf_localtimestamp)\
    i think it has something to do with my database links
    Edited by: Daniel Garcia on Dec 16, 2008 11:55 AM

    Daniel,
    I experienced the same earlier today. I deleted the region and then reconstructed it. The page then operated normally.
    Jeff

  • Help ORA-02049

    HELP HELP HELP!!
    Following error on Oracle 8.1.7
    SQR 5528) ORACLE OCIStmtExecute error 2049 in cursor 38:
    ORA-02049: timeout: distributed transaction waiting for lock
    ORA-02063: preceding line from XAPPPRD
    Error on line 3155:
    (SQR 3735) Could not execute SQL.
    SQR for PeopleSoft: Program Aborting.
    Thanks
    jason

    ORA-02049 timeout: distributed transaction waiting for lock
    Cause: Exceeded INIT.ORA DISTRIBUTED_LOCK_TIMEOUT seconds waiting for lock.
    Action: Treat as a deadlock.
    Joel Pérez
    http://otn.oracle.com/experts

  • ORA-02049  and Real Application Cluster

    I have 2 site
    first one with a single Oracle Server
    and
    the second one with 2 server with the RAC technology (Real Application Server)
    In the second one (RAC environement) I have the ORA-02049 timeout: distributed transaction waiting for lock when I run my custom software.
    All its ok in the first one.
    do you have some hints about that for me ?
    thanks

    ORA-02049 timeout: distributed transaction waiting for lock
    Cause: Exceeded INIT.ORA DISTRIBUTED_LOCK_TIMEOUT seconds waiting for lock.
    Action: Treat as a deadlock.
    Perhaps you RAC is not handling the transactions with the same speed. I recommend you to increase that value.
    That kind of error comes generally when the transactions consumes more time than specified by that parameter. The network can be one of the causes of it. As I told you, I recommend you highly to increase that parameter.
    Joel Pérez
    http://www.oracle.com/technology/experts

  • Please help for ORA-02049 - Timeout error

    Hi All,
    we have got a reporting DB and 14+ Application DBs, the data is extracted from all the application databases (DBs) and dumped into the common tables of reporting database. While inserting and updating the common reporting tables the other jobs gets timeout error and fails. We daily face this failure problem (error: ORA-02049 - Timeout error distributed transaction waiting for lock) for almost 10-15 times.
    Can you please help me out in resolving and getting the permanent solution for this problem.
    Thanks in advance.

    Thanks Kamal,
    as mentioned above, I have got Oracle,Java,Unix environment. Autosys jobs are scheduled through out the day.
    Mechanism : Autosys job triggers the action at specified time, Unix code calls oracle packaged procedure, extracts data and puts into the common reporting table from this data java code formats the report output.
    There are separate reporting jobs for all instances though the report is same but for different locations(14 DB instances).
    and all these reporting jobs dump data into common reporting table, data can be differentiated on the hub or location.
    But if one job is running for first instance then second job waits for the lock and fails after 2 mins.
    I have to avoid this situation, I hold I am able to explain the situation.

  • ORA-00164 Autonomous and Distributed Transactions in Oracle 8i - Forms6i

    Hi, in Forms6i I'm using Autonomous transactions (insert and update), and I want to use also a database link to make a query in a remote database (Distributed transaction). Even when this request are done in different PL/SQL within Forms6i, I get the error message ORA-00164 Distributed transactions disallowed within autonomous transactions. Is there a way to avoid this error message?
    Thanx

    Hello,
    I had a similar Problem, when I tried to log errormessages while selecting by db-link.
    I use pipes now to send the errormessages. The pipe is read at regular intervals and then I can Insert without using autonomous transactions.
    I hope, this will help you
    Marcus

  • ORA-01591: lock held by in-doubt distributed transaction 2.53.300807

    SQL> select count(*) from TBCD_CCODMSG;
    select count(*) from TBCD_CCODMSG
    ERROR at line 1:
    ORA-01591: lock held by in-doubt distributed transaction 2.53.300807
    SQL> select * from TBCD_CCODMSG where rownum =10;
    select * from TBCD_CCODMSG where rownum =10
    ERROR at line 1:
    ORA-01591: lock held by in-doubt distributed transaction 2.53.300807
    SQL> alter session set events '1591 trace name errorstack level 10';
    Session altered.
    SQL> select * from TBCD_CCODMSG where rownum =10;
    select * from TBCD_CCODMSG where rownum =10
    ERROR at line 1:
    ORA-01591: lock held by in-doubt distributed transaction 2.53.300807
    SQL> select object_name, object_type from user_objects where object_name = 'TBCD_CCODMSG';
    OBJECT_NAME
    OBJECT_TYPE
    TBCD_CCODMSG
    TABLE
    SQL> select * from DBA_2PC_PENDING;
    no rows selected
    SQL> select * from DBA_2PC_NEIGHBORS where local_tran_id = '2.53.300807';
    LOCAL_TRAN_ID IN_
    DATABASE
    DBUSER_OWNER I DBID SESS#
    BRANCH
    2.53.300807 in
    EFT.WORLD
    CD1 N 15f1353d 1
    0B000B00011902000128

    보통은 오라클 Background 프로세스인 RECO 프로세스가
    해당 문제를 자동으로 복구해줍니다.
    하지만, 가끔씩 제대로 처리를 못해주는 경우는 DBA 가 아래 절차를 확인하여
    수동으로 처리를 해줘야 하는 경우도 있습니다.
    아래 내용을 참고하세요...
    No. 12163
    DISTRIBUTED TRANSACTION TROUBLESHOOTING (ORA-1591해결 방법)
    ==========================================================
    다른 database를 이용하지 않는 local transaction이, 비정상 종료시 자동으로
    rollback되는 것과는 달리, 분산 트랜잭션의 경우 2 phase commit수행 단계중에
    fail이 발생하게 되면 관여된 일부 database에서는 rollback 혹은 commit이 되고,
    일부는 distributed lock이 걸린 상태로 계속 지속될 수 있다.
    이렇게 pending된 transaction에 대해서는 기본적으로 Oracle의 background
    process인 RECO process가 자동으로 정리하여 주나, 경우에 따라 자동으로 정리가
    되지 못하는 상황이 발생할 수 있다.
    이렇게 정리가 되지 않아, distributed lock이 걸린 경우에는, 이후 관계된
    table을 조회나 변경시 ora-1591 오류가 발생할 수 있으므로, distributed
    transaction이 실패한 경우 db admin이 관여하여 pending된 transaction을
    정리하여 줄 필요가 있다.
    distributed transaction이 오류가 발생하거나, 혹은 이후에 ora-1591이 발생하는
    경우, 조치 방법을 9단계의 STEP으로 정리하였다.
    *** distributed transaction의 2 phase commit에 대한 개념 및 자세한 절차는
    <korean bulletin:12185>를 참조한다.
    [참고 1] 문서의 이해를 위해서 분산 환경에 포함된 node를 V817LOC와 V817REM으로
    예를 들고, V817LOC node에서 transaction을 수행하였다고 가정한다.
    [참고 2] 아래에 언급되는 dbms_transaction package는 기본적으로 catproc.sql
    script에 의해 생성되나 만약 존재하지 않는다면,
    cd $ORACLE_HOME/rdbms/admin directory의 dbmsutil.sql, prvtutil.plb
    script를 sys user에서 수행하도록 한다.
    (svrmgrl에서 connect internal에서 수행하는것이 일반적)
    그리고 이 package는 항상 transaction의 맨 처음에 수행되어야 한다.
    즉, 새로 session을 연결하여 수행하거나, 혹은 앞에 dml에 있었다면,
    commit이나 rollback을 수행 후 이 package를 수행하여야 한다.
    아래의 STEP중 STEP 1 ~ 3까지는 문제 해결을 위해 필수적인 단계는 아니므로 바로
    문제를 시급히 해결해야 하는 경우 4번부터 확인하도록 한다.
    STEP 1: alert.log file을 check한다.
    bdump directory의 alert.log에는 분산 트랜잭션 fail시 관계된 오류 메시지등
    log가 항상 남게 된다. 예를 들면 다음과 같은 형태인데, rollback/commit되었
    는지, in-doubt 상태인지와 그 외에 transaction id등 정보를 확인할 수 있다.
    Tue Dec 12 16:23:25 2000
    ORA-02054: transaction 1.8.238 in-doubt
    ORA-02063: preceding line from V817REM
    Tue Dec 12 16:23:25 2000
    DISTRIB TRAN V817LOC.WORLD.89f6eafb.1.8.238
    is local tran 1.8.238 (hex=01.08.ee)
    insert pending prepared tran, scn=194671 (hex=0.0002f86f)
    STEP 2: network 환경을 확인한다.
    listener가 떠 있는지, database link가 모두 정상적인지 확인해 본다.
    STEP 3: RECO process가 떠 있는지 확인한다.
    os상에서 RECO process가 떠 있는지 확인하려면 다음과 같이 한다.
    os> ps -ef | grep reco
    RECO process는 db가 startup되면서 자동으로 구동되는 background process로
    distributed recovery를 disable시키면 사라지게 된다. distributed recovery를
    enable/disable시키는 방법은 아래와 같다.
    SQL>alter system enable distributed recovery;
    SQL>alter system disable distributed recovery;
    아래의 조치사항 중에서 STEP 9번을 제외하고는 기본적으로 RECO process가
    자동으로 처리하는 작업과 동일하다. 그러나 여러가지 문제로 인해 RECO가
    자동으로 정리하지 못한 경우 이 문서의 방법대로 manual하게 정리하여 주어야
    한다.
    STEP 4: DBA_2PC_PENDING을 조회해 본다.
    sqlplus system/manager
    SQL>select local_tran_id, global_tran_id, state, mixed, host, commit#
    from dba_2pc_pending;
    다음과 같은 결과가 return된다.
    LOCAL_TRAN_ID|GLOBAL_TRAN_ID |STATE |MIX|HOST |COMMIT#
    -------------|----------------------|--------|---|----------|--------
    1.8.238 |V817LOC.WORLD.89f6eafb|prepared|no |SUP_SERVER|194671
    |.1.8.238 | | |\eykim |
    이 조회로 인해 여러개의 row가 나오는 경우 ora-1591이나 distributed fail에
    관련된 오류시 나타나는 local transaction id값과 return된 LOCAL_TRAN_ID값을
    비교하여 일치하는 row를 확인하면 된다. 이때 LOCAL_TRAN_ID 값과
    GLOBAL_TRAN_ID의 뒷부분의 숫자가 동일하다면 이것은 이 node가 global
    coordinator임을 의미한다.
    STEP 5: DBA_2PC_NEIGHBORS view를 조회해 본다.
    sqlplus system/manager
    SQL>select local_id, in_out, database, dbuser_owner, interface
    from dba_2pc_neighbors;
    LOCAL_TRAN_ID|IN_OUT|DATABASE |DBUSER_OWNER |INT
    -------------|------|-------------------------|---------------|---
    1.8.238 |in | |SCOTT |N
    1.8.238 |out |V817REM.WORLD |SCOTT |C
    여기에 나타난 row들이 해당 분산 트랜잭션에 관여한 database 정보이다. 이때
    DATABASE column 부분이 null로 나타나는 것은 현재 조회하고 있는 local
    database를 의미하며, IN_OUT이 OUT으로 나타나는 경우 참조하는 node정보인데,
    DATABASE 컬럼의 값이 해당 database를 가리키는 database link name이 된다.
    이 database link name을 이용하여 다음과 같이 remote db의 DBA_2PC_PENDING을
    다시 조사하여 관계된 node들의 상태를 확인할 수 있다.
    SQL>select local_tran_id, global_tran_id, state, mixed, host, commit#
    from dba_2pc_pending@v817rem;
    각 node의 DBA_2PC_PENDING의 return된 row들이 같은 분산 트랜잭션에 포함된
    정보인지는 GLOBAL_TRAN_ID 값을 이용하여 확인할 수 있다.
    STEP 6: commit point site를 확인한다.
    commit point site에 대해서는 <korean bulletin:12185>을 참조한다.
    이 예의 경우 COMMIT_POINT_STRENGTH를 지정하지 않았기 때문에 default로
    global coordinator가 아닌 V817REM이 commit point site가 된다. 일반적으로
    commit point site는 global coordinator의 DBA_2PC_NEIGHBORS의 IN_OUT
    field가 OUT으로 나타나고 INTERFACE 부분이 C로 나타나게 된다.
    commit point site가 중요한 이유는 이 node의 local transaction부분은
    prepared상태를 거치지 않아 in-doubt 상태가 되는 일이 없고, 그러므로
    distributed lock에 의해 조회나 DML시 오류가 발생하는 없게 된다.
    이러한 이유로 제일 중요한 data를 포함하는 중심이 되는 node를 commit point
    site로 지정하는 것이 바람직하다.
    STEP 7: DBA_2PC_PENDING의 MIXED column을 확인한다.
    - MIXED값이 NO인 경우 : STEP 8 수행
    - MIXED값이 YES인 경우: STEP 9 수행
    DBA_2PC_PENDING에서 MIXED column을 YES나 NO의 값으로 지정하는 것은 RECO
    process가 결정하여 변경하게 된다. MIXED가 YES가 되는 대표적인 경우는,
    commit point site가 이미 commit을 수행한 상태에서 분산 트랜잭션이 fail된
    경우, non-commit point site에서 prepared 상태의 transaction을 rollback
    force시켜 분산 트랜잭션의 consistency가 깨진 상태이다.
    (STATE column의 경우 commit point site는 COMMITTED로 non-commit point
    site는 FORCED ROLLBACK으로 나타난다)
    [참고] commit point site가 아직 commit을 수행하기 전에 분산 트랜잭션이
    fail되어 commit point site가 rollback된 경우, non-commit point
    site에서 prepared 상태의 transaction을 commit force 하면 이것도
    논리적으로는 consistency가 지켜지지 않은 것은 동일하나 이때는
    MIXED column이 no인 상태가 된다. 그 이유는 commit point site가
    rollback되어 DBA_2PC_PENDING view에 entry가 남지 않기 때문에
    RECO가 명시적으로 mixed 상태로 인식하는 것이 불가능하기 때문으로
    파악된다.
    STEP 8: DBA_2PC_PENDING의 STATE column의 값을 확인한다.
    CASE 8-1: STATE field값이 COMMITTED인 경우
    만약 STATE가 COMMITTED인 경우는 이 local database(V817LOC)에서는
    transaction이 성공적으로 commit 되었음을 나타내므로, 이 node에서는 어떠한
    작업도 수행할 필요가 없다. 이 entry는 RECO process에 의해 자동으로 지워질
    것이며, 만약 RECO가 어떠한 이유로 이 row를 지우지 못했다면 다음과 같이
    db admin이 직접 지워도 된다. 괄호 안의 값은 local_tran_id값이다.
    sqlplus sys/manager (반드시 sys로 접속한다)
    SQL>exec dbms_transaction.purge_lost_db_entry('1.8.238');
    이렇게 V817LOC의 STATE부분이 COMMITTED인 경우는, 이미 commit point site인
    V817REM은 commit된 후임을 나타낸다. 그러므로 V817REM은 STATE가 COMMITTED로
    나타나거나 아니면 commit후 이미 정보가 지워져 DBA_2PC_PENDING에 정보가
    나타나지 않을 수 있다. 그러므로 V817REM에 대해서는 필요한 경우 V817LOC의
    앞의 조치 방법과 동일하게 DBA_2PC_PENDING의 내용만 정리하여 주면 된다.
    만약 V817REM이 아닌 별도의 다른 node가 분산 트랜잭션에 관여했다고 가정하고
    V817LOC가 COMMITTED인 상태에서 그 node의 STATE가 PREPARED로 나타난다면
    그 node에 대해서는 아래의 CASE 8-2를 참조하여 해결하도록 한다.
    CASE 8-2: STATE field값이 PREPARED인 경우
    STATE값이 PREPARED인 경우는 이 node(V817LOC)에서 변경된 data가 속한 block
    에 distributed lock이 걸린 상태이며, 이런 경우 변경된 data가 있는 block에
    대한 모든 read/write가 ora-1591을 발생시키므로 trouble shooting에서 제일
    중요한 부분이라 할 수 있다.
    먼저 STEP 4와 STEP 5를 참조하여 관계된 모든 node들의 DBA_2PC_PENDING view
    를 조회하여 본다. 이때 다른 node(V817REM)의 DBA_2PC_PENDING에 정보가 없다
    면 V817REM이 commit point site이고 이미 data는 rollback되었음을 나타낸다.
    이때는 V817LOC의 prepared 상태의 transaction을 다음과 rollback force 시켜
    준다.
    즉, V817LOC에서,
    SQL>rollback force '1.8.238';
    만약 V817REM node에 해당 정보가 있고 상태가 COMMITTED라면 V817LOC도
    다음과 같이 commit을 해 주어야 한다.
    SQL>commit force '1.8.238';
    이때 local_tran_id 뒤에 SCN을 지정할 수 있는데 이것은 관여된 node 중 제일
    큰 SCN을 지정하도록 한다. 이 SCN 값은 DBA_2PC_PENDING의 COMMIT# field에서
    값을 확인할 수 있으며 이렇게 하는 이유는 이후 분산 database중 한 database
    에서 incomplete recovery가 필요한 경우, 다른 database 들도 일관성을
    맞추기 위해 incomplete recovery를 이용할 수 있게 하기 위한 것이다.
    SQL>commit force '1.8.238', '194671'
    CASE 8-3: STATE field값이 COLLECTING인 경우
    STATE field가 collecting인 경우는 아직 distributed lock을 걸기 전단계에서
    transaction이 비정상 종료됨을 나타내며, 이 단계에서는 distributed lock이
    걸리기 전이어서 변경된 data는 이미 rollback된 상태이다. 이 경우는
    DBA_2PC_PENDING에서 해당 entry를 지워 주면 된다.
    sqlplus sys/manager (반드시 sys로 접속한다)
    SQL>exec dbms_transaction.purge_lost_db_entry('1.8.238');
    CASE 8-4: STATE field값이 FORCED ROLLBACK/FORCED COMMIT 인 경우
    이미 RECO나 db admin이 rollback force나 commit force 명령을 시도하여
    STATE가 FORCED ROLLBACK이나 FORCED COMMIT으로 변경된 경우는 추가적으로
    수행할 작업은 없으며, RECO가 자동으로 이 entry를 지워 줄 것이다. 그러나
    RECO가 작업하기를 기다리지 않고 다음과 같이 직접 삭제할 수 있다.
    sqlplus sys/manager (반드시 sys로 접속한다)
    SQL>exec dbms_transaction.purge_lost_db_entry('1.8.238');
    STEP 9: 불일치 사항을 파악하고 DBA_2PC_PENDING을 정리한다.
    어떠한 경우에 DBA_2PC_PENDING의 MIXED column이 YES가 되는지는 이미 STEP 7
    에서 설명하였다. 이렇게 잘못된 조치에 의해 STEP 7에서 설명한 것과 같은
    분산 데이타베이스간의 불일치가 발생한 경우는 간단한 operation을 통해
    일치성을 맞추는 것은 불가능하다.
    분산 트랜잭션의 consistency가 무엇보다 중요한 경우라면 관계된 node의
    database를 모두 문제의 분산 트랜잭션이 수행되기 이전 상태로, incomplete
    recovery를 수행하거나 할 수 있다. 분산 데이타베이스간의 일관성을 위한
    incomplete recovery에 대해서는 여기에서는 다루지 않는다. 한가지 언급한
    말한 것은 앞에서 설명한 분산 트랜잭션의 commit시 이용하는 commit SCN을
    관계된 모든 node들의 최대 SCN으로 이용하는 것이 바로 이러한 recovery를
    위한 것이다. 이렇게 일부 database에서 SCN값이 이전 SCN에서 1씩 증가하는
    것이 아니라 큰 값으로 건너뛰어 다른 database와 같은 SCN을 유지하게
    함으로써, 이후에 incomplete recovery시에 관계된 node들이 서로 동일한
    SCN으로 recovery를 수행하면, 모두 분산 트랜잭션 적용 이전이 되거나 혹은
    모두 이후가 되어 일관성을 유지할 수 있도록 해준다.
    MIXED가 YES인 상태에서, inconsistency를 받아들이고 DBA_2PC_PENDING view를
    정리하려면 다음과 같이 수행한다.
    sqlplus sys/manager (반드시 sys user로 수행한다)
    SQL>exec dbms_transaction.purge_mixed('1.8.238');

Maybe you are looking for

  • HP LaserJet 1536dnf MFP on Windows 8

    I recently purchased this, and it worked fine on windows 7.  i am using windows 8 beta now and i cannot use the scanner and scanner drivers fail to load.  is there a workaround to this? Thanks Ali

  • Where is Toshiba's concern for the lack of quality in their product?

    There are too many similar complaints here which lend to the fact that Toshiba is ignoring the fact that they are manufacturing and selling a severely flawed product where they fail to "fix" the ongoing problems. If your company knows that this is th

  • Firefox beta 18 "not responding" every time I load a page. This didn't occur as much with FF3.5.4.

    I have tried various upgrades/updates of Firefox (4 and above). I currently have Firebox beta 18. EVERY TIME I load a page, the browser will always hang and I get "Not Responding" in the status bar. The hang time is usually more than a few minutes or

  • New features in Oracle 10g

    Hi, is someone able to say what new features will be included in Oracle 10g from Workspace Manager point of view? I've looked on http://otn.oracle.com/oramag/webcolumns/2003/techarticles/new_features_preview.pdf but there is nothing about OWM. Partic

  • Nokia 5130 loss of contact detail

    I bought a nokia 5130. Under settings -> security, I set the security level to 'phone'. I then added my contacts. I also added each contact's birthday as additional contact detail. After switching off the phone and switching it on again, I still had