Home
Blog
About
Database administration
Operating systems
Development
Links
Following require login:
ScratchPad
SQL> select CURRENT SERVER as DBNAME from SYSIBM.SYSDUMMY1 DBNAME ED1
SQL> select NAME as DBNAME from V$DATABASE; DBNAME --------- TEST
1> select DB_NAME() as DBNAME 2> go DBNAME ------------------------- master
db2 => LIST APPLICATIONS FOR DATABASE ED1
Auth Id Application Appl. Application Id DB # of
Name Handle Name Agents
-------- -------------- ---------- -------------------------------------------------------------- -------- -----
...
DB2 db2jcc_applica 8791 10.44.14.76.4692.110125143835 ED1 1
...
db2 => FORCE APPLICATION (8791) MODE ASYNC
DB20000I The FORCE APPLICATION command completed successfully.
DB21024I This command is asynchronous and may not be effective immediately.
SQL> select SID,SERIAL#,USERNAME,STATUS from V$SESSION where USERNAME='AJPOWELL';
SID SERIAL# USERNAME STATUS
---------- ---------- ------------------------------ --------
1588 69 AJPOWELL ACTIVE
1606 645 AJPOWELL ACTIVE
SQL> ALTER SYSTEM KILL SESSION '1588,69';
System altered.
SQL> select SID,SERIAL#,USERNAME,STATUS from V$SESSION where USERNAME='AJPOWELL';
SID SERIAL# USERNAME STATUS
---------- ---------- ------------------------------ --------
1588 69 AJPOWELL KILLED
1606 645 AJPOWELL ACTIVE
-- The killed session should receive an error, e.g.
SQL> select SID,SERIAL#,USERNAME,STATUS from V$SESSION where USERNAME='AJPOWELL';
select SID,SERIAL#,USERNAME,STATUS from V$SESSION where USERNAME='AJPOWELL';
*
ERROR at line 1:
ORA-00028: your session has been killed
ERROR:
ORA-01012: not logged on
Process ID: 0
Session ID: 1588 Serial number: 69
sp_who2 edited as it's quite wide.
1> exec sp_who2 2> go SPID ... Command ---- ... ----------- 58 ... SELECT INTO 1> KILL 58 2> go -- Check progress of kill 1> KILL 58 WITH STATUSONLY 2> go Msg 6106, Level 16, State 1, Server WG0036, Line 1 Process ID 58 is not an active process ID.
SQL>
SQL>
1>