How to unlock Oracle in a database

Source: Internet
Author: User
Welcome to the Oracle community forum and interact with 2 million technical staff. Here we will introduce how to unlock Oracle. After being locked, we can also use some tools to unlock it. Let's take a look at how Oracle can be unlocked. When we operate the database, sometimes the database table is locked due to improper operations.

Welcome to the Oracle community forum and interact with 2 million technical staff> here we will introduce how to unlock Oracle. After being locked, we can also use some tools to unlock it. Let's take a look at how Oracle can be unlocked. When we operate the database, sometimes the database table is locked due to improper operations.

Welcome to the Oracle community forum and interact with 2 million technical staff> enter

Here we will introduce how to unlock Oracle. After being locked, we can also use some tools to unlock it. Let's take a look at how Oracle can be unlocked.

During database operations, database tables are sometimes locked due to improper operations, so we often do not know how to unlock Oracle or how to unlock these tables, the "sessions" in the menu "tools" of pl/SQL Developer can query existing sessions, but it is difficult to find that session is locked, it is more difficult to find the locked session. The following is a query statement that can query the locked session. As follows:

1. SELECT sn. username, m. SID, sn. SERIAL #, m. TYPE,

2. DECODE (m. lmode,

3. 0, \ 'None \',

4. 1, \ 'null \',

5. 2, \ 'row Share \',

6. 3, \ 'row Excl .\',

7. 4, \ 'share \',

8. 5, \'s/Row Excl .\',

9. 6, \ 'exclusive \',

10. lmode, LTRIM (TO_CHAR (lmode, \ '2017 \'))

11.) lmode,

12. DECODE (m. request,

13. 0, \ 'None \',

14. 1, \ 'null \',

15. 2, \ 'row Share \',

16. 3, \ 'row Excl .\',

17. 4, \ 'share \',

18. 5, \'s/Row Excl .\',

19. 6, \ 'exclusive \',

20. request, LTRIM (TO_CHAR (m. request, \ '2017 \'))

21.) request,

22. m. id1, m. id2

23. FROM v $ session sn, v $ lock m

24. WHERE (sn. SID = m. sid and m. request! = 0) -- the lock request is blocked.

25. OR (sn. SID = m. SID -- no lock request exists, but the locked object is locked by other session requests

26. AND m. request = 0

27. AND lmode! = 4

28. AND (id1, id2) IN (

29. SELECT s. id1, s. id2

30. FROM v $ lock s

31. WHERE request! = 0 AND s. id1 = m. id1

32. AND s. id2 = m. id2)

33 .)

34. order by id1, id2, m. request;

If you know sid and SERIAL # Through the above query, you can use it.

1. alter system kill session \ 'sid, SERIAL #\';

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.