How to delete a user connection for oracle
1) check the connection status of the user
Select username,sid,serial# from v$session
-
(2) find the sid, serial and delete the user you want to delete.
For example, if you want to delete user 'WUZHQ', you can do this:
Alter system kill session'132,26'
Alter system kill session'137766'
Alter system kill session'149,61846'
Alter system kill session'159,13113'
Alter system kill session'140219'
Alter system kill session'146,2285'
Alter system kill session'147,30211'
Alter system kill session'152,55077'
Alter system kill session'127,5895'
Alter system kill session'130,8117'
Alter system kill session'142,21636'
Alter system kill session'143747'
(3) Delete users
-
Drop user username cascade
(* *) if you also prompt ORA-01940 after drop that the currently linked user cannot be deleted, it means that there is still a connected session. You can check the status of the session to determine whether the session has been kill, and use the following statement to check:
-
Select saddr,sid,serial#,paddr,username,status from v$session where username is not null
Status is the session status of the user to be deleted. If it is still inactive, it has not been dropped by kill. If the status is killed, it has been kill.
Thus it can be seen that the session of the user WUZHQ has been killed. The user can be safely deleted at this time.