Killing Sessions using MBeans

Guys,
Am having hung sessions in memory, wondering if anyone knows how to kill
them programatically using MBeans. In other words is there a MBean class which
gives me list of all active sessions in memory ?
Thanks

Guys,
Am having hung sessions in memory, wondering if anyone knows how to kill
them programatically using MBeans. In other words is there a MBean class which
gives me list of all active sessions in memory ?
Thanks

Similar Messages

  • How to access "Active Sessions" using MBeans

    Hi all,
    I have deployed an application at EM (Enterprise Manager).
    when I logged into EM and click the application I can see the number of active sessions under "Servlets and JSPs" topic.
    how can I access that parameter at application level..??
    (I want to access that parameter *"x"* at my web application and display Logged in users : x )
    EM shows that the number of active sessions. it updates too.. so there must be some bean or record for that parameter..
    how can I access that....??
    Regards,
    Dinuka.

    You can use something like the following:
    package middleware.magic;
    import javax.management.MBeanServerConnection;
    import javax.management.ObjectName;
    import javax.management.remote.JMXConnector;
    import javax.management.remote.JMXConnectorFactory;
    import javax.management.remote.JMXServiceURL;
    import javax.naming.Context;
    import java.io.IOException;
    import java.util.Hashtable;
    public class Browse {
        private String hostname = "172.31.0.106";
        private Integer port = 7001;
        private String username = "weblogic";
        private String password = "transfer11g";
        private String protocol = "t3";
        private String jndiRoot = "/jndi/";
        private String mBeanServer = "weblogic.management.mbeanservers.domainruntime";
        private String serviceName = "com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean";
        private JMXConnector connector;
        public static void main(String[] args) {
            Browse test = new Browse();
            try {
                MBeanServerConnection connection = test.getMBeanServerConnection();
                test.getSomeInformation(connection);
                test.closeJmxConnector();
            } catch (Exception e) {
                e.printStackTrace();
        public void getSomeInformation(MBeanServerConnection connection) throws Exception {
            ObjectName service = new ObjectName(serviceName);
            ObjectName[] serverRunTimes = (ObjectName[]) connection.getAttribute(service, "ServerRuntimes");
            for (int i = 0; i < serverRunTimes.length; i++) {
                String name = (String) connection.getAttribute(serverRunTimes, "Name");
    String version = (String) connection.getAttribute(serverRunTimes[i], "WeblogicVersion");
    String state = (String) connection.getAttribute(serverRunTimes[i], "State");
    System.out.println("Server name: " + name + ", Version: " + version + ", Server state: " + state);
    for (int i = 0; i < serverRunTimes.length; i++) {
    ObjectName[] applicationRuntimes = (ObjectName[]) connection.getAttribute(serverRunTimes[i], "ApplicationRuntimes");
    for (int j = 0; j < applicationRuntimes.length; j++) {
    String name = (String) connection.getAttribute(applicationRuntimes[j], "Name");
    ObjectName[] componentRuntimes = (ObjectName[]) connection.getAttribute(applicationRuntimes[j], "ComponentRuntimes");
    System.out.println("Application name: " + name);
    for (int k = 0; k < componentRuntimes.length; k++) {
    if (connection.getAttribute(componentRuntimes[k], "Type").equals("WebAppComponentRuntime")) {
    String componentName = (String) connection.getAttribute(componentRuntimes[k], "Name");
    Integer sessionsCurrent = (Integer) connection.getAttribute(componentRuntimes[k], "OpenSessionsCurrentCount");
    Integer sessionsHigh = (Integer) connection.getAttribute(componentRuntimes[k], "OpenSessionsHighCount");
    System.out.println(" - Component Name: " + componentName + ", Sessions Current: " + sessionsCurrent + ", Sessions High: " + sessionsHigh);
    public MBeanServerConnection getMBeanServerConnection() throws IOException {
    return getJmxConnector().getMBeanServerConnection();
    public JMXConnector getJmxConnector() throws IOException {
    JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiRoot + mBeanServer);
    Hashtable hashtable = new Hashtable();
    hashtable.put(Context.SECURITY_PRINCIPAL, username);
    hashtable.put(Context.SECURITY_CREDENTIALS, password);
    hashtable.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
    connector = JMXConnectorFactory.connect(serviceURL, hashtable);
    return connector;
    public void closeJmxConnector() throws IOException {
    connector.close();
    Information regarding runtimeMBean can be found here: http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e13951/core/index.html.
    Open the tree Runtime MBeans, ServerRuntimeMBean and click attributes to see the available attributes (such as Name, WeblogicVersion, State etcetera).
    An example output of the program above:Server name: AdminServer, Version: WebLogic Server 10.3.2.0 Tue Oct 20 12:16:15 PDT 2009 1267925 , Server state: RUNNING
    Server name: soa_server1, Version: WebLogic Server 10.3.2.0 Tue Oct 20 12:16:15 PDT 2009 1267925 , Server state: RUNNING
    Application name: FMW Welcome Page Application_11.1.0.0.0
    - Component Name: AdminServer__11.1.0.0.0, Sessions Current: 0, Sessions High: 0
    Application name: Module-FMWDFW
    Application name: bea_wls_internal
    - Component Name: AdminServer_/bea_wls_internal, Sessions Current: 0, Sessions High: 0
    Application name: mds-soa
    Application name: bea_wls_deployment_internal
    - Component Name: AdminServer_/bea_wls_deployment_internal, Sessions Current: 0, Sessions High: 0
    Application name: wsil-wls
    - Component Name: AdminServer_/inspection.wsil, Sessions Current: 0, Sessions High: 0
    Application name: bea_wls_diagnostics
    - Component Name: AdminServer_/bea_wls_diagnostics, Sessions Current: 0, Sessions High: 0
    Application name: mejb
    Application name: bea_wls9_async_response
    - Component Name: AdminServer_/_async, Sessions Current: 0, Sessions High: 0
    Application name: uddiexplorer
    - Component Name: AdminServer_/uddiexplorer, Sessions Current: 0, Sessions High: 0
    Application name: mds-owsm
    Application name: bea_wls_management_internal2
    - Component Name: AdminServer_/bea_wls_management_internal2, Sessions Current: 0, Sessions High: 0
    Application name: consoleapp
    - Component Name: AdminServer_/console, Sessions Current: 0, Sessions High: 2
    - Component Name: AdminServer_/consolehelp, Sessions Current: 0, Sessions High: 1
    Application name: DMS Application_11.1.1.1.0
    - Component Name: AdminServer_/dms_11.1.1.1.0, Sessions Current: 0, Sessions High: 0
    Application name: em
    - Component Name: AdminServer_/em, Sessions Current: 0, Sessions High: 0
    Application name: uddi
    - Component Name: AdminServer_/uddi, Sessions Current: 0, Sessions High: 0
    Application name: MQSeriesAdapter
    Application name: OraSDPMDataSource
    Application name: JmsAdapter
    Application name: uddi
    - Component Name: soa_server1_/uddi, Sessions Current: 0, Sessions High: 0
    Application name: wsil-wls
    - Component Name: soa_server1_/inspection.wsil, Sessions Current: 0, Sessions High: 0
    Application name: SOAJMSModule
    Application name: DbAdapter
    Application name: bea_wls9_async_response
    - Component Name: soa_server1_/_async, Sessions Current: 0, Sessions High: 0
    Application name: composer
    - Component Name: soa_server1_/soa/composer, Sessions Current: 0, Sessions High: 0
    Application name: DMS Application_11.1.1.1.0
    - Component Name: soa_server1_/dms_11.1.1.1.0, Sessions Current: 0, Sessions High: 0
    Application name: Module-FMWDFW
    Application name: usermessagingdriver-email
    - Component Name: soa_server1_/sdpmessagingdriver/email-mbeanlifecycle, Sessions Current: 0, Sessions High: 0
    Application name: UMSJMSSystemResource
    Application name: AqAdapter
    Application name: FtpAdapter
    Application name: OracleBamAdapter
    Application name: SOADataSource
    Application name: usermessagingserver
    - Component Name: soa_server1_/sdpmessaging/mbeanlifecycle, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/sdpmessaging/parlayx, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/sdpmessaging/userprefs-ui, Sessions Current: 0, Sessions High: 0
    Application name: bea_wls_internal
    - Component Name: soa_server1_/bea_wls_internal, Sessions Current: 0, Sessions High: 0
    Application name: SocketAdapter
    Application name: SOALocalTxDataSource
    Application name: FileAdapter
    Application name: DefaultToDoTaskFlow
    - Component Name: soa_server1_/DefaultToDoTaskFlow, Sessions Current: 0, Sessions High: 0
    Application name: soa-infra
    - Component Name: soa_server1_/soa-infra, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/TaskService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/TaskMetadataService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/TaskQueryService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/TaskReportService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/IdentityService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/UserMetadataService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/RuntimeConfigService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/TaskEvidenceService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/CompositeMetadataService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/b2b, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/b2b, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/AGMetadataService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/AGQueryService, Sessions Current: 0, Sessions High: 0
    - Component Name: soa_server1_/integration/services/AGAdminService, Sessions Current: 0, Sessions High: 0
    Application name: wsm-pm
    - Component Name: soa_server1_/wsm-pm, Sessions Current: 0, Sessions High: 0
    Application name: mds-owsm
    Application name: b2bui
    - Component Name: soa_server1_/b2bconsole, Sessions Current: 0, Sessions High: 0
    Application name: bea_wls_diagnostics
    - Component Name: soa_server1_/bea_wls_diagnostics, Sessions Current: 0, Sessions High: 0
    Application name: bea_wls_cluster_internal
    - Component Name: soa_server1_/bea_wls_cluster_internal, Sessions Current: 0, Sessions High: 0
    Application name: EDNLocalTxDataSource
    Application name: EDNDataSource
    Application name: uddiexplorer
    - Component Name: soa_server1_/uddiexplorer, Sessions Current: 0, Sessions High: 0
    Application name: bea_wls_deployment_internal
    - Component Name: soa_server1_/bea_wls_deployment_internal, Sessions Current: 0, Sessions High: 0
    Application name: worklistapp
    - Component Name: soa_server1_/integration/worklistapp, Sessions Current: 0, Sessions High: 0
    Application name: mds-soa
    Application name: OracleAppsAdapter

  • Alter system kill session always gives ORA-00030

    Hello
    Im writing a tool for oracle and one of its features requires killing user session (Im connecting with JDBC). The database Im testing on is 11.2.0.2.
    I find the sid and the serial# without problems, than I issue the "alter system kill session 'x,y' immediate" command.
    So far so good, but I always get an ORA-00030 error saying this session cannot be found.
    I double check and the session does exist in the database.
    Because I want the tool to make the kill, killing via the OS is not an option.
    Its doesn't look like a permission problem because it gives the same error even when connected as system.
    Whats wrong ? does this kill command work at all ? Whats its limitations ?
    Thanks
    Guy Shilo
    Edited by: user13266377 on Jun 9, 2011 1:15 AM

    user13266377 wrote:
    Hello
    Im writing a tool for oracle and one of its features requires killing user session (Im connecting with JDBC). The database Im testing on is 11.2.0.2.
    I find the sid and the serial# without problems, than I issue the "alter system kill session 'x,y' immediate" command.
    So far so good, but I always get an ORA-00030 error saying this session cannot be found.
    I double check and the session does exist in the database.
    Because I want the tool to make the kill, killing via the OS is not an option.
    Its doesn't look like a permission problem because it gives the same error even when connected as system.
    Whats wrong ? does this kill command work at all ? Whats its limitations ?
    Thanks
    Guy Shilo
    Edited by: user13266377 on Jun 9, 2011 1:15 AMyou cannot kill the session already killed or disconnected from the session.
    refer the link:- this may help you to write scripts to kill session using dbms_scheduler
    Grant restricted and kill sessions.

  • ALTER SYSTEM KILL SESSION 에 대하여(ORA-30)

    제품 : ORACLE SERVER
    작성날짜 : 1997-07-30
    ALTER SYSTEM KILL SESSION 에 대하여
    --- Problem
    사용자는 다음과 같은 상황에서 session 을 kill 하려는 시도를 하게 된다.
    1. os 에는 process 가 존재하지 않지만, v$session 에는 active 로 존재하고
    있을 경우
    2. shadow process 는 살아 있는데, client machine 을 rebooting 한 경우
    3. session 이 걸고 있던 lock 을 release 해야 할 경우
    4. OS 나 Oracle 의 자원을 지나치게 많이 사용하여 성능을 저하시키는
    process
    그런데, alter system kill session ('sid, serial#'); 후에 다음과 같은
    에러가 발생할 경우가 있다.
    ora-00030, 00000, "user session ID does not exist"
    // *Cause:  The user session id no longer exists, probably because the
    // session was logged out.
    // *Action: Use a valid session ID.
    --- 원인과 대책
    kill session을 할 수 없는 이유는 PMON이 이미 이 session을 delete하고 있는
    중이기 때문이다. 즉, PMON 이 dead session 을 clean-up 하고 있는 중에는
    serial number의 값이 증가한다.
    문제는 PMON이 process를 kill하는 시간인데, transaction의 크기에 따라,
    PMON의 rollback 시간이 결정된다. 먼저 PMON은 dead process를 찾아내어,
    이 process가 사용한 resource 를 release하는 시도를 한다.
    PMON은 계속 이 작업을 시도하다가 마침내, free buffer의 부족으로 더 이상
    resource를 free-up 하지 못하게 된다.
    이 때, 이 process를 delete하고 있다는 message를 trace file에 출력하는데,
    이것은 process를 delete하는 데 필요한 resource(data cache 내의 free buffer)
    의 부족으로 위의 작업이 지연되고 있다는 의미이다.
    PMON이 process 를 clean-up 할 때 걸리는 시간은, 5분에서 24 시간까지 소요
    될 수 있다. 문제는 이 process가 hold 하고 있는 lock으로 인해 특정 작업이
    수행되지 못하는 데 있다. MTS 를 사용할 때는 configuration MTS setting,
    sqlnet.expire_time 사용)에 따라 다르지만, clean-up 작업을 하는데 72 시간이
    소요된 경우도 있다.
    아직까지는 PMON이 작업을 마칠 때까지 기다리는 방법 또는 db를 restartup하는
    방법 밖에는 없다.
    --- PMON 의 작업
    PMON은 network failure 나 기타의 원인으로 생긴 old process connection을
    clean-up 하는 역할을 한다. 그런데, PMON 은 clean-up 해야 하는 connection
    중에 정해진 개수 만큼의 transaction 을 rollback 할 수 있는데, 이 값은
    initSID.ora 의 cleanup_rollback_entries(default = 20) 에 의해 결정된다.
    예를 들어, 1000 개의 uncommitted update가 있다면, 일정한 시간마다
    cleanup_rollback_entries 의 개수 만큼의 record 만 rollback 할 수 있으므로
    이 작업 동안에 lock 은 그대로 유지된다.
    PMON 은 위의 작업 이외에 DB maintenance 역할이 있으므로, 위의 rollback 이
    비교적 빠르게 처리되지 못할 수도 있다. 이러한 rollback을 빠르게 처리하기
    위하여 cleanup_rollback_entries 를 늘릴 수도 있다. 그러나, 그 만큼 일정
    시간 동안 PMON 의 작업이 많아지게 되므로, 다른 사용자들의 작업 요청이
    느려지게 되는 trade-off 가 있으므로, 신중히 고려한 후에 수정하는 것이
    바람직하다.
    alter system kill session 에 의해서도 위와 같이 rollback 이 이루어지는데,
    이 session 이 완전히 clean-up 되기 전까지 v$session, v$process에 남아 있게
    된다.
    --- ALTER SYSTEM KILL SESSION 을 하기 전에 ...
    kill session 을 원할 경우는 다음의 순서대로 작업하는 것이 좋다.
    1. kill the user process first
    2. wait for 3 - 4 minutes
    3. query v$session
    4. if any information find in v$session, query v$lock
    like
    select count(*) from v$lock where SID ='sid';
    위의 count(*) 가 0 이 아니라면, 아직 PMON 이 rollback을 끝내지 못한 경우
    이므로 다시 얼마 후에 v$lock 을 조회하여 lock 의 개수가 감소하였는지
    반복적으로 확인한다.
    만약, 이 값이 전혀 변하지 않았다면, ALTER SYSTEM KILL SESSION 을 수행하고
    v$session, v$lock을 query 하여 변화가 있는지 확인하여 변화가 있다면,
    좀 더 기다린다.
    그래도, v$lock 의 count(*) 가 0 이 되지 않을 경우, 마지막으로 수행할 수
    있는 유일한 방법은 instance 를 restartup 하는 것이다.

    user13266377 wrote:
    Hello
    Im writing a tool for oracle and one of its features requires killing user session (Im connecting with JDBC). The database Im testing on is 11.2.0.2.
    I find the sid and the serial# without problems, than I issue the "alter system kill session 'x,y' immediate" command.
    So far so good, but I always get an ORA-00030 error saying this session cannot be found.
    I double check and the session does exist in the database.
    Because I want the tool to make the kill, killing via the OS is not an option.
    Its doesn't look like a permission problem because it gives the same error even when connected as system.
    Whats wrong ? does this kill command work at all ? Whats its limitations ?
    Thanks
    Guy Shilo
    Edited by: user13266377 on Jun 9, 2011 1:15 AMyou cannot kill the session already killed or disconnected from the session.
    refer the link:- this may help you to write scripts to kill session using dbms_scheduler
    Grant restricted and kill sessions.

  • Kill the session Using Pl/sql Script

    Hi,
    I wrote a PL/SQL Script which kills the Specified Schema name..... the Script Run Successfully i got this output message "PL/SQL procedure successfully completed." But the Problem is in session status the status is in KILLED" state for more than 30 minutes.
    Please Advice Why the Session in Killed State for more than 30 minutes and please tell me how to kill the session immediate;
    I am Using Oracle DB 11g R1 and OS is Windows 2003 Server R2
    My Pl/sql Script
    SET SERVEROUTPUT ON;
    DECLARE
    KILLER1 V$SESSION.SID%TYPE;
    KILLER2 V$SESSION.SERIAL#%TYPE;
    CURSOR KILL_SESSION IS SELECT SID,SERIAL# FROM V$SESSION WHERE SCHEMANAME='NAME';
    BEGIN
    OPEN KILL_SESSION;
    LOOP
    FETCH KILL_SESSION INTO KILLER1,KILLER2;
    EXIT WHEN KILL_SESSION%NOTFOUND;
    DBMS_OUTPUT.put_line ('ALTER SYSTEM KILL SESSION '''||KILLER1||','||KILLER2||''' IMMEDAITE');
    EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION'||chr(39)||KILLER1||','||KILLER2||chr(39);
    END LOOP;
    IF (KILLER1 > 0)
    THEN
    EXECUTE IMMEDIATE 'ALTER SYSTEM KILL SESSION'||chr(39)||KILLER1||','||KILLER2||chr(39);
    END IF;
    CLOSE KILL_SESSION;
    END;
    Thank You
    Shan

    Hello,
    In fact you may use orakill it's an Oracle utility for Windows so as to Kill the thread corresponding
    to the session.
    It's equivalent to a kill -9 on Unix.
    Please find here a link about the use of orakill:
    http://articles.techrepublic.com.com/5100-10878_11-5224960.html
    Hope this help.
    Best regards,
    Jean-Valentin
    Edited by: Lubiez Jean-Valentin on Mar 27, 2010 5:17 PM

  • How to kill session in forms

    In my application I want to kill session if any user
    is idle for 2 minutes.
    I am using oracle forms 6i and database oracle 9i

    You have to use D2KWutil.pll
    In when new form instance write the following code
    declare
    hWind PLS_INTEGER;
    CheckTimer TIMER;
    begin
    hWind := get_window_property(FORMS_MDI_WINDOW,WINDOW_HANDLE);
    Win_API_Session.Timeout_Start_Timer(hWind);
    CheckTimer := Create_Timer('CheckTimeout',1000,repeat);
    end;
    and in when timer expired trigger write the following code
    begin
    if upper(get_application_property(TIMER_NAME)) = 'CHECKTIMEOUT' then
                   :timer.t1 := Win_api_session.Timeout_Get_Inactive_Time;     
    if :timer.t1 > 120 then -- timer is a block and t1 is text item (don't assign a canvas to it, make it invisible)
    Win_API_Session.timeout_delete_timer;
    exit_form (NO_VALIDATE);
    end if;
    end if;
    end;
    hope this helps !!

  • Urgent-how to run 'alter system kill session 'sid, serial#' in form 6i ?

    I want to write a procedure in Form 6i so that user can kill the session by herself.
    I know kill session sql is 'alter system kill session 'sid, serial#'', however, I fould that I can only run it it sql plus screen, how can I run it in Form or in Stored procedure?
    Urgent....Please!

    try using Forms_ddl('alter system......'); in the forms. it will execute the dml statements in the form.
    zaibi.

  • ALTER SYSTEM KILL SESSION privilege

    Hi All,
    Is there any possibility to use this command from a without having DBA priviileges, what is the privilege to be grantd to the ordinary users to execute ALTER SYSTEM KILL SESSION... statement..
    Thanks in advance

    The procedure proposed by Rusell would be more or less so:
    SQL> create or replace procedure kill_session
      2  ( v_sid number, v_serial number )
      3  as
      4  v_varchar2 varchar2(100);
      5  begin
      6  execute immediate 'ALTER SYSTEM KILL SESSION '''
      7  || v_sid || ',' || v_serial || '''';
      8  end;
      9  /
    Procedure created.
    SQL> select username, sid, serial# from v$session;
    USERNAME                              SID    SERIAL#
                                          147       5078
    SYS                                   148       6161
                                          151       6769
                                          156          1
                                          158          1
                                          159          1
    REPOS_OWNER                           161      14502
                                          163          1
                                          164          1
                                          165          1
                                          166          1
    USERNAME                              SID    SERIAL#
                                          167          1
                                          168          1
                                          169          1
                                          170          1
    15 rows selected.
    SQL>
    SQL> exec kill_session(161,14502);
    PL/SQL procedure successfully completed.
    SQL>Joel Pérez
    http://otn.oracle.com/experts

  • Kill session permission without alter system permission?

    Syntax to kill session is
    ALTER SYSTEM KILL SESSION 'session info';
    Is there a way to allow a user to kill his/her own session without granting rights to SYSTEM? I don't want anyone to be able to drop the database, but they need to be able to kill their own session. I've looked everywhere...
    Thanks in advance!

    Yes, assuming you are using standard definer's rights stored procedures. Only if you specify AUTHID CURRENT_USER when creating the stored procedure will you get an invoker's rights stored procedure, which would run with the privileges of the caller, not of the definer.
    Justin

  • To kill session in one schema from another schema

    Hi Team,
    I got a problem like a table from one of my schema has been locked. I am getting 'ORA-00054: resource busy and acquire with NOWAIT specified' error when trying to delete rows from that table or even when trying to truncate that table.
    Let the table be 'T1' present in schema 'VIEW'
    I tried to kill the session which is active for that schema by below query
    select sid,serial#,status from v$session where username='VIEW' and STATUS = 'ACTIVE';
    alter system kill session '681,2586';
    But i couldn't do the above as i don't have DBA privilege for that. But i have DBA privilege for another schema let it be 'ADMIN'
    Now how can i kill the session in schema 'VIEW' from schema 'ADMIN'
    can any one get me solution.
    Thanks in Advance
    11081985

    I got a problem like a table from one of my schema has been locked. I am getting 'ORA-00054: resource busy and acquire with NOWAIT specified' error when trying to delete rows from that table or even when trying to truncate that table.
    Before you do anything why don't you actually find out WHY that table has been locked.
    You generally should NOT be killing sessions without knowing what is causing the problem to begin with.
    Then you also need to determine if you should use KILL SESSION or instead use DISCONNECT SESSION and well as whether the use of IMMEDIATE is appropriate.
    Each of those choices acts differently. Many people use KILL when they should really use DISCONNECT.
    See DISCONNECT SESSION Clause and KILL SESSION Clause in the ALTER SESSION chapter of the SQL Language doc
    http://docs.oracle.com/cd/E11882_01/server.112/e17118/statements_2014.htm#i2282145

  • Abend while executing alter system kill session command

    I have a ML350 G3 Hp server(Xeon 2.4 Ghz) running oracle 8.1.5 on Novell 5.1. Frequently i have locking problems in my software. So when i tried to kill the active session using alter system kill session 'sid, serial#' my server produce following error:
    Fatal Exception (Number 14, cause abend: Page fault running process: orcl_000000fe code executing in module core81.nlm v8.1d at offset +6c490h). Any suggestions.

    This forum is for posting feedback about the OTN site.
    The best place for your question is probably a Database forum.
    There is a list of Database forums here:
    http://forums.oracle.com/forums/index.jsp?cat=18

  • Regarding Alter System Kill Session

    Hi Guys,
    I have to do db refresh from the build .For this I have to kill the sessions and drop the users and recreate the users with the latest build.As the application is running and there are some idle sessions, I have to kill the sessions and drop the users for that I am using a code as below
    DECLARE
    v_alt_stmt VARCHAR2(1000) := 'ALTER SYSTEM KILL SESSION ''';
    v_kill_stmt VARCHAR2(1000);
    CURSOR cur_session IS
    SELECT s.type type,
    s.sid sid,
    s.serial# srl_no,
    s.username user_name,
    s.PROGRAM prog_name
    FROM v$session s JOIN gv$process p ON p.addr = s.paddr and s.type='USER';
    BEGIN
    EXECUTE IMMEDIATE 'ALTER SYSTEM ENABLE RESTRICTED SESSION';
    DBMS_OUTPUT.PUT_LINE('The Session has been put in the restricted mode');
    FOR v_cur_ssn IN cur_session
    LOOP
    BEGIN
    v_kill_stmt := v_alt_stmt || v_cur_ssn.sid || ',' || v_cur_ssn.srl_no || '''';
    DBMS_OUTPUT.PUT_LINE(v_kill_stmt);
    EXECUTE IMMEDIATE v_kill_stmt;
    EXCEPTION
    WHEN others THEN
    -- DBMS_OUTPUT.PUT_LINE('The current sessions sid is ' || v_cur_ssn.sid || ' and the srl no is ' || v_cur_ssn.srl_no || ' can not be killed');
    END;
    END LOOP;
    EXECUTE IMMEDIATE 'ALTER SYSTEM DISABLE RESTRICTED SESSION';
    DBMS_OUTPUT.PUT_LINE('The restricted mode of the system has been removed');
    END;
    But sometimes after killing the sessions there are some os processes are going on,to avoid that I have to use 'ALTER SYSTEM DISCONNECT SESSION ''' and 'MMEDIATE' it is workig fine .
    Can Any one tell me the logical difference between kill sessions and disconnect
    Any information will be highly appreciated.
    Thanks in advance
    Prafulla

    >
    Can Any one tell me the logical difference between kill sessions and disconnect
    >
    Disconnect can be used to disconnect immediately without waiting for any ongoing transactions to complete and recovers all session resousrces.
    Kill rolls back ongoing transactions and partially recovers session resources.
    Kill is simiilar to SHUTDOWN IMMEDIATE while disconnect is more like SHUTDOWN ABORT.
    See DISCONNECT SESSION Clause in the SQL Language doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2013.htm
    >
    Use the DISCONNECT SESSION clause to disconnect the current session by destroying the dedicated server process (or virtual circuit if the connection was made by way of a Shared Sever).
    •The IMMEDIATE setting disconnects the session and recovers the entire session state immediately, without waiting for ongoing transactions to complete.
    >
    And KILL SESSION in the same doc next section
    >
    The KILL SESSION clause lets you mark a session as terminated, roll back ongoing transactions, release all session locks, and partially recover session resources.
    IMMEDIATE Specify IMMEDIATE to instruct Oracle Database to roll back ongoing transactions, release all session locks, recover the entire session state, and return control to you immediately.

  • Trace File Created Upon Execution of "alter system kill session sid, serial# immediate;"

    A problem within a third-party application is causing it to create and abandon Oracle sessions. At times three hundred or more abandoned sessions accumulated in the instance. The software company is working on the problem. Oracle's background processes will get rid of those sessions after several hours, but at times there were so many they caused the server to start using paging space. We wrote a SQL*Plus script to identify the abandoned sessions and kill them with command "alter system kill session <sid, serial#> immediate;". We automated the execution of the script a week ago. Today I noticed that in my udump directory an Oracle trace file has been created each time our script kills a session. A single trace file is created regardless of how many sessions are killed. No errors appear in the trace file.
    Is the creation of these trace files an indication that problems have occurred or are they there for information only?
    Since I know how and why the sessions are being killed, is it safe to ignore the trace files?
    Thank you,
    Bill

    The OS is AIX 5.2. The database server is 10.2.0.2. We are in the processing of upgrading to AIX 7.1 and database server 11.2.0.3.6.
    The script does not enable tracing for the SQL*Plus session.
    Below is the alert log message from a session killed at 11:22, and the corresponding trace file created at that same time:
    From alert_<sid>.log: 
    Wed Jul 31 11:22:01 2013
    Immediate Kill Session#: 1119, Serial#: 59885
    Immediate Kill Session: sess: 70000014dc4a7e0 OS pid: 267254
    /u02/admin/EXPRESS/udump $ ls -l express_ora_113358.trc
    -rw-r----- 1 oracle dba 2276 Jul 31 11:22 express_ora_113358.trc
    /u02/admin/EXPRESS/udump $ pg express_ora_113358.trc
    Dump file /u02/admin/EXPRESS/udump/express_ora_113358.trc
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    ORACLE_HOME = /u01/app/oracle/product/10.2.0
    System name: AIX
    Node name: navis
    Release: 2
    Version: 5
    Machine: 0005CD8C4C00
    Instance name: EXPRESS
    Redo thread mounted by this instance: 1
    Oracle process number: 225
    Unix process pid: 113358, image: oracleEXPRESS@navis
    *** ACTION NAME:() 2013-07-31 11:22:01.181
    *** MODULE NAME:(SQL*Plus) 2013-07-31 11:22:01.181
    *** SERVICE NAME:(EXPRESS.WORLD) 2013-07-31 11:22:01.181
    *** SESSION ID:(1723.61000) 2013-07-31 11:22:01.181
    SO: 70000014d44d278, type: 2, owner: 0, flag: INIT/-/-/0x00
    (process) Oracle pid=463, calls cur/top: 0/700000139166298, flag: (0) -
    int error: 0, call error: 0, sess error: 0, txn error 0
    (post info) last post received: 108 0 4
    last post received-location: kslpsr
    last process to post me: 70000014d36c398 1 6
    last post sent: 0 0 24
    last post sent-location: ksasnd
    last process posted by me: 70000014d36c398 1 6
    (latch info) wait_event=0 bits=0
    Process Group: DEFAULT, pseudo proc: 70000014d6aec00
    O/S info: user: oracle, term: UNKNOWN, ospid: 267254
    OSD pid info: Unix process pid: 267254, image: oracleEXPRESS@navis
    Short stack dump:
    ksdxfstk+002c<-ksdxcb+04e4<-sspuser+0074<-00004CB0<-nttrd+0120<-nsprecv+0750<-ns
    rdr+0114<-nsdo+1714<-nsbrecv+0040<-nioqrc+04a8<-opikndf2+0688<-opitsk+088c<-opii
    no+0990<-opiodr+0adc<-opidrv+0474<-sou2o+0090<-opimai_real+01bc<-main+0098<-__st
    art+0090
    Dump of memory from 0x070000014D2CC3B0 to 0x070000014D2CC5B8
    70000014D2CC3B0 00000004 00000000 07000001 39DA8D48 [............9..H]
    70000014D2CC3C0 00000010 0003139D 07000001 39166298 [............9.b.]
    70000014D2CC3D0 00000003 0003139D 07000001 4C73D508 [............Ls..]
    70000014D2CC3E0 0000000B 0003139D 07000001 4DC4A7E0 [............M...]
    70000014D2CC3F0 00000004 00031291 00000000 00000000 [................]
    70000014D2CC400 00000000 00000000 00000000 00000000 [................]
    Repeat 26 times
    70000014D2CC5B0 00000000 00000000 [........]
    Thanks,
    Bill

  • User cannot dropped after run "Kill Session" command

    Hi ,
    I’m facing problem with oracle user,
    Oracle 10G R(2).Windows Xp
    Application in .NET
    1)I create user:
    2)Then I check current session using this select”
    "SELECT SID, SERIAL# FROM V$SESSION WHERE UserName =
    3)Then I execute this statement from application”
    ALTER SYSTEM KILL SESSION '{sid},{serialno}' IMMEDIATE”
    4)In our scenario user is no more connected.
    5) Now when we run below this statement from application oracle gives an error”CANNOT DROP THE USER THAT IS CURRENTLY CONNECTED”
    DROP USER {0} CASCADE
    Please advice.
    Faheem Latif

    Comments embedded
    Hi ,
    I’m facing problem with oracle user,
    Oracle 10G R(2).Windows Xp
    Application in .NET
    1)I create user:Please post complete command
    >
    2)Then I check current session using this select”
    "SELECT SID, SERIAL# FROM V$SESSION WHERE UserName =
    Please post the complete command.
    3)Then I execute this statement from application”
    ALTER SYSTEM KILL SESSION '{sid},{serialno}'
    IMMEDIATE”
    Please post the complete command
    4)In our scenario user is no more connected. How did you verify? Please post the complete command.
    >
    5) Now when we run below this statement from
    application oracle gives an error”CANNOT DROP THE
    USER THAT IS CURRENTLY CONNECTED” So the user is still connected.
    Which user are you trying to drop? Yourself?
    Again, please post the complete command.
    >
    DROP USER {0} CASCADE
    Please advice.
    Faheem LatifMy advice is you either provide sufficient detail, including all commands, and stop relying on crystal balls and fortunetellers.
    No one here was looking over your shoulder, so no one can tell what happened, without you providing sufficient clues. I agree with you this is cumbersome, and doesn't comply with your custom to dump everything here, not doing any research yourself.
    Sybrand Bakker
    Senior Oracle DBA

  • Immediate kill session in alert log file

    hi..
    i'm using db10.2.0 ,windows 2003 server
    we're having alot of "immediate kill session " in the alert log file ,what could be causing it?
    the log file looks lsomething ike that
    Sat Oct 11 10:55:33 2008
    Thread 1 advanced to log sequence 2390
    Current log# 1 seq# 2390 mem# 0: D:\ORACLE\PRODUCT\10.2.0\ORADATA\ABS\REDO01.LOG
    Current log# 1 seq# 2390 mem# 1: E:\DATABASE\ABS\REDO_LOGS\REDO01B.LOG
    Sat Oct 11 11:08:23 2008
    Immediate Kill Session#: 196, Serial#: 96
    Immediate Kill Session: sess: B7A4F764 OS pid: 2744
    Sat Oct 11 11:08:27 2008
    Immediate Kill Session#: 183, Serial#: 62
    Immediate Kill Session: sess: B823F4D0 OS pid: 2348
    Sat Oct 11 11:08:33 2008
    Immediate Kill Session#: 198, Serial#: 68
    Immediate Kill Session: sess: B7A50A2C OS pid: 2856
    Sat Oct 11 11:08:33 2008
    Immediate Kill Session#: 77, Serial#: 349
    Immediate Kill Session: sess: B8201168 OS pid: 5704
    Sat Oct 11 11:08:34 2008
    Immediate Kill Session#: 156, Serial#: 257
    Immediate Kill Session: sess: B7A37FC4 OS pid: 3428
    Sat Oct 11 11:08:41 2008
    Immediate Kill Session#: 92, Serial#: 104
    Immediate Kill Session: sess: B7A126C4 OS pid: 3500
    Sat Oct 11 11:08:45 2008
    Immediate Kill Session#: 178, Serial#: 17
    Immediate Kill Session: sess: B7A44E5C OS pid: 3408
    Sat Oct 11 11:08:51 2008
    Immediate Kill Session#: 180, Serial#: 43
    Immediate Kill Session: sess: B7A46124 OS pid: 1592
    Sat Oct 11 11:08:56 2008
    Immediate Kill Session#: 81, Serial#: 310
    Immediate Kill Session: sess: B82036F8 OS pid: 5088
    Sat Oct 11 11:08:57 2008
    Immediate Kill Session#: 114, Serial#: 290
    Immediate Kill Session: sess: B7A1F55C OS pid: 952
    Sat Oct 11 11:09:02 2008
    Immediate Kill Session#: 104, Serial#: 117
    Immediate Kill Session: sess: B7A19774 OS pid: 4068
    Sat Oct 11 11:09:11 2008
    Immediate Kill Session#: 177, Serial#: 20
    Immediate Kill Session: sess: B823BC78 OS pid: 2024
    Sat Oct 11 11:09:16 2008
    Immediate Kill Session#: 145, Serial#: 34
    Immediate Kill Session: sess: B8228FF8 OS pid: 4012
    Sat Oct 11 11:09:18 2008
    Immediate Kill Session#: 72, Serial#: 265
    Immediate Kill Session: sess: B7A06AF4 OS pid: 5592
    Sat Oct 11 11:09:28 2008
    Immediate Kill Session#: 176, Serial#: 9
    Immediate Kill Session: sess: B7A43B94 OS pid: 1988
    Sat Oct 11 11:09:37 2008
    Immediate Kill Session#: 148, Serial#: 118
    Immediate Kill Session: sess: B7A334A4 OS pid: 1216
    Sat Oct 11 11:09:41 2008
    Immediate Kill Session#: 110, Serial#: 1190
    Immediate Kill Session: sess: B7A1CFCC OS pid: 2152
    Sat Oct 11 11:09:46 2008
    Immediate Kill Session#: 141, Serial#: 488
    Immediate Kill Session: sess: B8226A68 OS pid: 5460
    Sat Oct 11 11:09:51 2008
    Immediate Kill Session#: 130, Serial#: 96
    Immediate Kill Session: sess: B7A28B9C OS pid: 1312
    Sat Oct 11 11:10:48 2008
    Immediate Kill Session#: 101, Serial#: 1592
    Immediate Kill Session: sess: B820F2C8 OS pid: 5936
    Sat Oct 11 11:10:57 2008
    Immediate Kill Session#: 170, Serial#: 5
    Immediate Kill Session: sess: B7A4033C OS pid: 3356
    Sat Oct 11 11:11:05 2008
    Immediate Kill Session#: 138, Serial#: 46
    Immediate Kill Session: sess: B7A2D6BC OS pid: 3156
    Sat Oct 11 11:11:06 2008
    Immediate Kill Session#: 111, Serial#: 1143
    Immediate Kill Session: sess: B82150B0 OS pid: 5056
    Sat Oct 11 11:11:09 2008
    Immediate Kill Session#: 132, Serial#: 228
    Immediate Kill Session: sess: B7A29E64 OS pid: 1628
    Sat Oct 11 11:11:10 2008
    Immediate Kill Session#: 150, Serial#: 560
    Immediate Kill Session: sess: B7A3476C OS pid: 2568
    Sat Oct 11 11:11:12 2008
    Immediate Kill Session#: 155, Serial#: 165
    Immediate Kill Session: sess: B822EDE0 OS pid: 3484
    Sat Oct 11 11:11:18 2008
    Immediate Kill Session#: 165, Serial#: 90
    Immediate Kill Session: sess: B8234BC8 OS pid: 1968
    Sat Oct 11 11:11:36 2008
    Immediate Kill Session#: 116, Serial#: 221
    Immediate Kill Session: sess: B7A20824 OS pid: 4848
    Sat Oct 11 11:11:37 2008
    Immediate Kill Session#: 192, Serial#: 54
    Immediate Kill Session: sess: B7A4D1D4 OS pid: 3972
    Sat Oct 11 11:11:45 2008
    Immediate Kill Session#: 164, Serial#: 98
    Immediate Kill Session: sess: B7A3CAE4 OS pid: 3888
    Sat Oct 11 11:11:45 2008
    Immediate Kill Session#: 121, Serial#: 17
    Immediate Kill Session: sess: B821AE98 OS pid: 1200
    Sat Oct 11 11:11:50 2008
    Immediate Kill Session#: 109, Serial#: 330
    Immediate Kill Session: sess: B8213DE8 OS pid: 3456
    Sat Oct 11 11:11:56 2008
    Immediate Kill Session#: 181, Serial#: 68
    Immediate Kill Session: sess: B823E208 OS pid: 3324
    Sat Oct 11 11:12:17 2008
    Immediate Kill Session#: 214, Serial#: 85
    Immediate Kill Session: sess: B7A5A06C OS pid: 2752
    Sat Oct 11 11:12:20 2008
    Immediate Kill Session#: 209, Serial#: 346
    Immediate Kill Session: sess: B824E8F8 OS pid: 3844
    Sat Oct 11 11:12:23 2008
    Immediate Kill Session#: 154, Serial#: 152
    Immediate Kill Session: sess: B7A36CFC OS pid: 3400
    Sat Oct 11 11:12:26 2008
    Immediate Kill Session#: 147, Serial#: 86
    Immediate Kill Session: sess: B822A2C0 OS pid: 2536
    Sat Oct 11 11:12:34 2008
    Immediate Kill Session#: 79, Serial#: 1504
    Immediate Kill Session: sess: B8202430 OS pid: 4052
    Sat Oct 11 11:12:47 2008
    Immediate Kill Session#: 189, Serial#: 234
    Immediate Kill Session: sess: B8242D28 OS pid: 2128
    Sat Oct 11 11:13:10 2008
    Immediate Kill Session#: 118, Serial#: 95
    Immediate Kill Session: sess: B7A21AEC OS pid: 3480
    Sat Oct 11 11:13:13 2008
    Immediate Kill Session#: 94, Serial#: 16
    Immediate Kill Session: sess: B7A1398C OS pid: 2140
    Sat Oct 11 11:14:24 2008
    ALTER SYSTEM SET service_names='aba10g' SCOPE=MEMORY SID='abs';
    Sat Oct 11 11:14:59 2008
    Immediate Kill Session#: 97, Serial#: 1197
    Immediate Kill Session: sess: B820CD38 OS pid: 4164
    Sat Oct 11 11:15:07 2008
    Immediate Kill Session#: 163, Serial#: 237
    Immediate Kill Session: sess: B8233900 OS pid: 3224
    Sat Oct 11 11:15:19 2008
    Immediate Kill Session#: 140, Serial#: 230
    Immediate Kill Session: sess: B7A2E984 OS pid: 1584
    Sat Oct 11 11:15:41 2008
    Thread 1 advanced to log sequence 2391
    Current log# 4 seq# 2391 mem# 0: D:\ORACLE\PRODUCT\10.2.0\ORADATA\ABS\REDO4.LOG
    Current log# 4 seq# 2391 mem# 1: E:\DATABASE\ABS\REDO_LOGS\REDO04B.LOG
    Sat Oct 11 11:15:51 2008
    Immediate Kill Session#: 88, Serial#: 541
    Immediate Kill Session: sess: B7A10134 OS pid: 4676
    Sat Oct 11 11:16:09 2008
    Immediate Kill Session#: 78, Serial#: 358
    Immediate Kill Session: sess: B7A0A34C OS pid: 6056

    2011-06-27 02:27:12.215: [    RACG][261091968] [24623][261091968][ora.rac.rac1.inst]: clsrcqryapi: crs_qstat error
    2011-06-27 02:27:12.215: [    RACG][261091968] [24623][261091968][ora.rac.rac1.inst]: clsrcpullupvip: Failed to get status of ora.srv01-025.vip
    2011-06-27 02:27:12.810: [    RACG][282473088] [24623][282473088][ora.rac.rac1.inst]: clscconnect failed with clsc ret 9
    2011-06-27 02:27:12.811: [    RACG][282473088] [24623][282473088][ora.rac.rac1.inst]: error connecting to CRSD at [(ADDRESS=(PROTOCOL=IPC)(KEY=CRSD_UI_SOCKET))] clsccon 184
    2011-06-27 02:27:12.811: [    RACG][261091968] [24623][261091968][ora.rac.rac1.inst]: clsrcqryapi: crs_qstat error
    2011-06-27 02:27:13.237: [    RACG][261091968] [24623][261091968][ora.rac.rac_srv.cs]: clsrcqryapi: crs_qstat error
    2011-06-27 02:27:13.625: [    RACG][261091968] [24623][261091968][ora.rac.rac_srv.rac1.srv]: clsrcqryapi: crs_qstat error
    2011-06-27 02:27:13.625: [    RACG][261091968] [24623][261091968][ora.rac.rac_srv.rac1.srv]: clsrcsmfread: cannot get status of resource 'ora.rac.rac_srv.rac1.srv'
    2011-06-27 02:27:15.829: [  OCRMSG][261091968]prom_rpc: CLSC send failure..ret code 11
    2011-06-27 02:27:15.829: [  OCRMSG][261091968]prom_rpc: possible OCR retry scenario
    2011-06-27 02:27:15.881: [  OCRAPI][261091968]procr_open: Node Failure. Attempting retry #0
    2011-06-27 02:27:16.096: [    RACG][261091968] [24623][261091968][ora.rac.rac_srv.rac1.srv]: clsrcqryapi: crs_qstat error
    Edited by: user13481820 on Jun 26, 2011 10:53 PM

Maybe you are looking for

  • PC TO TV

    Hi! Until such time as I can afford a bigger monitor, I would like to connect my TV to my PC. My TV has the red/white/yellow plugin and S-Video plugin while my desktop has the DVI and HDMI ports. What should I buy to convert the signal? Shaylin

  • Success stories for HTMLDB required !

    Hello ! Is anybody knows success stories for HTMLDB - please share information !!! Thanks in advance, Viacheslav

  • Best online resource for HD workflow

    I'll be working in NTSC but don't know if the production company is shooting at 23.98, 24, 29.97, 30, 59.94, 60. Is there a site that covers all the possibilities from off-line to on-line?

  • APEx reports - Groups

    Hi, I have the following requirement to do either in classing or IR report. Please help. Here is my queries output 5     John Smith     HRA     HR Concepts     01/01/12     12/28/12     5421100001     Y     Y 5     John Smith     HRA     HR Concepts 

  • Problem with action script to button

    Hello all. I'm having a problem with my adobe flash CS3 action script. My button cant link to the other URL. I tried to put an action script but i fail. anyone can help me? here the attachment for my flash document.