ORA-01940: Unable to delete the currently linked user)

Source: Internet
Author: User

(1) view the user's connection status

Select username, Sid, serial # from V $ session

------------------------------------------

Result:

Username Sid serial #

----------------------------------------

Netbnew 513 22974
Netbnew 514 18183
Netbnew 516 21573
Netbnew 531 9
Wuzhq 532 4562

(2) locate the SID, serial, and delete the user to be deleted.

-------------------------------------------

For example, if you want to delete the user 'wuzhq', you can do this:

Alter system kill session '2017 2'

(3) Delete a user

--------------------------------------------

Drop User Username Cascade

(**) If you still prompt ORA-01940 after drop: Unable to delete the user that is currently linked, there is a connected session, you can check the session status to check whether the session is killed. Use the following statement to check the status:

-------------------------------------

Select saddr, Sid, serial #, paddr, username, status from V $ session where username is not null

The result is as follows (taking my database as an example ):

Saddr Sid serial # paddr username status

Bytes --------------------------------------------------------------------------------------------------------

564a1e28 513 22974 569638f4 netbnew active
564a30dc 514 18183 running 688cc netbnew inactive
564a5644 516 21573 56963340 netbnew inactive
564b6ed0 531 9 49262d8c netbnew inactive
564b8184 532 4562 56a1075c wuzhq killed

Status indicates the session Status of the user to be deleted. If the session status is inactive, the user is not killed. If the session status is killed, the user is killed.

It can be seen that the session of the user wuzhq has been killed. Users can be safely deleted.

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.