Basic questions on row locks

Oracle 11.0.1.7
I just have a basic question about locks. What happens when 2 transactions at the same time try to delete the row? Does one get the row and other wouldn't? Is there a implicit locks that oracle takes care of?
Could you also point me to some examples or source.

That is what I have seen with for update and thought for update is for. But when I look at the oracle docs this is what it says. And what's confusing is "Permitted Operations" piece. It says other transactions can query, update etc.
A row exclusive table lock (also called a subexclusive table lock, SX) generally indicates that the transaction holding the lock has made one or more updates to rows in the table or issued SELECT ... FOR UPDATE. A row exclusive table lock is acquired automatically for a table modified by the following types of statements:
SELECT ... FROM table ... FOR UPDATE OF ...;
INSERT INTO table ... ;
UPDATE table ... ;
DELETE FROM table ... ; 
LOCK TABLE table IN ROW EXCLUSIVE MODE;
A row exclusive table lock is slightly more restrictive than a row share table lock.
Permitted Operations: A row exclusive table lock held by a transaction allows other transactions to query, insert, update, delete, or lock rows concurrently in the same table. Therefore, row exclusive table locks allow multiple transactions to obtain simultaneous row exclusive and row share table locks for the same table.
Prohibited Operations: A row exclusive table lock held by a transaction prevents other transactions from manually locking the table for exclusive reading or writing. Therefore, other transactions cannot concurrently lock the table using the following statements:
LOCK TABLE table IN SHARE MODE; 
LOCK TABLE table IN SHARE ROW EXCLUSIVE MODE;
LOCK TABLE table IN EXCLUSIVE MODE;

Similar Messages

  • SQL_ID row locks

    Hi,
    Every day from 23.00 to 01.00 the performance of the database becomes slow, when i traced i found the following "The SQL statement with SQL_ID "4pgt142s271gy" was blocked on row locks.", which i think is the reason for poor performance and also i found the query with this SQL_ID.
    Dut to this my Application at this time Hangs.
    What should be my next step,i can't change this query because till last week the database was going fine.
    Please advice me ASAP.

    Hi,
    Do these tables involve Workspace Manager? If so, I would need a better understanding of exactly which operations you are performing before commenting on any performance issues.
    Otherwise, I would recommend to use the following forum for general database questions.
    General Database Discussions
    Regards,
    Ben

  • Three pretty basic questions--27" iMac, Snow Leopard

    New 27" iMac. Three (ridiculously basic) questions:
    1) How do I take my old 24" iMac wireless keyboard and pair it with my new computer? I really despise this little keyboard that came with the current computer.
    2) I default to Preview and Text Edit when I want to use Adobe Acrobat and Word. How do I change this?
    3) When I sync my iPhone it does not download the iPhone photos to iPhoto. I see the device in iPhoto. How do I download my photos into iPhoto so I have them resident on my computer and can open and manipulate in Photoshop?
    THANKS THANKS THANKS

    Katie Black wrote:
    New 27" iMac. Three (ridiculously basic) questions:
    1) How do I take my old 24" iMac wireless keyboard and pair it with my new computer? I really despise this little keyboard that came with the current computer.
    *Start your 24" iMac, click the Bluetooth icon in the menu bar at the top (it shows the clock, wifi, audio level, etc), then select the Keyboard and then disconnect.*
    *Also from that bluetooth menu, goto 'Open Bluetooth Preferences' and you should see the keyboard there as well. There is a little 'minus' sign in the lower left of that window. Select the Keyboard and press the minus sign and it should remove the Keyboard from that iMac.*
    *On your new iMac, make it discoverable (the device and the new Mac), and you should be able to pair it from there.*
    2) I default to Preview and Text Edit when I want to use Adobe Acrobat and Word. How do I change this?
    *Answered in previous posts.*
    3) When I sync my iPhone it does not download the iPhone photos to iPhoto. I see the device in iPhoto. How do I download my photos into iPhoto so I have them resident on my computer and can open and manipulate in Photoshop?
    *Shot in the dark. So open up iTunes with your iPhone connected/plugged into your Mac.*
    *on the left side of iTunes where you see your iPhone, click on the iPhone icon. And on the window next to left bar you should see a row of tabs at the top and at the far right you should see a tab for Photos.*
    *Click on that tab and select Sync photos.*
    *That should allow you to sync your photos from your iphone to your iphoto library*
    hope that helps

  • Tuning row lock contention wait events

    Hello everyone,
    Working on 10g/windows
    Top 5 events
    EVENT TOTAL_WAITS TIME_WAITED AVG_MS PERCENT
    CPU 9462339 48
    enq: TX - row lock contention 12531 3660728 2921.34 18
    control file parallel write 1300731 3088079 23.74 16
    log file parallel write 1510503 1264080 8.37 6
    log file sync 1072553 968007 9.03 5
    Distribution of row lock wait during the last 4 days in the database server
    END_INTERVAL_TIME TOTAL_WAITS TIME_WAITED_MICRO AVG_WAIT_MS
    2008-04-01 16:00:58 909 2721008230 2993.41
    2008-04-01 15:00:27 50 149941140 2998.82
    2008-03-31 12:00:42 193 575595397 2982.36
    2008-03-29 23:00:13 172 513058700 2982.9
    2008-03-29 22:00:37 164 483940046 2950.85
    2008-03-27 22:00:35 565 1667120838 2950.66
    2008-03-26 18:00:59 348 1042918982 2996.89
    My analysis:
    It's obvious that the row lock contention wait time is huge, and this direct me to find out SQL stmt, causing this.
    all the SQL statement was SELECT ....... FOR UPDATE stmt.
    I was also able to find out locked tables.
    My tuning idea:
    1. I'm thinking to reorganize hot tables as well as their indexes, but by instinct it seems to not give so much value to avoid the huge row lock wait time.
    2. I'm also seeing if I can reduce the number of rows per block, by increasing PCTFREE and diminishing PCTUSED, so the contention will spread over many blocks instead of one heavy block.
    Question
    As SQL stmt related to those locked tables are select ... for update, how could I tune this kind of stmt?
    Does someone have other idea to come up with this row lock contention?
    Tanks for your effort and help

    Taking another look at your suggested function based index, it depends on the data type of the DEV.POS_FOLIO_ID.POS_FOLIO_ID column. If the column is defined as a number, and it is a primary key, there will already be a usable index on that column.
    Yesterday, I wrote this: "Once I understood why or how the sessions were trying to insert duplicate primary key values, I would try to determine why the average number of seconds for the wait event is almost 3 seconds (maybe a timeout)."
    After fixing the formatting of the top 5 wait events (total duration unknown):
    EVENT                        TOTAL_WAITS  TIME_WAITED   AVG_MS PERCENT
    CPU                                         94,623.39             48
    enq: TX - row lock contention     12,531    36,607.28  2921.34    18
    control file parallel write    1,300,731    30,880.79    23.74    16
    log file parallel write        1,510,503    12,640.80     8.37     6
    log file sync                  1,072,553     9,680.07     9.03     512,531 * 3 second time out = 37,593 seconds = 10.44 hours.
    What if the reason for the 3 second average wait time is due to a timeout. I performed a little experiment... I changed a row in a test table and then made a pot of coffee.
    In session 1:
    CREATE TABLE T1 (
      C1 NUMBER(10),
      C2 NUMBER(10),
      PRIMARY KEY (C1));
    INSERT INTO T1
    SELECT
      ROWNUM,
      ROWNUM*10
    FROM
      DUAL
    CONNECT BY
      LEVEL<=1000000;
    COMMIT;I now have a test table with 1,000,000 rows. I start monitoring the changes in the wait events roughly every 60 seconds, and V$SESSION_WAIT and V$LOCK roughly 4 times per second.
    Back in session 1:
    UPDATE
      T1
    SET
      C1=-C1
    WHERE
      C1<=100;I have now modified the first 100 rows that were inserted into the table, time to make the pot of coffee.
    In session 2, I try to insert a row with a primary key value of -10:
    INSERT INTO T1 VALUES (
      -10,
      10);Session 2 hangs.
    If I take the third 60 second snap of the system wide wait events as the zero point, and the 11th snap as the end point. There were 149 waits on ENQ: TX - ROW LOCK CONTENTION, 148 time outs, 446.62 seconds of total time in the wait event, with an average wait time of 2.997450 seconds.
    Rolling down to the session level wait events, SID 208 (my session 2) had 149 waits on ENQ: TX - ROW LOCK CONTENTION, for a total time of 446.61 seconds with an average wait time of 2.997383 seconds. All of the 149 waits and the wait time was in this one session that was locked up for the full duration of this time period because session 1 was making a pot of coffee.
    Rolling down to V$SESSION_WAIT (sampled roughly 4 times per second): At the start of the third time interval, SID 208 has been in the ENQ: TX - ROW LOCK CONTENTION wait event for 39 seconds and is actively waiting trying to execute SQL with a hash value of 1001532423, the wait object is -1, wait file is 0, wait block is 0, wait row is 0, P1 is 1415053316, P2 is 196646, P3 is 4754.
    At the end of the 11th time interval: , SID 208 has been in the ENQ: TX - ROW LOCK CONTENTION wait event for 483 seconds and is actively waiting trying to execute SQL with a hash value of 1001532423, the wait object is -1, wait file is 0, wait block is 0, wait row is 0, P1 is 1415053316, P2 is 196646, P3 is 4754.
    Rolling down to V$LOCK (sampled roughly 4 times per second): I see that SID 214 (session 1) is blocking SID 208 (session 2). SID 214 has a TX lock in mode 6 with ID1 of 196646 and ID2 of 4754. SID 208 is requesting a TX lock in mode 4 with ID1 of 196646 and ID2 of 4754.
    So, it seems that I need a faster coffee pot rather than an additional index on my table. It could be that the above process would have found that the application associated with SID 214 was abandoned or crashed and for some reason the lock was not released for a long period of time, a little less than 10.44 hours in your case.
    Charles Hooper
    IT Manager/Oracle DBA
    K&M Machine-Fabricating, Inc.

  • Heavy row lock contention

    Guys,
    I really appreciate your views on this.. Please can some one who have worked on RAC and have an understanding how RAC works, guide me.
    We currently are running a loadtest on one of the new RAC system and we are seeing excessive row lock contention for one table. The table basically has very few rows, say about 6-8 and pretty much every user uses this table to lock rows before fetching some data from other tables. When have a heavy load, we see very high wait on this table and enq TX : Row lock contention.
    What is the best way to avoid this ? Is there anyway, we can modify the design of the application and ensure locking.. The typical query that locks the rows in the table looks like this
    SELECT WL0.CLUB_NAME, WL0.SCHEDULE_ID FROM VF_BINGO_NEXT_CLUB_DRAW WL0 WHERE ( WL0.CLUB_NAME = :1 ) FOR UPDATE As said, they table has only 6-8 rows, so query plan etc doesn't apply. Please can someone who have extensive application knowledge guide me thru ?
    Many thanks in advance.
    G

    > But is there a way to alliviate the concurrency issue, if there is a genuine
    requirement to hold lock on a table. What other options do we have other
    than locking ?
    The purpose of a lock is to ensure data consistency - only 1 process can change that row. So what I find puzzling is why so many app sessions want to change that single row. What data does that row hold that requires continual change? Just what is the purpose of this data if it is consistently and continually changing? What business requirement does it attempt to solve?
    To be honest, this sounds like a major design problem to me.
    Like the surrogate key generator approach I mentioned. You create a PK_SEQUENCE table with columns (tablename, pk_value). Any insert against a table requires a lock on PK_SEQUENCE for the table being inserted into - a read of the PK_VALUE, incrementing it by one and then updating that row with the latest sequence. This way each INSERT gets a "nice sequential number" to use as surrogate key for new rows.
    Even when this is done as an autonomous transaction, it introduces a very expensive resource - why? Because only one session at a time can be serviced by that resource.
    If there are a lot of INSERTs into a table, this approach will quickly become a severe bottleneck as every single insert requires a new surrogate key value and a lock on that PK_SEQUENCE table to obtain that value.
    This problem is solved by allowing/enabling such a resource to serve multiple sessions concurrently. Which is for example what Oracle Sequence objects do within this example I've described.
    The bottom line is that the design you describe introduced a bottleneck by create an expensive and serialised resource that can only serve a single session at a time.
    You need to re-look at the business requirement - and find another way to solve it than to introduce this type of serialised resource and contention.

  • Row lock contention...

    Hello,
    I am working on Oracle 10.2.0.4 on AIX .
    In awr reports we found 'row lock contention' as top wait events. As my knowledge There are two types of locks..
    1. Deadlock - where oracle will automatically rollback the locking query and generate deadlock trace file.
    2. A user session update some rows and not commit/rollback , so other sessions which need to lock same rows , were witing. So dba need to manully kill first
    session which was holding lock.
    We want to know , in which of above scenario in awr report we can see 'row lock contention' wait.
    any idea ..

    Ok, first, I think your definitions are a bit off.
    There is the concept of a lock, or an enqueue. The terms 'lock' and 'enqueue' are synonymous, in Oracle.
    A lock (or enqueue) protects a 'resource'. A TX (transaction) enqueue protects rows which have been locked. Only one transaction is permitted to modify a specific row in a specific table, at a time, for obvious reasons.
    A row-level lock occurs when a session attempts to modify a row that another session has already locked. When that occurs, the session attempting the lock will wait on a TX enqueue.
    These types of locks occur all the time in Oracle, and are not necessarily a bad thing. They are a sign that Oracle is protecting the integrity of your data, and that's a good thing.
    However, when waits on row-level locks begin to dominate the response time of your application, then you have a problem. Generally, this is going to come down to your application design. How can you avoid concurrent sessions colliding on their updates to specific rows? This is something that only you, with your knowledge of your application, can answer.
    Finally, you mentioned the term 'deadlock' before. A deadlock occurs when two or more sessions are simultaneously holding a lock that the other is waiting on, while waiting on a lock the other is holding.
    A simple example would be as follows:
    Consider table_a, with row1 and row2.
    Session 1 takes a lock on row1, no problem.
    Session 2 takes a lock on row2, no problem.
    Now, session 1 attempts to take a lock on row2, but session 2 has lock, so it waits.
    Now, session 2 attempts to take a lock on row1, but session 1 has lock, so it waits.
    This is a deadlock. It would wait forever. But, the Oracle kernel has a deadlock detection mechanism. So, within 3 seconds, Oracle will detect a deadlock, and one of the sessions (usually the one that has been waiting the longest) will catch ORA-00060 deadlock detected, and statement level rollback will occur.
    Hope that clarifies your questions and/or doubts,
    -Mark

  • Enq: TX - row lock contention problem

    Hi ,
    Db version 10.2.0.4
    os solaris.
    i have upgraded my database from 9.2.0.4 to 10.2.0.4 by using exp/imp as my database is small.
    I have created new instance of 10g and changed parameter values as 9i(as required). then imported from 9i to 10g instance.
    After importing in 10g instance we are face application wide performance problem..the response time of the applicatoin was very slow...
    i have taken awr report of various times and have seeen
    SELECT puid,ptimestamp FROM PPOM_OBJECT WHERE puid IN (:1) FOR UPDATE
    this query is causing the problem..enq: TX - row lock contention
    Cache Sizes
    ~~~~~~~~~~~                       Begin        End
                   Buffer Cache:       756M       756M  Std Block Size:         8K
               Shared Pool Size:       252M       252M      Log Buffer:     1,264K
    Load Profile
    ~~~~~~~~~~~~                            Per Second       Per Transaction
                      Redo size:              2,501.54              3,029.25
                  Logical reads:              2,067.79              2,504.00
                  Block changes:                 17.99                 21.78
                 Physical reads:                  0.02                  0.03
                Physical writes:                  0.41                  0.50
                     User calls:                140.74                170.44
                         Parses:                139.55                168.99
                    Hard parses:                  0.01                  0.01
                          Sorts:                 10.65                 12.89
                         Logons:                  0.32                  0.38
                       Executes:                139.76                169.24
                   Transactions:                  0.83
      % Blocks changed per Read:    0.87    Recursive Call %:    17.60
    Rollback per transaction %:    0.00       Rows per Sort:    16.86
    Instance Efficiency Percentages (Target 100%)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                Buffer Nowait %:  100.00       Redo NoWait %:  100.00
                Buffer  Hit   %:  100.00    In-memory Sort %:  100.00
                Library Hit   %:  100.03        Soft Parse %:  100.00
             Execute to Parse %:    0.15         Latch Hit %:   99.89
    Parse CPU to Parse Elapsd %:   93.19     % Non-Parse CPU:   94.94
    Shared Pool Statistics        Begin    End
                 Memory Usage %:   86.73   86.55
        % SQL with executions>1:   90.99   95.33
      % Memory for SQL w/exec>1:   79.15   90.58
    Top 5 Timed Events                                         Avg %Total
    ~~~~~~~~~~~~~~~~~~                                        wait   Call
    Event                                 Waits    Time (s)   (ms)   Time Wait Class
    CPU time                                            397          86.3
    enq: TX - row lock contention           508          59    115   12.7 Applicatio
    log file sync                         2,991           5      2    1.1     Commit
    log file parallel write               3,238           5      2    1.1 System I/O
    SQL*Net more data to client          59,871           4      0    1.0    Network
    ^LTime Model Statistics              DB/Inst: WGMUGPR2/wgmugpr2  Snaps: 706-707
    -> Total time in database user-calls (DB Time): 460.5s
    -> Statistics including the word "background" measure background process
       time, and so do not contribute to the DB time statistic
    -> Ordered by % or DB time desc, Statistic name
                                                                       Avg
                                                 %Time  Total Wait    wait     Waits
    Event                                 Waits  -outs    Time (s)    (ms)      /txn
    enq: TX - row lock contentio            508     .0          59     115       0.2
    log file sync                         2,991     .0           5       2       1.0
    log file parallel write               3,238     .0           5       2       1.1
    SQL*Net more data to client          59,871     .0           4       0      20.1
    control file parallel write           1,201     .0           1       1       0.4
    SQL*Net more data from clien          3,393     .0           1       0       1.1
    SQL*Net message to client           509,864     .0           1       0     170.9
    os thread startup                         3     .0           1     196       0.0
    db file parallel write                  845     .0           1       1       0.3
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
      Elapsed      CPU                  Elap per  % Total
      Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
            59          1        1,377        0.0    12.9 bwnt27fp0z3gm
    Module: syncdizio_op@snstr09 (TNS V1-V3)
    SELECT puid,ptimestamp FROM PPOM_OBJECT WHERE puid IN (:1) FOR UPDATE
            41         41          459        0.1     8.9 8cdswsp7cva2h
    Module: syncdizio_op@snstr09 (TNS V1-V3)
    select rpad(argument_name, 32, ' ') || in_out || ' ' || nvl(type_subname, data_t
    ype) info from user_arguments where package_name IS NULL and object_name = uppe
    r(:1) and argument_name is not null order by object_name, position
            39         38        7,457        0.0     8.4 271hn6sgra2d8
    Module: syncdizio_op@snstr09 (TNS V1-V3)
    SELECT DISTINCT t_0.puid FROM PIMANTYPE t_0 WHERE (UPPER(t_0.ptype_name) = UPPER
    (:1))
            23         22          459        0.0     4.9 g92t08k78tgrw
    Module: syncdizio_op@snstr09 (TNS V1-V3)
    SELECT PIMANTYPE.puid, ptimestamp, ppid, rowning_siteu, rowning_sitec, pis_froze
    n, ptype_class, ptype_name FROM PPOM_OBJECT, PIMANTYPE WHERE PPOM_OBJECT.puid =
    (PIMANTYPE.puid)
            22         22      158,004        0.0     4.9 chqpmv9c05ghq
    Module: syncdizio_op@snstr09 (TNS V1-V3)
    SELECT puid,ptimestamp FROM PPOM_OBJECT WHERE puid = :1
            17         17        2,294        0.0     3.7 3n5trh11n1x8w
    Module: syncdizio_op@snstr09 (TNS V1-V3)
    SELECT PTYPECANNEDMETHOD.puid, ptimestamp, ppid, rowning_siteu, rowning_sitec, p
    is_frozen, pobject_desc, psecure_bits,VLA_344_5, pmethod_name, pmsg_name, ptype_
    name, pexec_seq, paction_type FROM PPOM_OBJECT,PBUSINESSRULE, PTYPECANNEDMETHOD
    WHERE PTYPECANNEDMETHOD.puid IN (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,in 9i there is a parameter ENQUEUE_RESOURCES but in 10g relese 2 its got obsoleted....
    am new to performace tunning please advice me....!
    Regards
    Vamshi

    The CBO has changed substantially between 9.2.x and 10.2.x. Pl see MOS Doc 754931.1 (Cost Based Optimizer - Common Misconceptions and Issues - 10g and Above). Pl verify that statistics have been gathered and are current - pl see MOS Doc 605439.1 (Master Note: Recommendations for Gathering Optimizer Statistics on 10g).
    Looking at your output, it seems to me that the database is entirely CPU-bound. 86.3% of time is spent on CPU. The last 5 SQL statements in the output, all of the elapsed time is spent on CPU.
    Pl post your init.ora parameters, along with your hardware specs. This question might be more appropriate in the "Database - General" forum.
    HTH
    Srini

  • Basic Questions on CUBE & DSO size

    Hi Experts
    I had a few basic questions with Regards to Cube and DSO.
    I had a CUBE  & ODS in Live with Historical Data from 2000 to tell date.
    1) How can i check the No of Data Records avaliable in Cube (2000 to till date)
    2) How can i check the No of Data Records avaliable in ODS (2000 to till date)
    AND
    3)When i check the Data Load request in Cube (Context Menu Manage) in request tab i can see
    Request ID,Avaliable for reporting...Transfered Records & Added Records
    What is the difference between Transfered Records & Added Records in a request
    Thanks in advance

    Hi,
    1 & 2. to check ODS/Cube data goto SE11/SE16-->give the name of the ODS/Cube as /BIC/A(ODS name)
    and for the cube as /BI0/F(cube name) (before compression) and /BI0/E(cube name) (after compression).
    3. Transferred records--> are the records loaded from Source.
        Added records--> these are the records which are added to the cube/ods. This added records will depends on the Transfer/update rules of cube and ODS and also key fields in the ODS. This added records may be less or greater than transferred records.
    Added to FCI the program: SAP_INFOCUBE_DESIGNS is to display how many rows per dimension table.
    Hope you understood ......
    Edited by: Ravi kanth on May 19, 2009 5:25 PM

  • Basic Questions on UITableView

    Hi, I'm trying to learn the iPhone API by creating a simple table application and I have some basic questions. There are stuff in the example code and the docs that seem to contradict, and I'm hoping some people can clarify.
    1) Table View Programming for iPhone OS, it says that UITableView must have a delegate and a source. I take it that in the example code (let's use TableCellSubivews) RootViewController is the source and TableViewCellSubviews is the delegate?
    2) If so, why does TableViewCellSubviews adopt the UIApplicationDelegate protocol and not UITableViewDelegate? In fact, I don't think any of the classes in the example code adopt UITableViewDelegate.
    3) In the UITableViewDelegate reference, it names didSelectRowAtIndexPath as a method. In the example code, why is in the didSelectRowAtIndexPath a method in the RootViewController, and not the delegate itself?
    Thanks for any explanations that anyone can give to help a noob!

    {quote}
    1) Table View Programming for iPhone OS, it says that UITableView must have a delegate and a source. I take it that in the example code (let's use TableCellSubivews) RootViewController is the source and TableViewCellSubviews is the delegate?
    {quote}
    There are 3 things that need to be done when setting up a tableview:
    1- the tableview controller itself, which determines how the tableview is set up, decides on the view, etc..
    2- the data source: the controller in 1) above needs to ask someone "give me the cell with the data for row #x. That's the job of the data source
    3- The delegate: some things for the table view need visible stuff such as the height of a row, whether a row should have a checkmark, etc... That's the job of the delegate.
    Now what often happens is that people do not specify a data source nor a delegate. What this means is that the controller performs all 3 jobs. Again, if the controller does not specify its delegate (or no class registers as its delegate), then the controller acts as its own delegate. (that answers your second question)
    {quote}
    3) In the UITableViewDelegate reference, it names didSelectRowAtIndexPath as a method. In the example code, why is in the didSelectRowAtIndexPath a method in the RootViewController, and not the delegate itself?
    {quote}
    That's a tricky question.
    The thing is that both the data source AND the delegate adopt a method called didSelectRowAtIndexPath. But they're for very different purposes. For the delegate, it's simply a notification by the controller that "hey, this row was selected, you may want to do something with it", i.e. change the color of the font, add a checkmark, etc...
    For the data source, it's much more important (and required!): the controller is saying "hey, someone requested row #x. Please give it to me!" This includes getting all the data and setting up the whole row, then returning it to the controller.
    Hope this helps clear things up.

  • Basic Question - Update - Usage of index

    Gurus,
    I have a basic question. As per my knowledge, an index will speed up the process while we are selecting the data. If we are doing some DML operations (especially Update), do we need the index to speed up the process eventhough the indexed column is in the where condition?
    Regards
    Edited by: Sarma12 on Apr 17, 2012 5:59 AM

    Have you tried setting up a test scenario? For example:
    SQL> CREATE TABLE test AS SELECT 1 num FROM DUAL CONNECT BY LEVEL <= 1000;
    Table created.
    SQL> UPDATE test SET NUM = 99 WHERE ROWNUM = 1;
    1 row updated.
    SQL> COMMIT;
    Commit complete.
    SQL> UPDATE /*+gather_plan_statistics*/
      2         test
      3  SET    num = 2
      4  WHERE  num = 99
      5  ;
    1 row updated.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(null,null,'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  96wt4ddwy0sa5, child number 0
    UPDATE /*+gather_plan_statistics*/        test SET    num = 2 WHERE
    num = 99
    Plan hash value: 3859524075
    | Id  | Operation          | Name | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   0 | UPDATE STATEMENT   |      |      1 |        |      0 |00:00:00.01 |       7 |
    |   1 |  UPDATE            | TEST |      1 |        |      0 |00:00:00.01 |       7 |
    |*  2 |   TABLE ACCESS FULL| TEST |      1 |      1 |      1 |00:00:00.01 |       4 |
    Predicate Information (identified by operation id):
       2 - filter("NUM"=99)
    Note
       - dynamic sampling used for this statement (level=2)
    24 rows selected.
    SQL> rollback;
    Rollback complete.
    SQL> CREATE INDEX test_x1 ON test(num);
    Index created.
    SQL> UPDATE /*+gather_plan_statistics*/
      2         test
      3  SET    num = 2
      4  WHERE  num = 99
      5  ;
    1 row updated.
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(null,null,'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  96wt4ddwy0sa5, child number 0
    UPDATE /*+gather_plan_statistics*/        test SET    num = 2 WHERE
    num = 99
    Plan hash value: 734435536
    | Id  | Operation         | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   0 | UPDATE STATEMENT  |         |      1 |        |      0 |00:00:00.01 |       9 |
    |   1 |  UPDATE           | TEST    |      1 |        |      0 |00:00:00.01 |       9 |
    |*  2 |   INDEX RANGE SCAN| TEST_X1 |      1 |      1 |      1 |00:00:00.01 |       2 |
    Predicate Information (identified by operation id):
       2 - access("NUM"=99)
    Note
       - dynamic sampling used for this statement (level=2)
    24 rows selected.So yes, an index may be used in DML.

  • How and when the database release a row lock?

    Dear experts,
    We are using the following statement to obtain a row lock in a table in the database(ORACLE of course),
    SELECT * FROM {TABLE_NAME} WHERE ID = 1 for update
    and if we succeed grabbing the row lock we will continue to issue a update statement every 30 seconds to preserve the lock as far as possible.
    here is the update statement to preserve the lock,
    UPDATE {TABLE_NAME} SET time = ? WHERE ID = 1.
    As you see more longer we keep holding the row lock , more update statements are submitted in the pending transaction.
    In normal case our application can grab the exclusive row lock and works for a long time,however sometimes a connection reset exception is thrown
    and our application will close the connection(I assume the pending transaction will be rolled back by the database) and exit the JVM.
    Since other applications will keep trying to grab the same row lock to become the master role,
    we expect one of them can succeed but they are all failed because the database has not released the row lock as expected.
    Can someone explain more details about how and when the row lock can get released in our use case?
    Thanks,
    SuoNayi
    Edited by: SuoNayi on 2013-5-30 上午8:12

    Hm. Is this part of an XA transaction by any chance? I know that Oracle maintains separate bookkeeping for such transactions which can cause rows to stay 'locked' even when the regular DBA views will indicate there is no user currently locking the record at all. I have no idea about the actual details and what you need to do to clean up such a situation, that is something a DBA should know and do.
    If not... well this is more of a question for people who know the DBMS, which makes it a target for the Oracle DBMS forums. Java developers don't tend to have DBA-level knowledge of the database, you should ask the question where you have more chance of people with expertise answering stuff:
    General Database Discussions

  • Identifying deadlocked resources in graph with 1 row lock and 1 table lock

    Hi, I have run into repeated occurrences of the deadlock graph at the bottom of this post and have a few questions about it:
    1. It appears that proc 44, session 548 is holding a row lock (X). Is the waiter, proc 30, session 542, trying to acquire a row lock (X) also or an exclusive table lock (X) on the table containing that row?
    2. Under what circumstances would something hold a row exclusive table lock (SX) and want to upgrade that to a share row exclusive table lock (SSX)?
    3. Our table cxml_foldercontent has a column 'structuredDataId' with a FK to cxml_structureddata.id and an ON DELETE SET NULL trigger. Would this help explain why an "update" to one table (i.e.g cxml_foldercontent) would also need to acquire a lock in a foreign table, cxml_structureddata?
    4. What is the difference between "Current SQL statement:" and "Current SQL statement for this session:"? That terminology is confusing. Is session 542 executing the "update" or the "delete"?
    5. In the "Rows waited on:" section is it saying that Session 542 is waiting on on obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK or that it is has the lock on that row and other things are waiting on it?
    A couple of notes:
    - the cxml_foldercontent.structuredDataId FK column has an index on it already
    Deadlock graph:
                           ---------Blocker(s)--------  ---------Waiter(s)---------
    Resource Name                    process session holds waits  process session holds waits
    TX-003a0011-000003d0        44       548     X               30        542             X
    TM-0000be63-00000000       30       542     SX              44        548     SX    SSX
    session 548: DID 0001-002C-000002D9     session 542: DID 0001-001E-00000050
    session 542: DID 0001-001E-00000050     session 548: DID 0001-002C-000002D9
    Rows waited on:
    Session 542: obj - rowid = 0000BE63 - AAAL5jAAGAAA6tZAAK
      (dictionary objn - 48739, file - 6, block - 240473, slot - 10)
    Session 548: no row
    Information on the OTHER waiting sessions:
    Session 542:
      pid=30 serial=63708 audsid=143708731 user: 41/CASCADE
      O/S info: user: cascade, term: unknown, ospid: 1234, machine:
                program: JDBC Thin Client
      application name: JDBC Thin Client, hash value=2546894660
      Current SQL Statement:
    update cascade.cxml_foldercontent set name=:1 , lockId=:2 , isCurrentVersion=:3 , versionDate=:4 , metadataId=:5 , permissionsId=:6 , workflowId=:7 , isWorkingCopy=:8 , parentFolderId=:9 , relativeOrder=:10 , cachePath=:11 , isRecycled=:12 , recycleRecordId=:13 , workflowComment=:14 , draftUserId=:15 , siteId=:16 , prevVersionId=:17 , nextVersionId=:18 , originalCopyId=:19 , workingCopyId=:20 , displayName=:21 , title=:22 , summary=:23 , teaser=:24 , keywords=:25 , description=:26 , author=:27 , startDate=:28 , endDate=:29 , reviewDate=:30 , metadataSetId=:31 , expirationNoticeSent=:32 , firstExpirationWarningSent=:33 , secondExpirationWarningSent=:34 , expirationFolderId=:35 , maintainAbsoluteLinks=:36 , xmlId=:37 , structuredDataDefinitionId=:38 , pageConfigurationSetId=:39 , pageDefaultConfigurationId=:40 , structuredDataId=:41 , pageStructuredDataVersion=:42 , shouldBeIndexed=:43 , shouldBePublished=:44 , lastDatePublished=:45 , lastPublishedBy=:46 , draftOriginalId=:47 , contentTypeId=:48  where id=:49
    End of information on OTHER waiting sessions.
    Current SQL statement for this session:
    delete from cascade.cxml_structureddata where id=:1

    Mohamed Houri wrote:
    What is important for a foreign key is to be indexed (of course if the parent table is deleted/merged/updated, or if a performance reason imposes it). Wether this index is unique or not doesn't matter (as far as i know).But, you should ask your self the following question : what is the meaning of having a 1 to 1 relationship between a parent and a child table ? if you succeed to create a unique index on your FK then this means that for each PK value corresponds at most one FK value!! Isn't it? is this what you want to have?Thanks, as I mentioned above, cxml_structureddata is actually the child table of cxml_foldercontent with 1 or more records' owningEntityId referring to rows in cxml_foldercontent. The reason for the FK on cxml_foldercontent.structuredDataId is a little ambiguous but it explained above.
    Will a TX-enqueue held on mode X always be waited on by another TX-enqueue row lock X? Or can it be waited on by an Exclusive (X) table lock?Not really clear. Sorry, are you saying my question is unclear or it's not clear why type of eXclusive lock session 542 is trying to acquire in the first line of the trace? Do you think that the exclusive lock being held by session 548 in the first line is on rows in cxml_foldercontent (due to the ON DELETE SET NULL on these child rows) or rows in the cxml_structureddata that it's actually deleting?
    Is there any way for me to tell for certain?
    The first enqueue is a TX (Transaction Enqueue) held by session 548 on mode X (exclusive). This session represents the blocking session. At the same time the locked row is waited on by the blocked session (542) and the wait is on mode X (exclusive). So put it simply, we have here session 542 waiting for session 548 to release it lock (may be by commiting/roll backing). At this step we are not in presence of a deadlock.
    The second line of the deadlock graph shows that session 542 is the blocking session and it is doing a TM enqueue (DML lock) held on SX(Shared eXclusive). While session 548(which is the waiting session) is blocked by session 542 and is waiting on SSX mode.
    Here we see that 548 is blocking session 542 via a TX enqueue and session 542 is blocking session 548 via a TM enqueue ---> That is the deadlock. Oracle will then immediately choose arbitrarlly a victim session (542 or 548) and kill its process letting the remaining session continuing its work.
    That is your situation explained here.Thanks, any idea why session 542 (the DELETE from cxml_structureddata) would be trying to upgrade it's lock to SSX? Is this lock mode required to update a child tables foreign key columns when using an ON DELETE SET NULL trigger? Having read more about SSX, I'm not sure I understand in what cases it's used. Is there a way for me to confirm with 100% certainty specifically which tables in the TM enqueue locks are being held on? Is session 548 definitely trying to acquire an SSX mode on my cxml_foldecontent table or could it be cxml_structureddata table?
    (a) Verify that all your FK are indexed (be carreful that the FK columns should be at the leading edge of the index)Thanks, we've done this already. When you say the "leading edge" you mean for a composite index? These indexes are all single column.
    (b) Verify the logic of the DML against cxml_foldercontentCan you be more specific? Any idea what I'm looking for?

  • What should be considered a basic question here?

    Hey folks I want some feedback on why type of questions we should consider basic in this forum?  I have noticed in the last several weeks the questions here appear to be easily answered from wiki articles or the new book on the SAP Webclient programming.
    Instead of me however throwing down the moderator axe, I want the community to decide the type of questions that should be locked or moved to a "basic questions" forum.
    Given that the CRM Webclient is now a relatively mature product and the available materials to learn have increased, this should be fair request.
    In order to ensure that you respond I'm going to give my thoughts on what should not be allowed
    - Any topic covered in detail in the CRM wiki page here unless you need a clarification is subject for lock
    http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUIFramework
    or
    http://wiki.sdn.sap.com/wiki/display/CRM/CustomerRelationshipManagement
    Especially questions on how to add a new field, EEWB, AET, or dropdown boxes
    - Any topic asking for definition of terms is subject for a lock(i.e something that can be answered via help.sap.com)
    - If has already been answered before, then I would propose the following:
    1) Post the link in the thread
    2) OP responds whether that solved the issue
    3) Thread is locked from further discussion and awarding (to avoid rward hunting)
    Based on your feedback my goal is to implement the "stricter moderation" post Teched Las Vegas or around October 1st, 2011.  I would expect further changes to moderation style as SCN moves to a new platform and moderator tools are improved.
    Take care,
    Stephen
    CRM Forum Moderator

    Stephen,
    Basically queries like "How To xyz" which are already there on the WiKi should be moved to Basic Questions. These are the queries which are being raised by Consultants who are either new TO CRM or new to SDN or both.
    1. How to enhance a Web UI COmponent
    2. How to create a Drop Down
    3. How to create a F4 Help
    4. How to modify the Search Criteria.
    5. How to add a Attribute from AET/EEWB
    6. How to Create a Assignment block for a Z table.
    7. How to default values in Drop Down
    8. How to do dynamic navigation
    9. How to create Navigation Links for Navigation between 2 Components
    10.How to get business Partner ID from sy-uname
    11. How to Value node.
    12. How to create a BOL
    13. How to create a Pop Up View
    14. How to get values from Pop up view to the calling View.
    I guess these are few basic queries which are being asked N number of times and has been answered twice as many a times.
    Reading material and Tutorials are also sought by New CRM consultants which ideally should not be the case.
    Regards,
    Harshit Kumar

  • JDeveloper/OAS/Oracle - Basic Question

    Hi,
    I have a very basic question. I want to write a simple application using JDeveloper 3.0, OAS 4.0.8.0 and Oracle 8i as the database. The functionality of the application will be to simply display all the rows from a particular Oracle table on a front-end screen.
    Can anyone suggest which would be the best architecture to adopt. Should I use EJBs, or applets or .
    There are no examples (samples) provided with the documentation that illustrate simple applications like the one I am trying to build.
    It will be great is someone could illustrate (step-by-step) what I should use to paint my front-end screen, what I should use to write my SQL (to retrieve rows from the Oracle table) and how I should deploy all of this on OAS.
    Thanks in advance.
    null

    I guess my question was not framed correctly. I am new to JDeveloper and was trying to learn how to develop applications using the tool. I am also new to Internet programming in general so please bear with me. Coming from a old Client/Server school, I thought I would start learning JDeveloper by creating a "Client" using the many features of JDeveloper and then call a "Server" to do the database access. Now my question was the process to go about doing this. You have asked me whether I want to create an application or an applet. Well, the answer is that I frankly dont know. I want to be able to design (paint) a HTML page on which I want to be able to display rows from a Oracle table. Once I have managed to do this simple application I will start putting more complex functionality into that application to learn advanced features. Hope that helps.

  • Basic question - querying xmltype column

    Hi,
    Sorry for the basic question but please could someone paste in a working 'select where' statement which will pick out only those rows containing an element with specified content.
    For example, how would I return n complete XML documents as query results for a situation where 'element_1' has text content 'apples'?
    This does not seem to work:
    SELECT x.xml_body.extract('/root_element/element_1/text()').getStringVal()
    FROM xmltable x
    WHERE x.xml_body.extract('/root_element/element_1/text()').getStringVal()='apples'

    Hi Paul,
    The query you have given works. I tried that query in the following format and it works.
    Query 1:
    SELECT x.xmlcol.extract(/Employee/Name/text()').getStringVal()
    FROM table_name x
    WHERE x.xmlcol.extract('/Employee/Name/text()').getStringVal()='Anu'
    Query 2:
    SELECT extractvalue(x.xmlcol,'//Name/text()')
    FROM table_name x
    WHERE extractvalue(x.xmlcol,'//Name/text()')='Srini'
    Both the queries work. The xml is of the following format
    <Employee company="Oracle">
    <Name>Anu</Name>
    <Department>OTN</Department>
    <Location>India</Location>
    </Employee>
    Can you please tell the database version on which you are working?
    For more information on XMLType you can refer the XMLDB Samples located at
    http://otn.oracle.com/sample_code/tech/xml/xmldb/content.html
    You can also refer to the XMLType Sample present at this location
    http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/9i_jdbc/content.html#xmltype
    to know how to work with XMLType columns.
    You can get back to us if you have any more doubts.
    Regards,
    Anupama Majety

Maybe you are looking for

  • Photoshop CC 2014.2 release note ?

    Hi everyone ! I've updated Photoshop CC 2014 this morning to latest release, via Creative Cloud application, and It seems impossible to find the release notes for this new version. On the tooltip, there was a link to http://www.adobe.com/go/photoshop

  • Receiver determination in IDOC

    Hi Experts, For one scenarion of ALE IDOC , i need to determine the receiver system dynamically depending on a value of a segment field. Can you tell me what configuration is needed for this? I Appriciate your help. Regards, Ashish

  • How to create xml signature in oracle ERP 11.5.10

    Hi All, I've an requirement to sign the xml file and as per the specs http://www.w3.org/2000/09/xmldsig#. or canonicalization method (rsa-sha1)... Can anybody pls help how to do it in 11.5.10 ? DB version .. 11g (11.2.0.3.0) 64 bit JAVA version java

  • Ilife 11 upgrade registration

    Hi all, I got a disc to upgrade to ilife 11 under the Hardware uptodate programme and bought a right to copy onto 1 extra machine. I installed the upgrade on my imac with no issues. I installed from same disc on my MBP and it is fine but requires onl

  • How to record new clips in multitrack?

    In Audition CS5.5 on Windows, if I create a new multitrack files, the record button is greyed out. I can create a new .wav, record in it, save it, and add it to the multitrack, but that's a very inefficient process when doing voice takes. What I woul