来源于:How to Kill a Session on RAC Database In Instance Independent Fashion. (文档 ID 869777.1)
适用于:Oracle Database – Enterprise Edition – Version 11.1.0.6 and laterInformation in this document applies to any platform.
目标:你可以在RAC database中来kill session,而不用考虑该session是从哪个intance上产生的。这是11g的新特性。
解决方案:
To kill a session in RAC database use the following syntax.
sql> conn / as sysdbasql> alter system kill session 'sid, serial#, @inst_id';
For Example :
SQL@racdb1> select inst_id,sid,serial#,username from gv$session where username is not null and username not like 'SYS%'; INST_ID SID SERIAL# USERNAME ———- ———- ———- —————————— 112376DBSNMP 1 rows selected. SQL@racdb2> conn scott/tiger Connected. SQL@racdb1> select inst_id,sid,serial#,username from gv$session where username is not null and username not like 'SYS%'; INST_ID SID SERIAL# USERNAME ———- ———- ———- —————————— 2115 17816SCOTT 112376DBSNMP 2 rows selected. SQL@racdb1> alter system kill session '115,17816,@2'; System altered. SQL@racdb1> conn scott/tiger Connected. SQL@racdb1> select inst_id,sid,serial#,username from gv$session where username is not null and username not like 'SYS%'; INST_ID SID SERIAL# USERNAME ———- ———- ———- —————————— 111045316SCOTT 112376DBSNMP 2 rows selected. sql> alter system kill session '110,45316,@1';System altered.
,让情谊在笑声中升腾,当朋友遇到了难题的时候,