Custom *Kill* in SESSIONS window?

morphman

Member
Hi,

We have a procedure that we use for killing sessions, isntead of "kill". It basically restricts us to killing our own user sessions.

Does anyone know how can I get a right click option in the sessions menu, to call this procedure with the sid/serial as current context?
 
No, this is currently not possible. I have added this to the list of enhancement requests though. You are not the first to ask.
 
You can use Browser Extender plug-in, and create an extension which will be used in Session Window.
Below you can find an example which disconnects session (alter system disconnect session '#sid, #serial#' post_transaction immediate). Copy and paste the "code" into a separate file with ".be" extension, then load into Browser Extender.


Code:
PL/SQL Developer Browser Extender Command

[MAIN]
NAME=SESSION - Disconnect
CAPTION=Disconnect
OTYPE=SessionWindow
OOWNER=%
ONAME=%
SEPARATOR_ABOVE=N
SEPARATOR_BELOW=N
LOAD_AND_EXECUTE=N
LOAD_COMMAND=N
LOAD_AFTER=REPLACE
LOAD_WIN_TYPE=4
EXECUTE_AND_CLOSE=Y
PRIVILEGE_REQ=N
PRIVILEGE=
ORACLE_VERSION_REQ=N
ORACLE_VERSION=7.0.0
ONCLICK_CONFIRM=Y
ONCLICK_CONFIRM_MSG=Disconnect sesssion with sid = #SID, serial = #SERIAL#, username = #SESSIONUSERNAME?
ONCLICK_SPLASH=N
ONCLICK_SPLASH_MSG=
ONCLICK_SPLASH_MSG_BL=N
ONCLICK_SPLASH_MSG_AFTER=
ONCLICK_SPLASH_DELAY=0
ONCLICK_IGNORE_EXCEPTIONS=N
ONPOPUP_IGNORE_EXCEPTIONS=Y

ONCLICK_CODE_TYPE=1
ONCLICK_EXTERNAL_CODE_FILE=
[ONCLICK]
alter system disconnect session '#sid, #serial#' post_transaction immediate

[ONPOPUP]
 
In Lua Plug-In you can do something like:

Code:
local AddMenu = ...

local plsql = plsql
local SYS, IDE, SQL = plsql.sys, plsql.ide, plsql.sql

local ShowMessage = plsql.ShowMessage

local pvUserKill
do
  local function UserKill()
    local svSql="ALTER SYSTEM KILL SESSION '"..IDE.GetSessionValue("sid")..","..IDE.GetSessionValue("serial#").."' IMMEDIATE"
	local svSqlCode=SQL.Execute(svSql)
	if svSqlCode~=0 then
	   ShowMessage(svSqlCode)
	end
  end
   pvUserKill=AddMenu(UserKill, "")
end

local function OnActivate()
  IDE.CreatePopupItem(pvUserKill, "UserKill", "SESSIONWINDOW")
end

return {
	OnActivate,
	OnDeactivate,
	CanClose,
	AfterStart,
	AfterReload,
	OnBrowserChange,
	OnWindowChange,
	OnWindowCreate,
	OnWindowCreated,
	OnWindowClose,
	BeforeExecuteWindow,
	AfterExecuteWindow,
	OnConnectionChange,
	OnPopup,
	OnMainMenu,
	OnTemplate,
	OnFileLoaded,
	OnFileSaved,
	About,
	CommandLine,
	RegisterExport,
	ExportInit,
	ExportFinished,
	ExportPrepare,
	ExportData
}
 
Back
Top