"User session ID does not exist" - Oracle - oracle

When using alter system kill session, I have the ora-00030 alert as per subject.
Therefore I am not able to kill it, is there any other method to kill an Oracle session?
Why is this happening? When executing "select sid, serial# from v$session where sid=.....", I do get an output

Related

After connect and script execution back to previous sql plus session possible?

sqlplus dba/foo#bar #test.sql;
with test.sql:
SELECT user FROM dual;
USER
-------
dba
CONNECT foo/foo#bar;
SELECT user FROM dual;
USER
-------
foo
DISCONNECT; -- My problem: Doesn't go back to dba session.
SELECT user FROM dual;
SP2-0640: Not connected
How can I go back to previous SQL Plus session (here dba) without open a new SQL Plus session? But: I don't have the login credentials for dba available within script test.sql because the initial SQL Plus session for dba is created outside in a shell script!
SQL Plus: Release 11.2.0.3.0 Production
DISCONNECT; -- My problem: Doesn't go back to dba session.
Of course; you said you want to disconnect, not to connect as someone else. Instead of that, use
connect dba/foo#bar

dbms_utility.exec_ddl_statement doesn't work

I want to kill session over dblink however dbms_utility.exec_ddl_statement doesn't work.
Below command doesn't throw any error but also it doesn't kill the session.
exec dbms_utility.exec_ddl_statement#dblink('Alter system kill session ''274,12303,#1'' immediate');
It appears that you want to kill session which resides in a remote database. If that's so,
create a procedure in that (remote) database
it would kill session
one option is to use dynamic SQL to do that (i.e. execute immediate)
which one? The one whose parameters will be passed as procedure's arguments
call the procedure over the database link
I assume that the session with sid=274, serial=12303 on node=1 is running a heavy DML/DDL statement, and that by saying "it doesn't kill session" you mean that the session is seen as ACTIVE in GV$SESSION after the command is run.
That is an expected behavior. As counter-intuitive as it may be, KILL SESSION doesn't really "kill" session - it sends a kill signal which the session will respect after it's current work is done. Not before. So not an option for the assumed scenario.
Two other options:
ALTER SYSTEM DISCONNECT SESSION '274,12303,#1' IMMEDIATE
kill OS process.
ORACLE-BASE article
P.S. dbms_utility.exec_ddl_statement#dblink(q'!Alter system kill session '274,12303,#1' immediate!'); alternative quoting mechanism. No more double-ticks since 10g.

Killing active and inactive sessions in oracledb

I am trying to execute stored procedure package changes from sql developer console and oracle session hangs. For now I am killing the oracledb and launching it again
I checked stackoverflow regarding the issue and came across a similar question How to kill all active and inactive oracle sessions for user which suggests the following queries to kill hanging sessions
SELECT sid, serial#, status FROM v$session;
ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;
But on executing them I get
"table or view does not exist"
Can someone help me with queries to fetch all sessions and killing hanging sessions in oracledb ?

How to terminate Oracle procedures which is running

I created an oracle procedure. When i execute it from sqldevoloper in some case i think it is going into an infinite loop. It keeps on generating the log files. How can i terminate this running procedure?
I stopped the oracle service through services.msc . When i start it again , log files are getting generated. I think still that procedure is running.
How can i terminate those procedures.
Identify your session (hung) from v$session using
select sid, serial#, status from v$session where USERNAME='NAME';
And then kill it using
ALTER SYSTEM KILL SESSION 'SID,#SERIAL';
ALTER SYSTEM KILL SESSION
But you have to retrieve session id and have rights.

How in Oracle kill user session silent or reproduce error 17410?

I need to test robustness of my application for problem with network. But I don't have access to network physically. I have only access to Oracle as SYS. Does it possible may be silent kill user session so when application try to get data from connection jdbc driver will generate error 17410 ?
oracle: No more data to read from socket
When I try to kill session by sid - oracle send alert about killed session and this is not 17410 error.
You can raise any error code with PRAGMA EXCEPTION_INIT.
DECLARE
e_no_more_data EXCEPTION
pragma exception_init( e_no_more_data , -17410 );
BEGIN
RAISE e_no_more_data;
END;
/
Don't know if it really simulates the error.
If you have access to only the database and you know the SID and Serial of the session you are trying to kill, you can issue
ALTER SYSTEM KILL SESSION 'sid,serial#';
Check this link for more options.
http://www.oracle-base.com/articles/misc/killing-oracle-sessions.php

Resources