2014-09-17 13:23:48 +02:00

26 lines
988 B
SQL

--------------------------------------------------------------------------------
--
-- File name: disco.sql
-- Purpose: Generates commands for disconnecting selected sessions
--
-- Author: Tanel Poder
-- Copyright: (c) http://www.tanelpoder.com
--
-- Usage: @disco <filter expression>
-- @disco sid=150
-- @disco username='SYSTEM'
-- @disco "username='APP' and program like 'sqlplus%'"
--
-- Other: This script doesnt actually kill or disconnect any sessions
-- it just generates the ALTER SYSTEM DISCONNECT SESSION
-- commands, the user can select and paste in the selected
-- commands manually
--
--------------------------------------------------------------------------------
select '-- alter system disconnect session '''||sid||','||serial#||''' immediate -- '
||username||'@'||machine||' ('||program||');' commands_to_verify_and_run
from v$session
where &1
/