(1) view the user's connection status
Select username, Sid, serial # from V $ session
------------------------------------------
Result:
Username Sid serial #
----------------------------------------
Netbnew 513 22974
Netbnew 514 18183
Netbnew 516 21573
Netbnew 531 9
Wuzhq 532 4562
(2) locate the SID, serial, and delete the user to be deleted.
-------------------------------------------
For example, if you want to delete the user 'wuzhq', you can do this:
Alter system kill session '2017 2'
(3) Delete a user
--------------------------------------------
Drop User Username Cascade
(**) If you still prompt ORA-01940 after drop: Unable to delete the user that is currently linked, there is a connected session, you can check the session status to check whether the session is killed. Use the following statement to check the status:
-------------------------------------
Select saddr, Sid, serial #, paddr, username, status from V $ session where username is not null
The result is as follows (taking my database as an example ):
Saddr Sid serial # paddr username status
Bytes --------------------------------------------------------------------------------------------------------
564a1e28 513 22974 569638f4 netbnew active
564a30dc 514 18183 running 688cc netbnew inactive
564a5644 516 21573 56963340 netbnew inactive
564b6ed0 531 9 49262d8c netbnew inactive
564b8184 532 4562 56a1075c wuzhq killed
Status indicates the session Status of the user to be deleted. If the session status is inactive, the user is not killed. If the session status is killed, the user is killed.
It can be seen that the session of the user wuzhq has been killed. Users can be safely deleted.