Ora-01940:cannot drop a user is currently connected

Source: Internet
Author: User

Use to delete a user, but there is a user connection when deleting

Sql> Conn/as SYSDBA

Connected.

sql> drop user test cascade;

Drop USER Test Cascade

*

ERROR at line 1:

Ora-01940:cannot drop a user is currently connected

By viewing the user's progress, and then kill the user process, and then delete the user

Sql> Select sid,serial# from v$session where username= ' test ';

No rows selected

Sql> Select sid,serial# from v$session where username= ' TEST ';

SID serial#

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

150 9019

Sql> alter system kill session ' 150,9019 ';

System altered.

Note: This is a bit strange, I obviously killed the test connection session through kill, but I can also pass the test user row SQL query, which caused me to continue the query appeared two messages.

Sql> Select sid,serial# from v$session where username= ' TEST ';

SID serial#

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

138 2947

150 9019

I wonder why Oracle's KILL command doesn't really kill the process.

Sql> alter system kill session ' 150,9019 ';

System altered.

Sql> alter system kill session ' 138,2947 ';

System altered.

But I delete the user immediately after killing the process, the user is deleted directly. Does Oracle's KILL command not really kill the user process, but only on the surface has been the phenomenon, the subsequent operation is really working.

sql> drop user test cascade;

User dropped.

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.