How to view the Oracle database lock and unlock

Source: Internet
Author: User

How to view the Oracle database lock and unlock

  1. -- View database lock details
  2. SelectA. sid, B. serial #, B. username, B. oSUSEr, B. machine, B. program, c. object_name, d. spid,
  3. Decode (a. type,
  4. 'Mr','Media recovery',
  5. 'Rt','Redo thread',
  6. 'Non','User name',
  7. 'Tx','Transaction',
  8. 'TT','Dml',
  9. 'Ul','Pl/SQL user lock',
  10. 'Dx','Stributed xaction',
  11. 'Cf','Control file',
  12. 'Is','Instance status',
  13. 'Fs','File set',
  14. 'Ir','Instance recovery',
  15. 'St','Disk space transaction',
  16. 'Ts','Temp segment',
  17. 'Iv','Library cache invalida-tion',
  18. 'LS','Log start or switch',
  19. 'Rw','Row wait',
  20. 'Sq','Sequence number',
  21. 'Te','Extend table',
  22. 'TT','Temp table',
  23. 'Unknown') Locktype,
  24. Decode (a. lmode,
  25. 0,'None',
  26. 1,'Null',
  27. 2,'Row-S',
  28. 3,'Row-x',
  29. 4,'Share',
  30. 5,'S/row-x',
  31. 6,'Exclusion','Unknown') Lockmode
  32. FromV $ lock a, v $ session B, all_objects c, v $ process d
  33.  WhereA. sid = B. sid
  34. AndA. typeIn('TT','Tx')
  35. AndC. object_id = a. id1
  36. AndB. paddr = d. addr;
  37. -- Kill the process
  38. -- Alter system kill session 'sid, serial #';

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.