RAC下,alter system kill session報錯ORA-00030: User session ID does not exist
在RAC環境下,KILL SESSION時報錯ORA-00030 User session ID does not exist.
問題再現:
NODE2:
[oracle@node2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Feb 11 21:27:08 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> conn sh/sh
Connected.
SQL> show parameter instance_number
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_number integer 2
SQL> select sid ,serial# from v$session where sid=userenv('sid');
SID SERIAL#
---------- ----------
136 5
SQL> create table test as select a.* from all_objects a,all_objects b,all_objects c;
NODE1:
[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Feb 11 21:25:53 2018
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter instance_number;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
instance_number integer 1
SQL> alter system kill session '136,5';
alter system kill session '136,5'
*
ERROR at line 1:
ORA-00030: User session ID does not exist.
node2:
SQL> alter system kill session '136,5,@2';
System altered.
node1:
SQL> create table test as select a.* from all_objects a,all_objects b,all_objects c;
create table test as select a.* from all_objects a,all_objects b,all_objects c
*
ERROR at line 1:
ORA-00028: your session has been killed
ORA-00028: your session has been killed
小結:對于RAC環境下的跨實例殺會話,alter system kill session 需要增加 @instance_number。其中,instance_number可通過show parameter instance_number來獲取。