ORA-01940 cannot delete the currently connected 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           569688cc      Netbnew          
Inactive
564a5644           516         21573          56963340     Netbnew         Inactive
564b6ed0            531       9              56962d8c      Netbnew        
  Inactive
564b8184            532       4562           56a1075c 

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.