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.