The ORA-01940 cannot delete the user that is currently connected

Source: Internet
Author: User

The ORA-01940 cannot delete the user that is currently connected

 

When importing data in the test environment today, you need to remember the drop user operation. When you execute the drop user, the prompt is: ORA-01940: cannot drop a user that is currently connected

 

SQL> drop user ecity;
Drop user ecity
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

 

Obviously, a user is connected and cannot drop the user.

 

Select username, sid, serial #, paddr from v $ session where username = 'ecity ';
Username sid serial # PADDR
-----------------------------------------------------------------------------------------
ECITY 634 7 running c028d198
SQL> select PROGRAM from v $ process where addr = '201710000c028d198 ';
PROGRAM
Bytes ----------------------------------------------------------------------------------------------------------
Oracle @ oradb01 (DW00)
SQL>
SQL> alter system kill session '2017, 7 ';
System altered.
SQL>
SQL> select saddr, sid, serial #, paddr, username, status from v $ session where username is not null;
SQL> drop user ecity CASCADE;
User dropped.
SQL>

 

Solve the problem. Before killing the process, check the process, which machine is connected, and whether the process can be killed. The test environment is good and production is no small matter.

Https://www.bkjia.com/topicnews.aspx? Tid = 12

This article permanently updates link: https://www.bkjia.com/Linux/2018-03/151511.htm

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.