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

Try to drop a user in a RAC environment with below errors :

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

There is no sessions, and objects for this user.

SQL> select count(*) from gv$session where username='TESTUSER';

COUNT(*)
----------
0
SQL> select count(*) from dba_objects where owner='TESTUSER';

COUNT(*)
----------
0

It seems there is internal issues in database for this user.

we can either wait for a while , or bounce the database. After this, it is OK to drop the user.

SQL> drop user TESTUSER cascade;

User dropped.