RE: killing oracle processes

  • From: John Hallas <John.Hallas@xxxxxxxxxxxxxxxxxx>
  • To: "WLJohnson@xxxxxxxxxxxxxxxxxxx" <WLJohnson@xxxxxxxxxxxxxxxxxxx>, "mschmitt@xxxxxxxxxxxx" <mschmitt@xxxxxxxxxxxx>, "'oracle-l@xxxxxxxxxxxxx'" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 18 Aug 2009 10:22:29 +0100

That is a valid point. However we do give permission out to selected developers 
on dev boxes

Details are

To create the stored procedure logon as a sysdba through sqlplus and:-
Explicitly Grant the required rights to system
grant alter system to system;
grant select on sys.v_$session to system;
Create the procedure
create or replace procedure system.killsession (killsid IN VARCHAR2)
as
killserial   varchar2(20);
begin
killserial:='none';
select serial#
into killserial
from sys.v_$session
where sid = killsid
and username = 'XXXX';

execute immediate 'alter system kill session ''' || to_char (killsid) || ', ' 
|| to_char (killserial) || '''' ;

EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('The SID ' || killsid || ' does not exist or cannot be 
killed');

end ;

/
Grant execute on procedure to user
Top of Form
Bottom of Form
For example, sysopr15 needs access to kill sessions so you would type the 
following:-
grant execute on system.killsession to userxxx;


www.jhdba.wordpress.com
________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Johnson, William L (TEIS)
Sent: 17 August 2009 20:36
To: mschmitt@xxxxxxxxxxxx; 'oracle-l@xxxxxxxxxxxxx'
Subject: RE: killing oracle processes

Do you have a good way to make sure a developer running as Oracle account XYZ 
has permission to kill that session (logical ownership) rather than 
accidentally killing one of his or her co-workers critical processes?  Folks 
need to be patient and realize there is a reason you don't just give everyone 
DBA access...

______________________________________________________________________
Wm Morrison Supermarkets Plc is registered in England with number 358949. The 
registered office of the company is situated at Gain Lane, Bradford, West 
Yorkshire BD3 7DL. This email and any attachments are intended for the 
addressee(s) only and may be confidential. 

If you are not the intended recipient, please inform the sender by replying to 
the email that you have received in error and then destroy the email. 
If you are not the intended recipient, you must not use, disclose, copy or rely 
on the email or its attachments in any way. 

Wm Morrison Supermarkets PLC accepts no liability or responsibility for 
anything said in the email or its attachments and gives no warranty as to 
accuracy. It is the policy of Wm Morrison Supermarkets PLC not to enter into 
any contractual or other obligations by email. 

Although we have taken steps to ensure the email and its attachments are 
virus-free, we cannot guarantee this or accept any responsibility, 
and it is the responsibility of recipients to carry out their own virus checks. 
______________________________________________________________________

Other related posts: