Locking rows

hi,
I am developing an application using JDBC and JAVA, in which i
want to control the concurrency of JDBC database access. Is there
any way to lock the row while performing some operation on it. I
am using threads for each call to JDBC API.
Thanks for the favour.
bye
Lak
null

Numbers does not support this feature like other spreadsheets. You can create Header Rows and in Print Preview mode they will be displayed on each page.
Regards,

Similar Messages

  • Re: Transactions and Locking Rows for Update

    Dale,
    Sounds like you either need an "optimistic locking" scheme, usually
    implemented with timestamps at the database level, or a concurrency manager.
    A concurrency manager registers objects that may be of interest to multiple
    users in a central location. It takes care of notifying interested parties
    (i.e., clients,) of changes made to those objects, using a "notifier" pattern.
    The optimistic locking scheme is relatively easy to implement at the
    database level, but introduces several problems. One problem is that the
    first person to save their changes "wins" - every one else has to discard
    their changes. Also, you now have business policy effectively embedded in
    the database.
    The concurrency manager is much more flexible, and keeps the policy where
    it probably belongs. However, it is more complex, and there are some
    implications to performance when you get to the multiple-thousand-user
    range because of its event-based nature.
    Another pattern of lock management that has been implemented is a
    "key-based" lock manager that does not use events, and may be more
    effective at managing this type of concurrency for large numbers of users.
    There are too many details to go into here, but I may be able to give you
    more ideas in a separate note, if you want.
    Don
    At 04:48 PM 6/5/97 PDT, Dale "V." Georg wrote:
    I have a problem in the application I am currently working on, which it
    seems to me should be easily solvable via appropriate use of transactions
    and database locking, but I'm having trouble figuring out exactly how to
    do it. The database we are using is Oracle 7.2.
    The scenario is as follows: We have a window where the user picks an
    object from a dropdown list. Some of the object's attributes are then
    displayed in that window, and the user then has the option of editing
    those attributes, and at some point hitting the equivalent of a 'save'button
    to write the changes back to the database. So far, so good. Now
    introduce a second user. If user #1 and user #2 both happen to pull up
    the same object and start making changes to it, user #1 could write back
    to the database and then 15 seconds later user #2 could write back to the
    database, completely overlaying user #1's changes without ever knowing
    they had happened. This is not good, particularly for our application
    where editing the object causes it to progress from one state to the next,
    and multiple users trying to edit it at the same time spells disaster.
    The first thing that came to mind was to do a select with intent to update,
    i.e. 'select * from table where key = 'somevalue' with update'. This way
    the next user to try to select from the table using the same key would not
    be able to get it. This would prevent multiple users from being able to
    pull the same object up on their screens at the same time. Unfortunately,
    I can think of a number of problems with this approach.
    For one thing, the lock is only held for the duration of the transaction, so
    I would have to open a Forte transaction, do the select with intent to
    update, let the user modify the object, then when they saved it back again
    end the transaction. Since a window is driven by the event loop I can't
    think of any way to start a transaction, let the user interact with the
    window, then end the transaction, short of closing and re-opening the
    window. This would imply having a separate window specifically for
    updating the object, and then wrapping the whole of that window's event
    loop in a transaction. This would be a different interface than we wanted
    to present to the users, but it might still work if not for the next issue.
    The second problem is that we are using a pooled DBSession approach
    to connecting to the database. There is a single Oracle login account
    which none of the users know the password to, and thus the users
    simply share DBSession resources. If one user starts a transaction
    and does a select with intent to update on one DBSession, then another
    user starts a transaction and tries to do the same thing on the same
    DBSession, then the second user will get an error out of Oracle because
    there's already an open transaction on that DBSession.
    At this point, I am still tossing ideas around in my head, but after
    speaking with our Oracle/Forte admin here, we came to the conclusion
    that somebody must have had to address these issues before, so I
    thought I'd toss it out and see what came back.
    Thanks in advance for any ideas!
    Dale V. Georg
    Indus Consultancy Services [email protected]
    Mack Trucks, Inc. [email protected]
    >
    >
    >
    >
    ====================================
    Don Nelson
    Senior Consultant
    Forte Software, Inc.
    Denver, CO
    Corporate voice mail: 510-986-3810
    aka: [email protected]
    ====================================
    "I think nighttime is dark so you can imagine your fears with less
    distraction." - Calvin

    We have taken an optimistic data locking approach. Retrieved values are
    stored as initial values; changes are stored seperately. During update, key
    value(s) or the entire retieved set is used in a where criteria to validate
    that the data set is still in the initial state. This allows good decoupling
    of the data access layer. However, optimistic locking allows multiple users
    to access the same data set at the same time, but then only one can save
    changes, the rest would get an error message that the data had changed. We
    haven't had any need to use a pessimistic lock.
    Pessimistic locking usually involves some form of open session or DBMS level
    lock, which we haven't implemented for performance reasons. If we do find the
    need for a pessimistic lock, we will probably use cached data sets that are
    checked first, and returned as read-only if already in the cache.
    -DFR
    Dale V. Georg <[email protected]> on 06/05/97 03:25:02 PM
    To: Forte User Group <[email protected]> @ INTERNET
    cc: Richards* Debbie <[email protected]> @ INTERNET, Gardner*
    Steve <[email protected]> @ INTERNET
    Subject: Transactions and Locking Rows for Update
    I have a problem in the application I am currently working on, which it
    seems to me should be easily solvable via appropriate use of transactions
    and database locking, but I'm having trouble figuring out exactly how to
    do it. The database we are using is Oracle 7.2.
    The scenario is as follows: We have a window where the user picks an
    object from a dropdown list. Some of the object's attributes are then
    displayed in that window, and the user then has the option of editing
    those attributes, and at some point hitting the equivalent of a 'save' button
    to write the changes back to the database. So far, so good. Now
    introduce a second user. If user #1 and user #2 both happen to pull up
    the same object and start making changes to it, user #1 could write back
    to the database and then 15 seconds later user #2 could write back to the
    database, completely overlaying user #1's changes without ever knowing
    they had happened. This is not good, particularly for our application
    where editing the object causes it to progress from one state to the next,
    and multiple users trying to edit it at the same time spells disaster.
    The first thing that came to mind was to do a select with intent to update,
    i.e. 'select * from table where key = 'somevalue' with update'. This way
    the next user to try to select from the table using the same key would not
    be able to get it. This would prevent multiple users from being able to
    pull the same object up on their screens at the same time. Unfortunately,
    I can think of a number of problems with this approach.
    For one thing, the lock is only held for the duration of the transaction, so
    I would have to open a Forte transaction, do the select with intent to
    update, let the user modify the object, then when they saved it back again
    end the transaction. Since a window is driven by the event loop I can't
    think of any way to start a transaction, let the user interact with the
    window, then end the transaction, short of closing and re-opening the
    window. This would imply having a separate window specifically for
    updating the object, and then wrapping the whole of that window's event
    loop in a transaction. This would be a different interface than we wanted
    to present to the users, but it might still work if not for the next issue.
    The second problem is that we are using a pooled DBSession approach
    to connecting to the database. There is a single Oracle login account
    which none of the users know the password to, and thus the users
    simply share DBSession resources. If one user starts a transaction
    and does a select with intent to update on one DBSession, then another
    user starts a transaction and tries to do the same thing on the same
    DBSession, then the second user will get an error out of Oracle because
    there's already an open transaction on that DBSession.
    At this point, I am still tossing ideas around in my head, but after
    speaking with our Oracle/Forte admin here, we came to the conclusion
    that somebody must have had to address these issues before, so I
    thought I'd toss it out and see what came back.
    Thanks in advance for
    any
    ideas!
    Dale V. Georg
    Indus Consultancy Services [email protected]
    Mack Trucks, Inc. [email protected]
    ------ Message Header Follows ------
    Received: from pebble.Sagesoln.com by notes.bsginc.com
    (PostalUnion/SMTP(tm) v2.1.9c for Windows NT(tm))
    id AA-1997Jun05.162418.1771.334203; Thu, 05 Jun 1997 16:24:19 -0500
    Received: (from sync@localhost) by pebble.Sagesoln.com (8.6.10/8.6.9) id
    NAA11825 for forte-users-outgoing; Thu, 5 Jun 1997 13:47:58 -0700
    Received: (from uucp@localhost) by pebble.Sagesoln.com (8.6.10/8.6.9) id
    NAA11819 for <[email protected]>; Thu, 5 Jun 1997 13:47:56 -0700
    Received: from unknown(207.159.84.4) by pebble.sagesoln.com via smap (V1.3)
    id sma011817; Thu Jun 5 13:47:43 1997
    Received: from tes0001.macktrucks.com by relay.macktrucks.com
    via smtpd (for pebble.sagesoln.com [206.80.24.108]) with SMTP; 5 Jun
    1997 19:35:31 UT
    Received: from dale by tes0001.macktrucks.com (SMI-8.6/SMI-SVR4)
    id QAA04637; Thu, 5 Jun 1997 16:45:51 -0400
    Message-ID: <[email protected]>
    Priority: Normal
    To: Forte User Group <[email protected]>
    Cc: "Richards," Debbie <[email protected]>,
    "Gardner," Steve <[email protected]>
    MIME-Version: 1.0
    From: Dale "V." Georg <[email protected]>
    Subject: Transactions and Locking Rows for Update
    Date: Thu, 05 Jun 97 16:48:37 PDT
    Content-Type: text/plain; charset=US-ASCII; X-MAPIextension=".TXT"
    Content-Transfer-Encoding: quoted-printable
    Sender: [email protected]
    Precedence: bulk
    Reply-To: Dale "V." Georg <[email protected]>

  • How to find rowid of locked rows?

    Hello All,
    I have the "before update trigger" I want to know the rowid of all the locked row before update so that I dont try to update the same row which is locked by some other user. In Ask Tom forum I have seen how to know the rowid of locked row, but it will work only when Some body got hanged in that Perticular row while trying to update it. I dont want the User to get hanged, for that I want to user before update trigger. Help me.

    I believe this is a duplicate of another question in this forum
    How to find out rowid of locked row
    which I answered.
    Justin

  • How to find the LOCKED ROWS in a table?

    Not locked objects, but for a table the locked rows.

    Check below links :
    http://www.jlcomp.demon.co.uk/faq/locked_rows.html
    How to find the locked row.
    who are waiting for same record?
    HTH
    Girish Sharma

  • Identifying locked rows

    I have an uncommited session in one window and I'm attempting to locate the locked row for Oracle 10.2.0.4. I'm unable to locate the row successfully.
    I issue the following to retrieve the information on the session locking the row. I could clearly see the session holding a DML lock.
    SQLPLUS> select dbms_rowid.rowid_create (1, ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, ROW_WAIT_ROW#)
    from v$session where sid=1324;
    USERNAME START_TIME STATUS SID SERIAL# SECONDS_IN_WAIT SQL_ID SQL_FULLTEXT TY
    ALEX 08/25/11 20:36:30 INACTIVE 1199 30613 49 update test set CUSTOMER_ID=1235 where CUSTOMER_ID=11111 TM
    I select the detailed information of the location of the locked row to retrieve the RowID, but I'm not getting back the expected result. I'm getting back values -1,0,0,0 for columns ROW_WAIT_OBJ#, ROW_WAIT_FILE#, ROW_WAIT_BLOCK#, and ROW_WAIT_ROW# respectively. I can't locate the row with the following:
    select row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#
    from v$session where sid=1199;
    SQLPLUS> 2
    ROW_WAIT_OBJ# ROW_WAIT_FILE# ROW_WAIT_BLOCK# ROW_WAIT_ROW#
    -1 0 0 0
    How do I identify the locked updated row? I'm not able to in my test.
    Any help would be appreciated.
    Thanks

    user12006502,
    I am struggling to see EXACTLY what you are doing. You are showing output without showing the SQL statements that produce the output. Additionally, there may be foreign key or other constraints involved - as it stands, the best that I can do is guess, and I would prefer not to do that. For example, assume that your table name is T1 rather than TEST. What if, someone created an index like this:
    CREATE UNIQUE INDEX T1_CUSTOMER ON T1(DECODE(CUSTOMER,'KEITH','0','JOHN','0',CUSTOMER));
    {pre}
    Then, in that same session executed the following without a commit:
    INSERT INTO T1 VALUES ('JOHN',0);Now, in another session you enter the following:
    UPDATE T1 SET CUSTOMER='KEITH' WHERE CUSTOMER='RON';Your session then hangs for seemingly no reason.
    The person with the other session issues the following:
    SELECT
      SID,
      TYPE,
      ID1,
      ID2,
      LMODE,
      REQUEST,
      BLOCK
    FROM
      V$LOCK
    WHERE
      SID=(SELECT SID FROM V$MYSTAT WHERE ROWNUM=1);
    SID TY        ID1        ID2      LMODE    REQUEST      BLOCK
    222 AE        100          0          4          0          0
    222 TM      70568          0          3          0          0
    222 TX      65554       1424          6          0          1It seems that the first session has a TX lock that is blocking another session, a TM lock that is NOT blocking another session, and an AE lock that is not blocking another session.  Now, in that session, the following is executed:
    SELECT /*+ ORDERED */
      S.SID,
      S.STATUS,
      SW.EVENT,
      SW.WAIT_TIME WT,
      SW.STATE,
      SW.SECONDS_IN_WAIT S_I_W,
      S.SQL_ID,
      S.SQL_CHILD_NUMBER,
      S.ROW_WAIT_OBJ# OBJ#,
      S.ROW_WAIT_FILE# FILE#,
      S.ROW_WAIT_BLOCK# BLOCK#,
      S.ROW_WAIT_ROW# ROW#,
      SW.P1,
      SW.P2,
      SW.P3
    FROM
      V$SESSION_WAIT SW,
      V$SESSION S
    WHERE
      S.USERNAME IS NOT NULL
      AND SW.SID=S.SID
      AND SW.EVENT NOT LIKE '%SQL*Net%'
      AND SW.EVENT NOT IN ('Streams AQ: waiting for messages in the queue',
      'wait for unread message on broadcast channel');
    SID STATUS   EVENT                                 WT STATE                    S_I_W SQL_ID        SQL_CHILD_NUMBER       OBJ#      FILE#     BLOCK#       ROW#         P1         P2         P3
    223 ACTIVE   enq: TX - row lock contention          0 WAITING                    146 9gag614u0kvyx                0         -1          0          0          0 1415053316      65554       1424Notice in the above the -1 for the OBJ#.  You must provide the DDL and the DML for people to help you, otherwise you are forcing people to guess what you have done to set up the test case.
    At the minimum, provide the DDL to recreate the table (and any indexes).  If you do not have the DML, you can use the following technique to retrieve it:
    SET PAGESIZE 0
    SET LONG 90000
    SET LINESIZE 200
    COLUMN OBJECT_DEF FORMAT A200
    SPOOL 'GETMETA.SQL'
    SELECT
      DBMS_METADATA.GET_DDL('TABLE',TABLE_NAME,OWNER) OBJECT_DEF
    FROM
      DBA_TABLES
    WHERE
      TABLE_NAME IN ('T1');When I executed the above for my test table T1, I saw the following:
      CREATE TABLE "TESTUSER"."T1"
       (    "CUSTOMER" VARCHAR2(6),
            "CUSTOMER_ID" NUMBER
       ) SEGMENT CREATION IMMEDIATE
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
      TABLESPACE "USER_DATA"That said, you could also have a trigger on the table that performs some action on an UPDATE, which could also cause problems.
    Here is an example of what a full test case would look like:
    DROP TABLE T1 PURGE;
    CREATE TABLE T1 (
      CUSTOMER VARCHAR2(6),
      CUSTOMER_ID NUMBER);
    INSERT INTO T1 VALUES('BETTY',1235);
    INSERT INTO T1 VALUES('RON',0);
    INSERT INTO T1 VALUES('BLAKE',0);
    COMMIT;In session 1 you execute the following and receive confirmation that the update was successful:
    UPDATE T1 SET CUSTOMER='KEITH' WHERE CUSTOMER='RON';
    1 row updated.You check V$LOCK for this session and notice that the session has 3 locks, none of which are blocking:
    SELECT
      SID,
      TYPE,
      ID1,
      ID2,
      LMODE,
      REQUEST,
      BLOCK
    FROM
      V$LOCK
    WHERE
      SID=(SELECT SID FROM V$MYSTAT WHERE ROWNUM=1);
    SID TY        ID1        ID2      LMODE    REQUEST      BLOCK
    223 AE        100          0          4          0          0
    223 TM      70568          0          3          0          0
    223 TX     262153       1493          6          0          0In another session, you attempt to drop the table and are greeted with an error:
    DROP TABLE T1 PURGE;
    DROP TABLE T1 PURGE
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified or timeout expiredSo, you try the update statement - the same one performed in the first session:
    UPDATE T1 SET CUSTOMER='KEITH' WHERE CUSTOMER='RON';The session hangs.
    Back in the first session, you check the locks for the first session:
    SELECT
      SID,
      TYPE,
      ID1,
      ID2,
      LMODE,
      REQUEST,
      BLOCK
    FROM
      V$LOCK
    WHERE
      SID=(SELECT SID FROM V$MYSTAT WHERE ROWNUM=1);
    SID TY        ID1        ID2      LMODE    REQUEST      BLOCK
    223 AE        100          0          4          0          0
    223 TM      70568          0          3          0          0
    223 TX     262153       1493          6          0          1Note the blocking lock.
    Let's check the waits:
    SELECT /*+ ORDERED */
      S.SID,
      S.STATUS,
      SW.EVENT,
      SW.WAIT_TIME WT,
      SW.STATE,
      SW.SECONDS_IN_WAIT S_I_W,
      S.SQL_ID,
      S.SQL_CHILD_NUMBER,
      S.ROW_WAIT_OBJ# OBJ#,
      S.ROW_WAIT_FILE# FILE#,
      S.ROW_WAIT_BLOCK# BLOCK#,
      S.ROW_WAIT_ROW# ROW#,
      SW.P1,
      SW.P2,
      SW.P3
    FROM
      V$SESSION_WAIT SW,
      V$SESSION S
    WHERE
      S.USERNAME IS NOT NULL
      AND SW.SID=S.SID
      AND SW.EVENT NOT LIKE '%SQL*Net%'
      AND SW.EVENT NOT IN ('Streams AQ: waiting for messages in the queue',
      'wait for unread message on broadcast channel');
    SID STATUS   EVENT                                 WT STATE                    S_I_W SQL_ID        SQL_CHILD_NUMBER       OBJ#      FILE#     BLOCK#       ROW#         P1         P2         P3
    222 ACTIVE   enq: TX - row lock contention          0 WAITING                    333 9gag614u0kvyx                1      70568          4      42601          1 1415053318     262153       1493Notice that the second session is waiting in an enqueue, the STATE is WAITING and the OBJ#, FILE#, BLOCK#, and ROW# all contain values.
    Please provide a full test case, otherwise people may provide to you an answer that has nothing to do with the question that you are asking.
    Notice in the above that the spaces were retained in my posted output from the SQL statements.  To do the same, place the following tag before and after your code sections (do not include the space before and after the brackets):
    { code }
    Charles Hooper
    Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
    http://hoopercharles.wordpress.com/
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How skip on locked rows

    hello
    please guide me
    sqlserver select as READPAST hint that cause skip on locked rows that another transaction locked it
    For example, assume table T1 contains a single integer column with the values of 1, 2, 3, 4, 5. If transaction A changes the value of 3 to 8 but has not yet committed, a SELECT * FROM T1 (READPAST) yields values 1, 2, 4, 5
    when i use oracle. how i can skip rows that another transaction locked it when i use "for update" in select statement?
    thanks

    There is some undocumented syntax "FOR UPDATE SKIP LOCKED" that does exactly this. Problem is that it is not supported and Oracle is free to remove or change the functionality.
    The other option is to program it like this:
    (pseudocode, not tested)
    declare
      l_pk_array is table of t1.<pk column>%type index by pls_integer;
      cursor c is select <pk column> from t1;
    begin
      open c;
      loop
        fetch c bulk collect into l_pk_array limit 100
        for i in 1..l_pk_array.count
        loop
          declare
            e_row_locked exception;
            pragma exception_init (e_row_locked,-54);
            <other arrays>
          begin
            select <other columns>
              into <other arrays>
              from t1
             where t1.pk_column = l_pk_array(i)
                   for update nowait
            <your code>
          exception
          when no_data_found then
            null;
          when e_row_locked then
            null;
          end;
        end loop
        <maybe a forall statement here>
      end loop
      close c;
    end;Regards,
    Rob.

  • JBO-28004: Could not lock row in control table for table null

    hello.
    we have deployed two application on a server.
    both have code like this:
         select = "SELECT * from tab";
    vo = e.getDBTransaction().createViewObjectFromQueryStmt(select);
                        vo.executeQuery();
                        RowSet rs = vo.getRowSet();
                        if(rs != null)
                             Row lastRow = vo.getRowSet().last();
    the last line throws sometimes an exception (.last()).
    JBO-28004: Could not lock row in control table for table null
    at oracle.jbo.PCollException.throwException(PCollException.java:34)
    at oracle.jbo.pcoll.OraclePersistManager.commit(OraclePersistManager.java:229)
    at oracle.jbo.pcoll.OraclePersistManager.dropTable(OraclePersistManager.java:499)
    at oracle.jbo.pcoll.OraclePersistManager.createTable(OraclePersistManager.java:692)
    at oracle.jbo.pcoll.OraclePersistManager.insert(OraclePersistManager.java:1492)
    at oracle.jbo.pcoll.PCollNode.passivateElem(PCollNode.java:542)
    at oracle.jbo.pcoll.PCollNode.passivate(PCollNode.java:657)
    at oracle.jbo.pcoll.PCollection.passivateLRULeafNode(PCollection.java:351)
    at oracle.jbo.pcoll.PCollection.checkActiveLeafLimit(PCollection.java:404)
    at oracle.jbo.pcoll.PCollection.nodeRecentlyUsed(PCollection.java:252)
    at oracle.jbo.pcoll.PCollNode.<init>(PCollNode.java:73)
    at oracle.jbo.pcoll.PCollNode.checkForSplit(PCollNode.java:1553)
    at oracle.jbo.pcoll.PCollNode.addObject(PCollNode.java:1622)
    at oracle.jbo.pcoll.PCollNode.addObject(PCollNode.java:1610)
    at oracle.jbo.pcoll.PCollection.addElement(PCollection.java:753)
    at oracle.jbo.server.QueryCollection.fetch(QueryCollection.java:1247)
    at oracle.jbo.server.QueryCollection.getRowCount(QueryCollection.java:1065)
    at oracle.jbo.server.ViewRowSetImpl.getRowCount(ViewRowSetImpl.java:1444)
    at oracle.jbo.server.ViewRowSetIteratorImpl.last(ViewRowSetIteratorImpl.java:1183)
    at oracle.jbo.server.ViewRowSetImpl.last(ViewRowSetImpl.java:2246)
    at oracle.jbo.server.ViewObjectImpl.last(ViewObjectImpl.java:4352)
    at com.omv.emis.extemis.bc.EmsFreigabeImpl.checkFullMonth(EmsFreigabeImpl.java:327)
    at com.omv.emis.extemis.bc.EmsFreigabeImpl.doDML(EmsFreigabeImpl.java:293)
    at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:3410)
    at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:2274)
    at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:2216)
    at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:1511)
    at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:1677)
    at EmsFreigabeView1_BrowseEdit._jspService(_EmsFreigabeView1__BrowseEdit.java:134)
    at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(JAZNFilter.java:283)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:563)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:309)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
    this exception does not occur every time just sometimes.
    (no other user/application uses the specific table, so there is no other lock)
    maybe someone knows an error source.
    thx in advance.

    Gina:
    Could you run you app with diagnostic turned on?
    If you're launching your middle tier from command prompt, you should invoke java as
    java -Djbo.debugoutput=console ...
    If you're launching your middle tier from w/i JDev..
    1. Select the project.
    2. Do right mouse click and select "Project Settings..."
    3. On the Settings dialog, select Configurations/Runner.
    4. In the righthand side pane, you should see a textbox for "Java
    Options". Please add the following JVM switch:
    -Djbo.debugoutput=console
    Then, rerun. The run command should include
    -Djbo.debugoutput=console as in
    "D:\JDev9i\jdk\bin\javaw.exe" -Djbo.debugoutput=console -classpath ...
    Then, you should see a lot of diagnostic messages. It will also give you complete stack trace including that of the detail exception.
    When you get the exception diagnostic output, please post that to this thread.
    Thanks.
    Sung

  • Who locks row in IOT?

    Hi,
    I have an index organized table (IOT) where I need to find the locking session for as certain row.
    I found usefull information on this website: http://www.orafaq.com/node/854
    But for some reason I annot use <tt>DBMS_ROWID.rowid_create</tt> to calculate rowid's in the IOT:    SQL> SELECT sid
          2    FROM v$lock
          3        JOIN dba_objects dbob
          4          ON (object_id = id1)
          5        JOIN v$session vds
          6          USING (sid)
          7          WHERE DBOB.OBJECT_NAME = 'PAC_ZUO_PARA_HEAD_TOP_IOT';
               SID
              2058
        SQL> SELECT to_char(DBMS_ROWID.rowid_create (1
          2                                ,  vds.row_wait_obj#
          3                                ,  vds.row_wait_file#
          4                                ,  vds.row_wait_block#
          5                                ,  vds.row_wait_row#
          6                                 ))
          7    FROM v$session vds
          8   WHERE     sid = 2058;
        SELECT to_char(DBMS_ROWID.rowid_create (1
        ERROR at line 1:
        ORA-01410: invalid ROWID
        ORA-06512: at "SYS.DBMS_ROWID", line 38
        SQL> SELECT 'rid '||rowid , zpht.*
          2    FROM  pac_zuo_para_head_top_iot zpht
          3   WHERE ZPHT.PARA_ID =   1845828150001; -- row locked by the other session
        'RID'||ROWID                                     PARA_ID TOP_PARA_ID
        rid *BAOSoyoIxwJVOx0QAQL+                     1.8458E+12  2.0797E+12
        SQL>How do I match the locked rows with the one I'm locking for?
    DB is 10.2.0.5 soon upgrading to 11.2.*
    *[edit]* waiting for a blocking lock and looking from a third session is not an option.
    bye
    TPD
    Edited by: T.PD on 01.03.2012 14:44

    I'm not sure how to answer your question, but IOTs don't use "regular" ROWIDs. They use "Logical" or "Universal" ROWIDs which DBMS_ROWID does not support.
    DBMS_ROWID is not to be used with universal ROWIDs (UROWIDs).Source: http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_rowid.htm#CIHJBJHG

  • How To find rowid of Locked row.

    Hello,
    can somebody tell me the "select statement", how to find the rowid of a locked row, which is locked by "select for update" and also the rowid of a row which is going to be updated by "update statement".

    check out v$session and the following columns.
    It is documented here
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96536/ch3171.htm#1122127
    ROW_WAIT_OBJ#
    NUMBER
    Object ID for the table containing the ROWID specified in ROW_WAIT_ROW#
    ROW_WAIT_FILE#
    NUMBER
    Identifier for the datafile containing the ROWID specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
    ROW_WAIT_BLOCK#
    NUMBER
    Identifier for the block containing the ROWID specified in ROW_WAIT_ROW#. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.
    ROW_WAIT_ROW#
    NUMBER
    The current ROWID being locked. This column is valid only if the session is currently waiting for another transaction to commit and the value of ROW_WAIT_OBJ# is not -1.

  • How can I retain updates made in multiple locked rows and override scope rollback defined for row locking purposes ?

    I have a set of stored procedures in SQL
    One of which is called to build a list of entries to submit to a web service
    Those queries are called by identical processes running on different machines, so to prevent duplicate processing we lock rows that are presently being processed.
    BEGIN
    TRAN TRAN1
    SELECT t.[TransactionId],t.[ContentIdentifier]
    FROM [dbo].[Transactions]
    t WITH(READPAST,
    UPDLOCK,
    ROWLOCK)where
    (t.Quarantined
    <> 1)
    COMMIT
    A Second stored procedure simply updates the Quarantined flag.
    My C# code
    TransactionOptions transactionOptions
    =
    new
    TransactionOptions();
    transactionOptions.IsolationLevel
    =
    IsolationLevel.ReadCommitted;
    transactionOptions.Timeout
    =
    new
    TimeSpan(0,
    10,
    0);
    using (TransactionScope
    scopeMain =
    new
    TransactionScope(TransactionScopeOption.Required,
    transactionOptions))
    TransactionsReady = DAL.GetFilesForProcessingByServiceType(i);
    using (TransactionScope
    scopeSuppress =
    new
    TransactionScope(TransactionScopeOption.Suppress,
    transactionOptions))
    foreach (var
    Transaction in TransactionsReady)
    { try
    returnData = proxy.Submit(stuffToProcess);
    using (var
    scopeInner =
    new System.Transactions.TransactionScope())
    DAL.QuarantineTransaction(Transaction.TransactionId);
    scopeInner.Complete();
    scopeSuppress.Complete();
    scopeMain.Complete();
    The problem I experience is that if I have the Transaction Scope scopeSuppress uncommented, then the QuarantineTransaction stored procedure deadlocks.
    However if I comment out the ScopeSuppress, while the process then works, if it is interrupted mid-way, then all of the Quarantine flags get reset, meaning the entire batch of items will get re-submitted next
    pass (this is not desirable).
    What I actually want to occur, is for the Quarantine flag to be retained on all processed records so that even if the program terminates unexpectedly, processed items remain processed but all the row locks are
    released.
    Does anyone know of a way to achieve this ?

    The hour is late where I sit, so I don't have the time to dive into this in detail.
    However, if memory serves, TransactionScopes defaults to Serializable isolation level, which may explain the deadlocks you are getting.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Is there a way to lock rows together?

    I need a way to lock cells together so that when I sort one column certain groups of rows stay together. Is there a way to link or lock rows together? Creating a separate category isn't really feasible as I will have thousands of rows, and each one may only be linked to 3 or four rows.
    Here is a screen shot of sample of the inventory:
    http://www.flickr.com/photos/62469457@N00/5509322269/
    I basically need to be able to sort by title without losing the organization below each blue row. Any ideas?
    -Karin

    As separate records, your column titled "# of reels" will no longer be applicable. Instead, that column would be titled "Reel" and each reel will have a number. For example, the reels in 5/24/77A will have the numbers 1 through 9.
    As separate records, the rows that are in blue will not be applicable and should be deleted. All rows will have the title and location. You can create your blue rows by using the Category feature, categorizing by Title, and using COUNT (also part of the categorize feature) for summing up how many reels are contained in each title. Also select "show function name" and it will display as "Count: #".
    To find duplicate titles, you could create a column that concatenates the title and the reel number and use it to find duplicates. =A&C. There may be a 5/24/771 and 5/24/772, etc. but there should be only one of each unless you have a duplicate title. Ensure there are no duplicates before categorizing or they will get categorized together (which means they will also be sorted together).
    I'm not sure what kinds of sorts you are planning to do. Some may require turning off the categories, some may not. Note that turning on categories will sort the table and it remains sorted even after turning categories off. If you keep the Reorganization panel open you can categorize, sort and filter the table in different ways without much difficulty. Option-clicking on a disclosure triangle in a categorized table will collapse the categories; in this case it would collapse it so that you have one row per title and a count of the number of reels in the title. Option-click again to reveal all rows.
    Also, I recommend making a copy of your document before doing all this. Just in case.
    Message was edited by: Badunit

  • Lock rows and columns header in a table view report. It is possible?

    hi,
    I have a Dashboard that displays a report in "Table View" with many rows and columns.
    Is it possible to set a lock on the rows and columns like Excel?
    This would have blocked such headers that contain attributes and measures and to browse the report (eg with a scroll bar) had always viewed the headers.
    Can you help me?
    Thanks

    hi,
    please go through this discussion
    Re: SCROLL BAR to FREZZ HEADERS
    thanks,
    saichand.v

  • How To Lock Rows (in the DB)

    I need to lock a Row when a users enters some editing JSP until the user finished doing changes, while the other users (using VOs. created on the fly, and SQLJ) **DO NOT** have to get access to that Row.
    From a bean used in a JSP or in My AppModule How do I get a Lock over a Row? (The lock must be visible to all users of the D.B. not just the ones using the Framework.)
    Also setting the Transaction locking mode to NONE and doing manually the locks doesn't seems to be locking anything to the rest of users of the Framework.
    Thanks in advance.

    Or else you could issue the following select statement:
    select *
    from tab1, tab2, ....
    where <join clause>
    for update of <table to be updated>

  • Locked objects, Locked rows in a table, kind of locks

    Well, final question for the day.
    I created multiple session using sql plus, and in one session sql plus got lunch, it hour glasses and does nothing. I called up a DBA friend and he opined that it might be becasue one of my sessions has got a lock on a row in a table. I was also told that locks can be table level locks and row level locks.
    Please help me understand the below( I did try to read about locks, but atleast after first reading it is more confusing.. in order to update a row in a table why would oracle obtain a table level lock?)
    1. What are the different database objects which can get locked ?
    2. What are the different kinds of locks and what do they mean?
    3. When a row is locked by a session, can we identify that particular session and how ?
    4. What is the difference between pessimistic locking and optmistic locking ?
    5. Any scripts which I can use to get lock related info from database ?
    Gony

    1. What are the different database objects which can get locked ?There are locks which oracle acquire on any useful resource. We , as the users are most focussed on tables and their locks. But locks do happen in memory as well.
    2. What are the different kinds of locks and what do they mean?http://download.oracle.com/docs/cd/B28359_01/server.111/b28320/dynviews_2.htm#REFRN30121
    3. When a row is locked by a session, can we identify that particular session and how ?Sure, there is a default script that comes up, utllockt.sql which can show you. Other than that, you can EM to do so as well. Read this,
    4. What is the difference between pessimistic locking and optmistic locking ?http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/instance_tune.htm#sthref748
    5. Any scripts which I can use to get lock related info from database ?See #4 above.
    HTH
    Aman....

  • Locking Row in ALV

    hai,
      Actually i am displaying a table in ALV and i am locking key values.
    Now my reqment is , if i press (NEW, COPY )button then i have to add one new row and that row should be Unlocked to insert values.

    Hi,
    using Styles you can Do that..., You need to find the condition accordingly you can Disable and enable the cells for edit.
    Check the sample code using LVC fm.
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV..
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    "{ FOR DISABLE
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    "} FOR DISABLE
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    "{FOR DISABLE HERE 6ROW IS DISABLED
    SY-TABIX = 6.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 10.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    LS_EDIT-FIELDNAME = 'POSNR'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 6.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                      HANDLE_STYLE .
    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    "} UP TO HERE
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      EXCEPTIONS
        PROGRAM_ERROR      = 1
        OTHERS             = 2.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards
    vijay

Maybe you are looking for