How to build a lock escalation tree?

Hello!
Concurrent users lock many rows in different tables. Sometimes
one session waits to lock row, which is locked by another
session.
Locks are made by SQL statements.
I would like to present tree of SQL statements which lock (first
level) and as children SQL - statements waiting for release lock
by their parents.
It would be very helpul in finding dependencies and app places,
where deadlock can occur.
Do you know system SQL statement or tool, which could produce
result I need?
TIA,
Witek

I modified the script I posted earlier to include the waiters SQL
statement. You'll have to verify that this is what you're looking
for and that it's correct. I did some simple testing and it
seemed to work.
set term off;
set null ~;
set arraysize 10
drop table lock_holders;
drop table dba_locks_temp;
create table dba_locks_temp as select * from dba_locks;
create table lock_holders as
select w.session_id waiting_session,
h.session_id holding_session,
w.lock_type,
h.mode_held,
w.mode_requested,
w.lock_id1,
w.lock_id2,
a.sql_text sql_stmnt
from dba_locks_temp w, dba_locks_temp h, v$session s, v$sqltext
a
where h.blocking_others = 'Blocking'
and h.mode_held != 'None'
and h.mode_held != 'Null'
and w.mode_requested != 'None'
and w.lock_type = h.lock_type
and w.lock_id1 = h.lock_id1
and w.lock_id2 = h.lock_id2
and w.session_id=s.sid(+)
and s.sql_address = a.address
and s.status = 'ACTIVE'
and s.type !='BACKGROUND'
order by a.address
,a.piece;
commit;
drop table dba_locks_temp;
insert into lock_holders
select holding_session, null, 'None', null, null, null, null,
null
from lock_holders
minus
select waiting_session, null, 'None', null, null, null, null,
null
from lock_holders;
commit;
/* set charwidth 17; */
set wrap off;
set term on;
select substr(lpad(' ',3*(level-1)) ||
substr(waiting_session,1,10),1,20)
waiting_session, sql_stmnt
from lock_holders
connect by prior waiting_session = holding_session
start with holding_session is null;
set term off;
drop table lock_holders;
set wrap on;
set term on;
Here's the output it generated from a test I ran:
WAITING_SESSION SQL_STMNT
9 ~
11 update emp set acct_segment1='1111111',
acct_segment2='2222222',
11 acct_segment3='3333333',
acct_segment4='4444444', acct_segment5
11 ='5555555', acct_segment6='6666666' where
employee='AGLICK'
If you wanted you could also add username and osuser from
v$session to get the users Oracle userid and their network id.

Similar Messages

  • Cross system object lock -how to build up lock entries for existing request

    Hello,
    we implemented ChaRM for some years and  intend to activate cross system object lock (CSOL), now.
    But there are a lot of existing transport requests, which have not been imported to productive system, yet.
    It would be very helpful to create lock entries for objects, which are assigned to those transport requests.
    Does anyone know any standard report for this purpose?
    Thanks a lot for any hint.
    Best regards
    Horst

    If anyone else needs that feature:
    Report TMW_TRKORR_LOCK_UPDATE (executed in satellite system) will lock the objects of a transport request in solution manager system.

  • How to build query to get tree architecture of self referencing table

    Dear all,
    I have the following table design :
    This is a self referencing table representing a set of SubCategories which can have parent sub categories or not. I did not show here the Category table.
    If the Subcategory has the ParentSubCategory ID = null, then this is a root subcategory otherwise it is a child of a parent sub category.
    What I am looking for is the easy way to display the structure level by ProductCategoryID ?
    Thanks for helps

    you can use a recursive logic based on CTE for that
    something like this would be enough
    ;WITH ProdSubCat_Hiererchy
    AS
    SELECT psc.ProductSubCategoryID,c.CategoryName,psc.ParentSubCategoryID, psc.Name,CAST(psc.Name AS varchar(max)) AS [Path],1 AS [level]
    FROM ProductSubCategory psc
    INNER JOIN Category c
    ON c.CategoryID = psc.ProductCategoryID
    WHERE psc.ParentSubCategoryID IS NULL
    UNION ALL
    SELECT psc.ProductSubCategoryID,c.CategoryName,psc.ParentSubCategoryID, psc.Name,CAST(psch.[Path] + '/' + psc.Name AS varchar(max)) AS [Path],psch.[level] + 1
    FROM ProductSubCategory psc
    INNER JOIN Category c
    ON c.CategoryID = psc.ProductCategoryID
    INNER JOIN ProdSubCat_Hiererchy psch
    ON psch.ProductSubCategoryID = psc.ParentSubCategoryID
    SELECT *
    FROM ProdSubCat_Hiererchy
    ORDER BY LEFT([Path],CHARINDEX('/',[Path]+'/')-1),[Level]
    OPTION (MAXRECURSION 0)
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to build family tree using flex ?

    http://hgc46123.chinaw3.com/haha.jpg
    I want to build a panda family tree like  http://www.myheritage.com/
    for the data is large,so i want to use dynamic picture loading like google map.
    but i don't know lean what ?  i hava java programing experience
    please give me some advice .
    thank for your attention .

    or in the html file, add a timestamp to make the swf name unique each time you refresh the page
    main.swf?ts= new Date().getTime()

  • How can I freeze (lock) my Spread Sheet layout in Numbers?

    How can I freeze (lock) my Spread Sheet layout in Numbers?
    I have problems with Numbers changing my Spread Sheet layout
    by adding extra Rows while I am not looking, or while I engage in dragging its pages with the mouse to see info on adjacent pages.
    The layout I use consists of a Spread Sheet containing 4 "print" pages, ea.  8.5" x 11" wide, with a total of 36 Rows and 28 Columns. 
    The SS is filled with new cell values daily, but the formulas stay mostly the same. The print pages are visible on the computer screen side by side, and each Row extends over these 4 pages.
    It happens sometimes that I have to change a formula while making entries on a cell in "page 4", and then need to "accept"
    the new entry and formula "aaalll" the way on the very left of "page 1".  So here I try to scroll left or drag the present view
    with the mouse.  I also have to use the "Zoom" at 150 % because I cannot see well on my MacBook Air, everything is rather small.
    I suspect that during dragging with the mouse I drag cells or rows without knowing, and that this will add extra Rows derailing some formulas or values because a cell is suddenly in a different Row.
    It is difficult to find which Row was added and what values where thus changed.  One just sees 38 rows instead of the orihinal 36!  The only way is to move all the cell values out of rows 37 and 38, and find where theey used to be on the previous day's saved locked sheet.   Needless to say that when that happens twice in a days work, it means a lot of lost time.
    I have checked the Numbers Manual and searched Help Info for ways to lock an established cell layout and could noy find anything.
    I cannot believe it, maybe I missed something.  I worked for about 35 years with Clarisworks and Appleworks Spread Sheets and never had the same problem, layouts were locked by design, and could only be changed by special procedures.
    Now is there a way to freeze or lock the basic layout of a spread sheet in Numbers? 
    I appreciate your help.   (Numbers 2.3, Mac OS 10.8.5. MacBook Air)

    Hi Numbers22,
    I guess I was just beating around the bush to avoid simply saying, "No, you cannot lock the layout." So there it is.
    I am not sure why you are scrolling  to "accept" a formula. That is unclear. I guess you building a new formula and need to use a cell from an early column. It is also unclear to me as ot how you are actually adding extra rows. I haven't been able to do it on my machine without clicking the little arrow in the row number or using Option-↑ (or -↓). Option-↑  would add a row above the row you are in if they somehow got pressed. Do you have a program running that could be interpreting something your are doing for those keystrokes? If I was standing at your shoulder I might be able to see what is doing it.
    What I am suggesting is that you play around with your trackpad settings so that you are not selecting and tapping in your table while you attempt to scroll. I do have one sheet with two tables side by side with a total of 425 columns and I can scroll past them without modifying them. So perhaps turning off tap to click in system preferences will help. If you have an option to decrease trackpad sensitivity then try that (I don't, but I remember having it somewhere in the past). If you are using a mouse see what you can do to decrease the sensitivity for a click. If your computer is old it could be that the trackpad is wearing out and throwing random clicks. You might try using another input device if you have one.
    quinn

  • How to build a screen with master detail data

    Hi ,expert ,
    Someone can teach me how to build a screen with master detail table ?
    I wnat to build a screen for user to maintain FERT group  and  FERT detail list  in one screen .
    just like this ..
    MASTER Block
    FERT1      
    FERT2 
    FERT3
    DETAIL Block
    FERT1A1
    FERT1A2
    FERT1A3
    when I double click FERT1 in the Master Block the detail view will show FERT1A1  A2 A3
    Thanks for your help ....
    Moderator message : Not enough research before posting. Spec dumping not allowed. Thread locked.
    Edited by: Vinod Kumar on Jun 13, 2011 1:38 PM

    An inefficient way to create the array is to use the build array and a shift register as shown below. It's more effecient in terms of memory management to create the array and then use the replace array subset as shown in the other image. Of course, if you don't need the array inside the loop, just wire the value out of the while loop and on the exit tunnel, right click and select 'Enable Indexing'.
    Message Edited by Dennis Knutson on 07-03-2007 10:25 PM
    Message Edited by Dennis Knutson on 07-03-2007 10:26 PM
    Attachments:
    Crude Build Array.PNG ‏4 KB
    Better Build Array.PNG ‏6 KB

  • How to clear a lock

    Database has a lock that is preventing users from using it. How do I clear this lock?

    Have Adam's great stored procedure to see who/how/by whom is locked
    Who Is Active? v10.00 (2010-10-21)
    (C) 2007-2010, Adam Machanic
    Feedback: mailto:[email protected]
    Updates: http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx
    "Beta" Builds: http://sqlblog.com/files/folders/beta/tags/who+is+active/default.aspx
    License: 
    Who is Active? is free to download and use for personal, educational, and internal 
    corporate purposes, provided that this header is preserved. Redistribution or sale 
    of Who is Active?, in whole or in part, is prohibited without the author's express 
    written consent.
    Usage
    /*BLOCKING*/
    EXEC dbo.sp_WhoIsActive @find_block_leaders =1,
    @output_column_list ='[blocked_session_count][blocking_session_id][session_id][CPU][status][wait_info]
                          [database_name][sql_text][host_name][open_tran_count]',
    @sort_order='[blocked_session_count]DESC'
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Lock Escalation settings

    Hi All,
    In one of my production server Deadlock issue happened, for that issue we are planning to change lock escalation  to table.
    Will it make any impact to other tables or objects in database apart from a single table.
    Please suggest anyone it would be great helpful for me.
    Thanks in Advance...

    Hi Srinivas,
    Below is snippet from
    Paul's Article
    In SQL Server 2005 (and 2008) you can change the behavior of lock escalation (if you really know what you're doing) using these trace flags:
    1211 – disables lock escalation totally and will allow lock memory to grow to 60% of dynamically allocated memory (non-AWE memory for 32-bit and regullar memory for 64-bit) and will then further locking will fail with an out-of-memory
    error
    1224 – disables lock escalation until 40% of memory is used and then re-enables escalation
    1211 takes precedence over 1224 if they're both set – so be doubly careful. You can find more info on these trace flags in
    Books Online.
    In SQL Server 2008, you can change the behavior of lock escalation per table using the
    ALTER TABLE blah SET (LOCK_ESCALATION = XXX) where XXX is one of:
    TABLE: always escalate directly to a table lock.
    AUTO: if the table is partitioned, escalate to a partition-level lock, but then don't escalate any further.
    DISABLE: disable lock escalation. This doesn't disable table locks – as the
    Books Online entry says, a table lock may be required under some circumstances,
    like a table scan of a heap under the SERIALIZABLE isolation level.
    If you are changing lock escalation for particular table using alter table set lock escalation command it will change behavior for that table only
    You should also read How to determine blocking is caused by Lock escalation
    If you have partitioned tables please read
    partition Level Lock escalation
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • How do you clear out a tree control?

    I am editing items in a tree control, when the editing is complete, I re-build the tree to represent what I have after the edit.  My process of deleting the items one-by-one has worked fine until the tree scrolled off the top, then, when I select the top-left item and delete everything under it, I miss the ones that have scrolled off the top.
    What's the method/property I should use to clean out a tree in one operation?  (before rebuilding)
       ...Dan

      Tray Drool!
    Originally I had, "How do you clear out a tree?".  That's why I added "control".

  • How to build a Oracle style Web site

    Dear All,
    (Not sure whether this question should be this sub-site or not.)
    My question is how to build a Oracle style Web site, what technology should be use.
    Example Site: [http://www.orapub.net/ebs/index.htm|http://www.orapub.net/ebs/index.htm]
    This web site style is like Oracle Enterprise Manager.
    Thanks a lot
    Pan

    You can use Oracle Webcenter or just Oracle ADF to build a Oracle Enterprise Manager kind of Website.
    See details here -
    http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/ria_application/developriaapplication_long.htm
    http://www.youtube.com/watch?v=iE2zTNhlvy8

  • How can I make a palm tree sway?

    How can I make a palm tree sway?
    I have a palm tree that is a tiff file with alpha. I would like the tree trunk to bend a little and a few of the branches to sway as though it’s gently moving in the wind.
    What would be the easiest way to make that happen?
    Should I save the trunk and a few leaves as separate elements, and then animate them in motion.
    Or is there any way to turn my palm tree into a shape in motion, add edit points and key frames to animate it?
    Any advice would be appreciated.
    Thanks

    Down and dirty: highlight the tree's layer, move the anchor point to the base of the tree, add an Oscillate Behaviour to its Shear X axis. Adjust the Amplitude to 5, Speed to 7 or so, depending on how breezy the day is.

  • How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000

    Post Author: ltkin
    CA Forum: WebIntelligence Reporting
    Hi,
    How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000 ?
    Regards,

    Hi ltkin,
    Unfortunately, it is not possible in Xir2 to create Webi reports from stored procedures.
    Webi reports can only be created from Universe. So in Business Objects XIR3 we can create a special universe that enables Web Intelligence user's to access stored procedures residing in the database. This is the only way that Web Intelligence user's can access stored procedures.
    Please let me know if the above information helps.
    Regards,
    Pavan

  • I have just started to use Muse for our design agency and learning how to build ourselves a new site, I have manged to create a basic lightbox which contains sliding images, what I need to do now is have a pop up window which goes into detail about the pr

    I have just started to use Muse for our design agency and learning how to build ourselves a new site, I have managed to create a basic lightbox which contains sliding images, what I need to do now is have a pop up window which goes into detail about the projects, what I would like is a piece of text  or icon that when you roll over it and then click a separate window pops up with additional information in, once finished reading the info you can then click to close the box, any advice on how to do this?

    The best way to do what you're asking is with the Composition widget. Start with the Tooltip preset, which, by default shows the info on rollover. You can change the option to show on click, which is what you're after. You can also add the close button or have the info disappear on rollout.
    David

  • How to build the  FM data I_header and I_orgdata

    hi all,
    I’m working on the conversion program for AVL using the following function modules
    BBP_PD_AVL_GETLIST
    BBP_PD_AVL_CREATE
    BBP_PD_AVL_UPDATE
    BBP_PD_AVL_SAVE
    In the function module BBP_PD_AVL_CREATE , how to build the FM data  I_HEADER and I_ORGDATA.
    I'm giving 3 input in Export parameter in BBP_PD_AVL_GETLIST  and E_pdlist should contain data .
    but e_pdlist is not getting data...any suggestion..
    after execution it was showing  "Buffer table is not up to date"
    with regards,
    P.lokesh

    Hi Lokesh,
    We are also encountering same problem.
    How did you solve your problem?
    Would really appreciate your help.
    Thanks,
    Kezia

  • How to get each node in tree?

    how to get each node in tree?
    Message was edited by:
    NikisinProblem

    how to get each node in tree?
    Since (as far as I know) treeNode is an interface, the real question to me is how are you implementing your treeNodes? Are you overriding the toString() method?

Maybe you are looking for

  • My Account was hacked, Support is not helpful

    Today my account has been hacked. As I can see my case is similar to others but Skype support mostly ignores these issues. The scenario is following: 1) hacker gets password from skype account  2) password is changed 3) primary e-mail for that skype

  • End of me rope

    Hi all. Sorry to start my first post with a question. But I've just about had enough of BT and their couldn't care less attitude to a looong ongoing issue with slow infinity speeds. Top date I have had one engineer call. 6 conversations with an overs

  • Using an IN Clause in a Stored Procedure

    Hello All: I have come to the conclusion that my stored procedure is having a problem with the use of an IN clause using a parameterized query. I have in my Stored Procedure the following: AND oh.status_flag IN (p_OrderStatus) The p_OrderStatus will

  • Value Type and Report Type in Report Painter Report

    Is there a way I can get both characteristics WRTPP and RRCTY in one table? Or, can I work with two different tables in creating Report Painter report? I need to get the planned values of cost elements with record type 1 and value type 10 to show und

  • I've recently moved my iphoto library to an external hard drive...

    The external hard drive I'm using is wireless, and while all the events are there, some of the photos don't display at all (see attached image). Help or ideas please?