How to find exactly who lock the records

hi:
Session1: lock a record for example
Select e.* from employees e where e.employee_id = 7034 for update;
Session2: try to lock the same record:
Select e.* from employees e where e.employee_id = 7034 for update nowait;
After exception ora-00054 raised query this statement:
Select Vs.Sid,
Vs.Client_Identifier,
Vs.Action,
Vs.Status,
Vs.Machine,
Vs.Terminal,
Vs.Logon_Time,
Dmlock.Name
From Dba_Dml_Locks Dmlock,
V$session Vs
Where Dmlock.Session_Id = Vs.Sid
And Vs.Sid =
(Select Distinct First_Value(Ash.Blocking_Session) Over(Order By Ash.Sample_Time Desc)
From Sys.v_$active_Session_History Ash
Where Ash.Session_Id = Sys_Context('USERENV', 'SID'))

session #1
21:28:14 SQL> Select e.* from employees e where e.employee_id = 206 for update;
EMPLOYEE_ID FIRST_NAME           LAST_NAME
EMAIL                     PHONE_NUMBER         HIRE_DATE JOB_ID         SALARY
COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
        206 William              Gietz
WGIETZ                    515.123.8181         07-JUN-94 AC_ACCOUNT       8300
                      205           110
21:28:39 SQL> session #2
SQL> set time on
21:29:25 SQL>  Select e.* from employees e where e.employee_id = 206 for update nowait;
Select e.* from employees e where e.employee_id = 206 for update nowait
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
21:29:51 SQL> session #3
21:30:18 SQL> SELECT Vs.sid,
       Vs.client_identifier,
       Vs.action,
       Vs.status,
       Vs.machine,
       Vs.terminal,
       Vs.logon_time,
       Dmlock.name
FROM   dba_dml_locks Dmlock,
       v$session Vs
WHERE  Dmlock.session_id = Vs.sid
       AND Vs.sid = (SELECT DISTINCT First_value(Ash.blocking_session)
                                       over(
                                         ORDER BY Ash.sample_time DESC)
                     FROM   sys.v_$active_session_history Ash
                     WHERE  Ash.session_id = Sys_context('USERENV', 'SID')) 21:30:44   2  21:30:44   3  21:30:44   4  21:30:44   5  21:30:44   6  21:30:44   7  21:30:44   8  21:30:44   9  21:30:44  10  21:30:44  11  21:30:44  12  21:30:44  13  21:30:44  14  21:30:44  15  21:30:44  16 
21:30:46  17  /
no rows selected
21:30:49 SQL> Your results are duly UNDERWHELMING!

Similar Messages

  • How to find out, who locked the same row

    Dears,
    I have a problem,
    sometimes our user complain that, when he tyring to make a transaction to a specific customer's Account
    its says 'Some other user access the same account, keep trying...' (like this).
    and in this response I just kill that user's session. then he can make the transaction by reconnecting.
    sometimes my solution(killing the session) can not slove this problem.it stayed even 5/6 hours long.
    in this time,i cannot find any bloking session or such a long waiting session.
    In this Scenario..
    I need to find out who(SID,SERIAL#,USERNAME) locked the same ROW (not table).
    There are many users who are locking different rows of the same table at the
    same time. I need to find the one who locked my row.
    is it possible to find out, who locked the specific customer's Account ?
    I am trying to find out by the following query but failed.
    SELECT s.SID, serial#, machine, osuser, terminal, b.object_name,
    row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#,
    DBMS_ROWID.rowid_create (1,
    row_wait_obj#,
    row_wait_file#,
    row_wait_block#,
    row_wait_row#
    ) rowidd
    FROM v$session s, dba_objects b
    WHERE s.row_wait_obj# = b.object_id
    SELECT *
    FROM (SELECT s.SID, serial#, machine, osuser, terminal, b.object_name,
    row_wait_obj#, row_wait_file#, row_wait_block#, row_wait_row#,
    DBMS_ROWID.rowid_create (1,
    row_wait_obj#,
    row_wait_file#,
    row_wait_block#,
    row_wait_row#
    ) rowidd
    FROM v$session s, dba_objects b
    WHERE s.row_wait_obj# = b.object_id)
    WHERE rowidd IN (SELECT ROWID
    FROM account_mas
    WHERE branch = '999' AND accout_no = '009990215454')
    please help me...
    My Database version- 10.2.0.4, windows
    Regards
    Halim
    Edited by: Abdul Halim on Oct 26, 2009 2:43 AM

    Just check with this query, find the lock and kill the session.
    select b.session_id ,a.SERIAL#, a.username "Blocker Details"
    from v$session a,dba_lock b
    where b.session_id = a.sid
    and b.blocking_others = 'Blocking';
    Regards
    Asif kabir

  • How to find out who deleted the central person ID of a pernr.

    Hi,
    I have a pernr 100 whose central person ID is deleted. I would like to know how can i find out who deleted it. Which table gives this information.
    Thanks & Regards,
    Soumya.

    It is stored as a relationship in HRP1001 & unless you have table logging turned on for this db table, I don't think you will be able to find out who deleted the Central Person. You can try running the Report RHCDOC_DISPLAY .
    ~Suresh

  • How to find user who loaded the procs in DB

    Hi guys how to find user who loaded procs in database ..and the date...
    is there anyway..
    i tried to look at all_objects..but it didnot workout..
    thanks

    That is correct. You will only have audit rows for item that you are auditing. I am suggesting you audit all DDL in a production database since production jobs should not perform DDL with the probable exception of truncate. This will provide this type of information going forward. It will not help you answer the question of who created the procedure last week?
    Auditing is explained in the Security manual and the full comand syntax is available in the SQL manual.
    You can easily write a purge the audit data to remove data once it is no longer of interest based on the date the audit row was created.
    HTH -- Mark D Powell --

  • How to find out who deleted the standard table enteries

    Hi,
    Somebody has deleted entire KNA1 in one of our systems. Is there any way to find out who deleted the entries?
    Thanks & Regards,
    Kumaran Duraiswamy.

    Hi
    Look for help from an ABAPer. Go to SE11 for KNA1, use 'where-used list (ctrlshiftF3) and search for report that begin with Z* or Y* (perhaps LZ* or LY*, ie: function modules). See the ABAP coding if there is any instructions type:
      DELETE kna1 FROM xxx.
    Check too if the option &SAP_EDIT in tcode SE16N works in your system (see SAP Note 1420281 - CO-OM tools: SE16N: Deactivating &SAP_EDIT for instance)
    I hope this helps you
    Regards
    Eduardo
    PD: I forgot it, if option &SAP_EDIT works in SE16N, check the tables SE16N_CD_DATA and SE16N_CD_KEY.
    Edited by: E_Hinojosa on Jun 24, 2011 11:04 AM

  • FM to find user who locked the object using enqueue...

    Hello,
    How can I find name of user who enqueued the lock object in ABAP ?
    Regards,
    Jainam.

    Hi Jainam,
    See the SAP documentation, e.g. [FAQ - Lock concepts|http://help.sap.com/saphelp_NW04/helpdata/en/cb/168237d30d974be10000009b38f8cf/content.htm]:
    How can I find out who is currently holding the ungranted lock? In other words, how can check the program after an ENQUEUE to determine which use is currently holding the lock so that I can let him or her know?                                 
    This graphic is explained in the accompanying text Answer
    When the ENQUEUE_... function module is returned, the name of the lock owner is listed in SY-MSGV1.
    If you don't want to attempt to lock an object and just check who might own a lock use function module ENQUEUE_READ. Lots of comments in the forum...
    Cheers, harald

  • How to find approvers who approved the shopping cart

    Hi All,
      My requirement is as follows:
      If I give the shopping cart document id, I should be able to find
      1) the list of approvers who approved the document
      2) how much time they have taken to approve the document
      3) any pending approvals for the document.
    Can anyone help me in this?
    Thanks,
    Sivagami R

    Hi..
       Here is technical details which will help if you are in SRM 7.0..
       The below methods are in the class /SAPSRM/CL_WF_EVENT_FACADE
       Pass the SC GUID to method 'GET_WORKFLOW_ID_BY_DOCUMENT'  .. get the header workitem id.
       1 . to get the current approvers list call the method GET_CURRENT_AGENTS..
       2.  to get the previous approvers list call the method GET_PREVIOUS_AGENTS.
      if you are in SRM 5.0 then use the below FM's..
    1 . call the FM BBP_PDH_WFL_WI_FROM_OBJECT_GETu2019 to get the header workitem id..
    2 . call the FM u2018BBP_WFL_DIN_APPR_FINALLIST_GETu2019  to get the list approver's for a SC
    3 . if you need the workitem details then call FM BBP_PDH_WFL_WI_DETAILS_GETu2019..
    Regards,
    Saravanan

  • How to find out who deleted the directory in Unix

    Hi Experts,
    In my system some body tampered the directories, and more over some body deleted the bin directory under the /usr/sap/trans in Unix operating system. now i am checking to find out who deleted and for the more logs.
    i am unable to find out the user name and deleted directory logs..i know its completely related to the unix level but mean time i am searching for the same.
    Any ideas and clues will be heighly appreciated.
    -Srini

    To know the OS would have been helpful
    First ask the people around you if anybody did it, maybe he is man enough to admit...
    Try to find out who logged at the time when the directory was deleted.
    - check the OS syslog (/var/adm/syslog/syslog.log for hp-ux, /var/log/messages for linux)
    - try the last commando to get a list of who logged on when
    - check the command histories of the sidadm, root user, use the history command, or the h alias
    - check if there are scripts running, which regularly delete files
    As the trans directory might be NFS mounted to other servers, you might need to do the checks there too.
    Best regards, Michael

  • How to find out the user who locked the record

    i can't delete a particular record from a table while executing the delete command its showing an error specifying
    that "ORA-02049: timeout: distributed transaction waiting for lock"
    syntax i used
    delete from <table_name> where <column_name>='<value>'

    Hi,
    select username,lockwait,process,sql_hash_value from v$session. Find the user who is having more lock wait
    See the lock wait has more value notedown has_value
    select sql_text from v$sqltext where has_value="Noted value " find the query whether your table is calling by the user.

  • How to find out who deleted the archive logs

    Hi All,
    Recently some archive logs were deleted from one of our servers. Is there any way to find out which user has deleted the archive logs through OS or through database ?
    OS Version :-
    SunOS Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise
    Database Version:-
    SQL*Plus: Release 9.2.0.8.0 - Production on Mon Apr 9 01:12:15 2012

    888132 wrote:
    Hi All,
    Recently some archive logs were deleted from one of our servers. Is there any way to find out which user has deleted the archive logs through OS or through database ?
    OS Version :-
    SunOS Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise
    Database Version:-
    SQL*Plus: Release 9.2.0.8.0 - Production on Mon Apr 9 01:12:15 2012As explained by others, from oracle database there is no record if they are deleted from OS.
    But you can probably find the history of OS command been run with history command :). You can get the date and time.
    Following link can help
    http://stackoverflow.com/questions/99755/how-do-i-get-the-command-buffer-in-solaris-10
    http://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/
    http://www.linuxquestions.org/questions/solaris-opensolaris-20/in-solaris-command-line-how-to-get-the-previous-commands-573814/
    But i suggest you to post in Sun OS forum to get more details as its nothing to do with Database(in this scenario)

  • How to find out who was the previous owner of an iPad?

    My sister has recently found an iPad 1 WiFi on a bus. To determine the actual owner she had a friend to reset the iPad to factory settings (not sure why though) and now all initial data is lost. Apple Store could not help much, as the iPad was sold by a 3rd party retailer.
    Does anybody know how to determine the previous owner (Apple ID, Device name or other) after a full reset? Would Apple be able to disclose previous Apple ID associated with the device?

    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    Best advice - Turn it in to the local police. Usually if no one claims it after a period of time, it will be yours. And your concious will be clear.
     Cheers, Tom

  • How to find out who made the entry or made changes to a documents?

    Dear All,
    As an administrator I mostly get the query as to made the entry in SAP Business One or who has made changes to the already created documents?
    Can you please advice

    Hi,
    Check this first: Query For Sales Order Amendments
    Thanks,
    Gordon

  • How to find which process locked the directory

    I have a folder with some TFS-projects. So now i want to rename or move my directory, it says that "the action can't be completed because
    thefolder or a file in
    it is open in another program". So i downloaded "Process Explorer", ctrl+f, entered directory name, but it found nothing. I
    thought that files used are presented by full names, eg C:\SomeDir\SmthElse\...

    Hi,
    You can check with:
    1. MMC - Shared Folders (if it is a shared folder). Here you could check Open Files to see if files are locked by other users with opening a file in your folder. You can kill the session to unlock a file.
    2. Download this tool:
    http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx
    Handle.exe could help check locking session on your computer. See if your file in that folder is listed and use -c to close the handle.
    If you have any feedback on our support, please send to [email protected]

  • HT201441 i just bough a used iphone but looks that it was found and i cant unlock it. its still link to the last user my question is how do i find out who is the last owner so i can unlock it

    i just bough a used iphone but looks that it was found and i cant unlock it. its still link to the last user my question is how do i find out who is the last owner so i can unlock it

    peeweenborre wrote:
    i just bough a used iphone .... its still link to the last user ...
    If you cannot get this information from the seller
    Removing a device from a previous owner’s account
    You need to return the Device for a refund,

  • How to find out what is the lock key for the computer

    How to find out what is the lock key for the computer?

    You don't.
    If you forgot or lost the password, all you can practically do is reset it.
    The manner in which you do so depends on what version of OS X you are running. The older versions utilize the reset password utility on your recovery/re-installation disk/drive.
    On Lion, you use the following technique to reset the Administrators password:
    Boot to your Lion Recovery Partition, by holding down the Option key while starting, and then selecting the Recovery HD as the boot choice.
    Once booted, at the top of the screen is a menu ..., select Utilities / Terminal from the menu bar.
    In the Terminal window, type “resetpassword” (without the quotes) and press return. A “Reset Password” window will open. Select your boot volume (your SSD drive) if it is not already selected. Select your administrators username from the menu labeled “Select the user account” if it is not already selected. Follow the prompts to reset the password. Restart the computer from the apple menu.

Maybe you are looking for

  • In&nline in Portal

    Hi, I facing issue in portal text.When there is space between first line and second line,in portal it is showing me in&nline. Can anyone help me how to solve this issue? Thanks, Usha

  • App-V 5.0: Adding Visio 2013 and Project 2013 to a previously deployed virtual Office 2013

    Good morning. I can successfully deploy Office 2013 via PowerShell and App-V v5.0 without difficulty.  I've read the document at http://support.microsoft.com/kb/2915745/en-us and followed all instructions successfully. My question is this:  If Office

  • Canon iP2700 is no longer working after update

    My Canon iP2700 is no longer working after doing an update yesterday. I am using the cnijfilter-ip2700series 3.30-2  from  https://aur.archlinux.org/packages.php?ID=41797 with cups 1.5.2. I have blacklisted usblp, but this doesn't help. My printer is

  • Home button on iPad2 no longer works after iOS 7 upgrade

    I upgraded my iPad2 to iOS 7 today.  The home button no longer works.  I've powered it down and back up as well as restarted it but it's still not working.  Any suggestion greatly appreciated. About to fly to China and was looking forward to watching

  • Speckles on external Samsung Display when connected to my Macbook Pro

    When I connect my MacBook Pro to my Samsung SyncMaster 2693HM monitor via a mini display port DVI adapter, I get loads of speckles on the display. They vary in colour depending on the display colour and are driving me mad! Webcam video of this effect