Question: I want to drop some users in Oracle DB using sqlplus but I am getting error:

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

```

I followed the link in SO to find out the sessions - [Dropping a connected user from an Oracle 10g database schema](https://stackoverflow.com/questions/85804/dropping-a-connected-user-from-an-oracle-10g-database-schema)

But when I ran the command I am not getting any results:

```
SQL> select sid,serial# from v$session where username = 'test';

no rows selected

```

Please help me how to drop users in this case.

Answer: 
Solution : 

login as sysdaba:

```
sqlplus  / as sysdba

```

then:

```
sql>Shutdown immediate;

sql>startup restrict;

sql>drop user TEST cascade;

```

If you want to re-activate DB normally either reset the server or :

```
sql>Shutdown immediate;

sql>startup;

```

:)
```
//'SYS' is username from where you wanted to kill session'
SELECT * FROM DBA_TAB_PRIVS WHERE GRANTEE = 'SYS';

**Step 1:**

CREATE OR REPLACE PROCEDURE sys.kill_session(p_sid NUMBER, p_serial NUMBER)
AS
v_user VARCHAR2(30);
BEGIN
SELECT MAX(username)
INTO v_user
FROM v$session
WHERE sid = p_sid
AND serial# = p_serial;
**Step 2**
create or replace procedure kill_session( p_sid in number, p_serial# in number)
 is v_count pls_integer;
 BEGIN
 select count(*) into v_count
 from V$session
 where username = 'SYS'
 and sid = p_sid
 and serial# = p_serial# ;
 if ( v_count = 1 )
 then
 execute immediate '
 alter system kill session ''' ||
 to_char(p_sid,'999999')||','||
 to_char(p_serial#,'999999')||'''';
 else
 raise_application_error( -20001,
 'You do not own session ''' ||
 p_sid || ',' || p_serial# ||
 '''' );
end if;
 END;
 /

**Step 3**
 grant execute on kill_session to SYS;
**Step 4**
select inst_id, sid, serial#, username, action, program, service_name, con_id from gv$session where username like 'FCM_469';
Check there will be no sessions now
**Step 5**
DROP USER USER_345 CASCADE;
Output:User Dropped

```