ORA-01940: cannot drop a user that is currently connected解决方法

我们在删除数据库用户时候会碰到如下错误

SQL> DROP USER sys_xj cascade;
DROP USER sys_xj cascade
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected

解决方法:

1.查询出还在连接的此用户会话进程

SQL> SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME=‘SYS_XJ‘
2 ;

SID SERIAL#
---------- ----------
452 8801
474 1523

2.结束此用户所有会话

SQL> ALTER SYSTEM KILL SESSION ‘452,8801‘;

System altered.

SQL> ALTER SYSTEM KILL SESSION ‘474,1523‘;

System altered.

3.删除用户

SQL> DROP USER sys_xj cascade;

User dropped.

此时删除成功

时间: 2024-11-14 23:20:48

ORA-01940: cannot drop a user that is currently connected解决方法的相关文章

Win7x64中使用PowerDesigner连接Oralce数据库报“[Oracle][ODBC][Ora]ORA-12154:TNS:无法解析指定的连接标识符”错误解决方法

错误描述 操作系统是Win7 x64,Oracle服务端是Oracle11g x64,客户端是Oracle10gR2 x86. 使用PL-SQL Developer连接正常 使用系统ODBC连接正常.这里要注意的是,64位系统默认启动的是64位ODBC数据源管理器,默认指向的是服务端连接,所以需要为Oracle服务端也配置TNS Service Name,否则同样会连接报错.PowerDesigner默认启动的是32位的ODBC数据源管理器,程序路径为“%SystemRoot%\SysWOW64

ORA-01940: cannot drop a user that is currently connected

操作环境 SuSE11+Oracle11gR2 问题现象 删除oracle数据库用户失败,提示ORA-01940: cannot drop a user that is currently connected错误 问题分析 NA 问题解决 1.SQL>SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='USERNAE'; 2.SQL>ALTER SYSTEM DISCONNECT SESSION 'SID,SERIAL#' IMMEDIATE;

(转)ORA-01940: cannot drop a user that is currently connected 问题解析

删除数据库用户的时候经常会遇到这样的错误: ORA-01940: cannot drop a user that is currently connected 原因是有程序在连接我们需要删除的用户,我们删除用户之前一定要先把连接断掉: 1.查找帐号下哪些连接在运行: SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='USERNAME': 注意:此处需要大写 SQL> SELECT SID,SERIAL# FROM V$SESSION WHERE

ORA-01940: cannot drop a user that is currently connected 问题解析

转自: https://www.linuxidc.com/Linux/2012-12/76448.htm 删除数据库用户的时候经常会遇到这样的错误: ORA-01940: cannot drop a user that is currently connected 原因是有程序在连接我们需要删除的用户,我们删除用户之前一定要先把连接断掉: 1.查找帐号下哪些连接在运行: SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='USERNAME': 注意

oerr ora 000845解决方法是扩大/dev/shm空间

打开虚拟机发现实例起不来 [[email protected] ~]# su - oraclesq[[email protected] ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 2 14:59:54 2016 Copyright (c) 1982, 2013, Oracle.  All rights reserved. Connected to an idle instance. [ema

drop表后仍占表空间解决办法

练习oracle时create了很多表,drop表后select * from tab; 网上找了好些方法,但是好多都适用... SQL>purge recyclebin; 回收站已清空.

Oracle varchar2最大支持长度(转)

oerr ora 0650206502, 00000, "PL/SQL: numeric or value error%s"// *Cause: An arithmetic, numeric, string, conversion, or constraint error// occurred. For example, this error occurs if an attempt is made to// assign the value NULL to a variable de

Oracle 11g RAC to RAC ADG搭建(一)采用rman备份恢复方式

(一)基础环境   主库 备库 操作系统 RedHat6.7 RedHat6.7 服务器名称 primarydb1primarydb2 standbydb1standbydb2 IP地址规划 192.168.10.31    primarydb1192.168.10.32    primarydb2192.168.10.33    primarydb1-vip192.168.10.34    primarydb2-vip192.168.10.30    primarydb-scan 10.10.

MySQL多实例的安装

安装MySQL-5.5.49 安装包的获取:http://mirrors.sohu.com/mysql/ # 安装MySQL需要的依赖包 yum install ncurses-devel libaio-devel -y rpm -qa  ncurses-devel libaio-devel # 安装编译MySQL需要的软件 yum install cmake -y rpm -qa cmake # 创建用户 useradd mysql -u 777 -s /sbin/nologin -M id