Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4046424
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:33:40+00:00 2026-05-20T13:33:40+00:00

I have 11g installed locally on my machine (Windows 7 64bit). When I have

  • 0

I have 11g installed locally on my machine (Windows 7 64bit).

When I have disconnected all my clients from my oracle (ie no sqlplus running, no weblogic running) and then reconnect using sqlplus and I run the following script:

SQL> set linesize 120
SQL> SELECT            s.sid,
  2                    s.serial#,
  3                    s.username,
  4                    s.program
  5    from v$session s
  6    where username is not null;
       SID    SERIAL# USERNAME                       PROGRAM
---------- ---------- ------------------------------ ----------------------------------------------------------------
       134      11274 FOO                         ORACLE.EXE (J000) <-- I want to remove this connection
       139      19140 MYADMIN                        sqlplus.exe       <-- My connection
       155       8941 FOO                         ORACLE.EXE (J001) <-- I want to remove this connection
SQL>

So I am trying to programmatically remove the connections that I have labelled in blue.

I am using the following:

SQL> ALTER SYSTEM DISCONNECT SESSION  134,11274  IMMEDIATE;
ALTER SYSTEM DISCONNECT SESSION  134,11274  IMMEDIATE
                                 *
ERROR at line 1:
ORA-00026: missing or invalid session ID

Is this not the correct way? I have also tried

ALTER SYSTEM DISCONNECT SESSION  '134,11274'  IMMEDIATE;

When I try running the above again I will get the error message:

SQL> ALTER SYSTEM DISCONNECT SESSION  '134,11274'  IMMEDIATE;
ALTER SYSTEM DISCONNECT SESSION  '134,11274'  IMMEDIATE
*
ERROR at line 1:
ORA-00031: session marked for kill

So the connection doesn’t seem to really go away.

I want to have a script that forces all ‘FOO’ connections to be terminated so that my build will run properly. But my script is not working. Do you have any ideas? The only reliable way I can get rid of connections is to reboot. Stopping and starting the service sometimes works – but not always – which is really weird.

Here’s my PL/SQL script that I ultimately want to be able to run.

SET SERVEROUTPUT ON 
SET LINESIZE 120
DECLARE
   theKillCmd VARCHAR2(1000);

   PROCEDURE msg(msg VARCHAR2) AS 
   BEGIN
        DBMS_OUTPUT.PUT_LINE(msg);
   END;


BEGIN

msg(' . ');
msg(' . ');
msg('Killing extraneous sessions.');
msg(' . ');
msg(' . ');

for conn in (SELECT    s.sid,
         s.serial#,
         s.username,
         s.program
  FROM   v$session s
  WHERE s.USERNAME IS NOT NULL) 
loop

  msg( '.     ' || conn.sid || ' ' || conn.serial# || ' ' ||  conn.username || ' ' || conn.program );
  IF (conn.username = 'FOO') THEN
     -- Following asks client process to kill itself
     -- theKillCmd := 'ALTER SYSTEM KILL SESSION ''' ||  conn.sid || ',' || conn.serial# || ''' IMMEDIATE ';
     -- Following tells server to kill process 
     theKillCmd := 'ALTER SYSTEM DISCONNECT SESSION ' ||  conn.sid || ',' || conn.serial# || ' IMMEDIATE ';
     msg( '.           ' || 'Killing connection using command : ' || theKillCmd );
     EXECUTE IMMEDIATE theKillCmd ;
  ELSE
     msg('.           Ignoring .. ');
  END IF;

end loop;


END;
/

-- exit;

So if anyone has any ideas that would be appreciated.

I’m wondering if maybe I somehow botched the oracle installation – I don’t want to yet go down the path of re-installing – would rather have a script that just kills oracle connections before I run ant oracle.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T13:33:41+00:00Added an answer on May 20, 2026 at 1:33 pm

    That Jnnn (J000 and J001) syntax indicates it is a “Job Queue Slave Process”. If you kill it, the scheduler will probably just restart it.

    Look at the appropriate DBMS_JOB or DBMS_SCHEDULER API.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client running a WebLogic 11g install on a Windows Server machine
I have the Oracle client, weblogic and the SOA suite 11g installed on a
I have installed Oracle Database 11g Express Edition on my pc (windows 7) and
I have Oracle 11G R2 running on M-4000 machine (supposedly a powerful machine). Recently,
I have a Java application running in WebLogic 11g on Windows, which after several
I have a server with both 10g and 11g clients installed. How do I
To whom it may respond to, We have installed Oracle 11g r2 on a
I have an issue with DBMS_AQ.deQueue on an Oracle 11g R2 Windows 2008 R2
I have installed Visual Studio 2010 and Oracle 11g in my Window 7. Oracle
I have successfully installed Oracle 11g R2 version. I don't have good knowledge about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.