Method to delete session: 1. Use the "v$session" view to view the sid and "serial#" of the session; 2. Use the alter statement to delete the session. The syntax is "alter system kill session 'sid , serial#'".
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
View the sid and serial of the session through v$session view
#--这里的sid,serial根据查询的结果修改为对应的值 alter system kill session 'sid, serial#'
The example is as follows:
1. Query the current session
SQL> select username,sid,serial# from v$session where username is not null; USERNAME SID SERIAL#
SYS 144 4
HYL 146 48
SCOTT 147 64
HR 159 15
--SERIAL#: SID may be repeated. When the SID of two sessions is repeated, SERIAL# is used to distinguish the session.
Query the connected session
select sid,serial#,username,program,machine,status from v$session
The query results are as follows , you can locate it according to the machine and logged-in account:
2. Delete the current session
SQL> alter system kill session '146,48'; System altered.
Hyl's session and perform the following operations:
SQL> show user USER is "HYL" SQL> select * from test1; select * from test1 * ERROR at line 1: ORA-00028: your session has been killed
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to delete session in oracle. For more information, please follow other related articles on the PHP Chinese website!