Is there way to get lock holder by row id?

My problem is that sometimes some rows get locked for long time and I don't know who holds lock.
Ideally I want query which takes table_name and primary key value and outputs lock holder information. (e.g sql text, how long query is being running, etc)
I've found in documentation that there is no central place where row locks are stored and that this is row level metadata.
My question is: Can I get this row level metadata somehow for concrete row? (I believe this should be possible)
My usecase would be as follows:
1. try to get lock for row for id=#N (select for update semantics, actually hibernate is used for that but it shouldn't make difference here)
2. get error (now i'm getting ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired)
3. This step is what I want to add. Get information about lock holder for row with id=#N and write it into log file.
Here is query I was playing with which outputs general information about transactions having locks but it's not what I need in terms of row level locking:
select a.sql_text, l.ctime, s.STATUS, s.SQL_EXEC_START, s.PROGRAM from
v$lock l join v$session s on (l.sid = s.sid)
join v$sqlarea a on (a.hash_value = s.sql_hash_value)
where l.type='TX' and l.lmode>0;

Welcome to the forum!
Whenever you post provide your 4 digit Oracle version.
>
My problem is that sometimes some rows get locked for long time and I don't know who holds lock.
>
See this Oracle Magazine article.
http://www.oracle.com/technetwork/issue-archive/2012/12-jul/o42dba-1566567.html
>
You can find the specific row that is locked by first finding the table containing that row. To find that table, use the same V$SESSION view; in this case, the information is in the ROW_WAIT_OBJ# column, which shows the object number of the table whose row is being locked. You can then get the name of the table from the DBA_OBJECTS view, using this object number, as shown in Listing 3.
>
For 'who holds the lock' see this thread
How to check Locking sessions in oracle 10g
There are many other similar results on the net.

Similar Messages

  • Is there way to get read receipts in mail and do you get non deliverable notifications??

    is there way to get read receipts in mail and do you get non deliverable notifications??

    I'm a little fuzzy on your question.
    If you are trying to "Bounce" and email, I regret to inform you that Apple removed that feature a few years ago.  There are other email programs available that have this capability.

  • I live on a ship and have a slow connection. Is there way to get the content via CD?

    I live on a ship and have a slow internet connection. Is there a way to get the content via CD?

    You can still get it (DVD in this case) in some places -
    http://www.amazon.co.uk/Apple-MB795Z-A-Logic-Studio/dp/B002ISDD1K/ref=sr_1_3?ie= UTF8&qid=1340218920&sr=8-3

  • What is the best way to get a hold of Verizon to see if they sent my replacement phone?

    I'm hoping I didn't screw myself on this. But here is what happened, I lost my new iPhone 5c at Disneyland. I called the insurance part. They made me submit a claim affidavit and said they were going to send me a new phone overnight. But I haven't received it. And I have no way of calling verizon since I don't have a phone. What should I do, anyone?

        Dcontinolo,
    That is not the way to enjoy your vacation at Disneyland. One way to contact the insurance company is 888-881-2622. I know that you said that you did not have a phone so another way is by going to phoneclaim.com and checking the status of the phone. Please keep us posted.
    RobinD_VZW
    Follow us on twitter @VZWSupport

  • I accidentally deleted QuickTimeX. Are there ways to get it back?

    As mentioned above, I accidentally deleted QTX. I tried looking for it in the installation DVDs (SnowLeopard) but I only found QuickTime7.
    At the moment I have QT7 installed on my Mac. How could I get QTX back?

    Can I still take into consideration re-installing the entire OS?
    You can, but extracting just the QT Player app would be faster.
    I tried using Pacifist to extract the QT X Player but I can't find it.
    When the Pacifist list of extract items is displayed, check the following path...
    Contents of OSInstall.mkpg
       Contents of EssentialsSystemSoftware
          Contents of EssentialSystemsSoftwareGroup
             Contents of Essentials.pkg
                Applications
                   QuickTime Player.app
    I just performed a test extraction from my original Snow Leopard upgrade installer disc and had no problems using this path.

  • Is there way to get to desktop through mini-icon or set icon without closing all open screens with XP professional?

    I want to be able to go directly to desktop at times. Can a mini-icon be installed or is there a direct link already on the firefox screen?
    == This happened ==
    Every time Firefox opened

    1. Press Windows key+D
    2. You should have a "Show Desktop" icon in your Quick Lauch toolbar next to the "Start" button. Sometimes the "Show Desktop" icon goes missing according to some, but I have never experienced that.
    MS article here: http://support.microsoft.com/?kbid=190355

  • Best way to get DVD into Front Row?

    I have a some non-copyrighted DVD's that I would like to get into Front Row without losing the image quality.
    Any suggestions?

    I just found a used hi8 camcorder locally with a dv connection so would I be better off
    1)transferring 8mm cassettes into imovie as dv
    or
    2) transferring 8 mm cassettes to my standalone dvd recorder and then ripping them on mac, i have done this with one and takes about 2 hours to rip and encode however when dragging the mov file after dvd conversion into imovie I am getting a reading that it will take up to a day to import into imovie.
    I know doing dv to mac is easier then #2 but this will cost me money since I would have to buy this 8mm recorder with a dv connection, will there be a difference of quality.
    My goal in the end is to have these 15 home movies that are on 8mm tapes on an ext hd edited and as big as possible or good as possible in quality, then I would probably do more serious edits to them and save as smaller files for viewing either via front row or maybe even burning to dvds.
    Message was edited by: rwltrz4

  • Is there no way around activation lock

    I have recently bought a used ipad 2 and i went to reset it and after i deleted all the account on the ipad i then reset it and now its saying it has activation lock but there is no way of getting a hold of the owners why does apple not help with second time owners of there products not every one steals

    my thing is that before i reset it there was no icloud account no iTunes no accounts before i reset it to factory it still has the lock and the find my iphone was off when i talked to the apple rep they said it was on the persons itunes setting and you would have to be in there account to turn it off and that it would not be on the ipad it self so haow can any one check to see unless they reset all the apple product to were it deletes all the content before taking it witch would you want someone to delete all your content just to check one thing
    Yes, actually.
    Maybe you should read this: What to do before selling or giving away your iPhone, iPad, or iPod touch

  • How to get the number of rows in a DB-Cursor

    When i open a database cursor i do not know how much rows are stored in the cursor. To solve this problem i have to send a 'select count(1) ...' to get the number of rows before i set up the cursor. I think that this is not very clever and could possibly cause performance problems. But i need the num of rows to show the percentage of processed rows. Is there any other way to get the num of rows? May be by checking the cursor directly?
    Please help!
    Thanx a lot

    In order to find out how may rows are going to be processed, oracle has to visit every row. So with a cursor, there is no property that will accurately reflect the number of rows until you get to the last one. That said, you could use
    select count(*) over() as row_count, <rest of your columns> FROM <your table>
    which will give you the total row count agaist each row in the result set. There are performance penalties involved but they will be less than issuing the query twice, once to get the count and once to get the rows.
    Have a look on asktom for some very usefull info about all this.
    HTH

  • How to get the number of rows in a report region

    Hi all,
    Is there a way to get the number of rows returned in a report region, without issuing an additional "select count(*) from some_table"?
    I mean something like the substitution string #ROW_NUM# but for the total rows.
    Thanks,
    Pedro.

    http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/ui.htm#CHDDGGEG
    For classic report regions, the region footer supports the following substitution strings:#ROWS_FETCHED# shows the number of rows fetched by the Oracle Application Express reporting engine (the page size). You can use these substitution strings to display customized messages to the user. For example:
    Fetched #ROWS_FETCHED# rows in #TIMING# seconds.
    *#TOTAL_ROWS# displays the total number of rows that satisfy a SQL query used for a report.*
    #FIRST_ROW_FETCHED# and #LAST_ROW_FETCHED# display the range of rows displayed. For example:
    Row(s) #FIRST_ROW_FETCHED# through #LAST_ROW_FETCHED# of #ROWS_FETCHED# displayed>
    Ta,
    Trent

  • Getting iteration number in row level trigger

    Hi. Is there a way to get iteration number in row level trigger? Or to access data inserted in statement level trigger from row level trigger (statement level trigger are supposed to be executed before row level triggers but I cannot access them).
    I'm using Oracle 10g.

    My oracle version:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    And business problem is like this:
    I need to have two log tables for some tables in my database:
    First log table is a statement level log. After insert or update or delete it should get one new row with mentioning date, time, sid, query type and some additional information.
    Second table should include all columns from table logged, date, time, sid and operation type.
    The problem is, I need exact the same date and time for each row in both log tables.
    Someone said that sysdate should return same value for query execution time. But it have nothing to do with triggers fired on this query.
    So you may say that I'm curious about getting exact same date and time for one statement level trigger and for each execution of row level trigger.

  • Is there a way to get Num Lock?

    I know how to get Shift Lock but is there a way to get Num Lock? If I am entering numbers and press the space bar (ie in the notepad) the keyboard automatically goes back to letters.... If there is a Shift Loc then surely there is a Num lock somewhere!
    Cheers
    David

    Yes you can have a num lock on iPad.
    iPad Num Lock-ish - Press .?123 button enter numbers then SLIDE FINGER from right side ABC button across to space bar. This will input a space and leave you in Num Lock. I hope this helps. JJJ x

  • I recently deleted an email account from my phone because they were going to require me to always have password lock on ect. When I deleted it some of my notes in my notes app disappeared. Is there a way to get those back? Maybe by reinstalling that email

    I recently deleted an email account from my phone because they were going to require me to always have password lock on ect. When I deleted it some of my notes in my notes app disappeared. Is there a way to get those back? Maybe by reinstalling that email account?

    contact tech support at your company - they should have backups available and might be willing to help you
    LN

  • Is there any way to get hold of the NT username/loginID inside a JSP or servlet?

    Is there any way to get hold of the NT username/loginID inside a JSP or
              servlet? Any way to do this with Weblogic 6.0?
              Sincerely,
              - Oystein Saebo -
              

    Hmmm.. have a look at JAAS? It has a sample for NT authentication and/or
              authorization.
              Oystein Saebo wrote:
              > Is there any way to get hold of the NT username/loginID inside a JSP or
              > servlet? Any way to do this with Weblogic 6.0?
              >
              > Sincerely,
              >
              > - Oystein Saebo -
              

  • I bought my iPhone 4 locked from USA. I leave in Cyprus and i want to know if there is a way to get it unlocked. Could it be changed to an unlocked one with a fee paid to apple.

    I bought my iPhone 4 locked from USA. I leave in Cyprus and i want to know if there is a way to get it unlocked. Could it be changed to an unlocked one with a fee paid to apple.

    If you purchased the phone from a person, you need to find out which carrier they used and go to them to see if the will unlock it. If you purchased it from a carrier, give them a call to see what they will do.
    Just like atlantabrave said...Apple does not unlock phones.

Maybe you are looking for

  • VBscript - Enter a value (variable windows) on the path of downloading the installation file

    Hello All, My name is Diego and i need so much help with this VBscript, The script works well but I just need to call (SRV) windows System variable that contains the name of the local server. All client machines (winxp) already have a system variable

  • Protecting regions

    I am currently mixing 10 songs. Because logic lacks an easy way to apply global changes in a mix to a group of related songs, I have all of the tracks for all 10 songs loaded into a single logic "song" file. The songs appear in the arrange window con

  • Capacity Limit for work center

    Hi PP experts, Our client have a requirement to map the moulds used in their manufacturing process as a resource to plan the capacity. But they want to assignment of capacity limit to this resource. I.e. A mould can produce 1000 products. So 1000 is

  • Datasource Details Reqd..

    Hi, I have the following Transactions in R/3 Tran. Program Description MC47 RMCBBE30 INVCO: Analysis of Reqmt Values MC48 RMCBBW30 INVCO: Anal. of Current Stock Value MC50 RMCBBS30 INVCO: Analysis of Dead Stock The user used to save the output from t

  • How to create a element that contain a element generated in another document

    Hi,anybody. I want to create a element that contained a element generated in another document.The following is my coding: doc1 = new XMLDocument(); ele1 = (XMLElement)doc1.createElement("AAA"); doc2 = new XMLDocument(); ele2 = (XMLElement)doc2.create