Monday 16 February 2015

How To Kill Multiple Sessions In Oracle 10G/11G ?

Answer> Execute the  following steps in SQL Plus or CMD Window after connecting to the Oracle Instance.

select ses.USERNAME,
    substr(MACHINE,1,10) as MACHINE,
    substr(module,1,25) as module,
    status,
    'alter system kill session '''||SID||','||ses.SERIAL#||''';' as kill
from v$session ses LEFT OUTER JOIN v$process p ON (ses.paddr=p.addr)
where schemaname <> 'SYS'
    and not exists
    (select 1
        from DBA_ROLE_PRIVS
        where GRANTED_ROLE='DBA'
            and schemaname=grantee)
    and machine!='yourlocalhostname'
order by LAST_CALL_ET desc;

----------------------------------

set lines 200 pages 200;

select username, sid,machine from v$session where username is not null;

--------------------------------

Cheers!!!


No comments:

Post a Comment