To disconnect inactive sessions
Hello, I have a BD profile, which has formed 30 minutes in the option Idle Time, I understand that this is so that after 30 minutes of inactivity, the session becomes disconnected, this is correct? Because I have made a test, leaving the connection without activity by that time interval, and nevertheless the connection follows lives, that I can do? or that it needs to me to form, thank you very much.
Hi,
and nevertheless the connection follows livesMy notes here might help:
http://www.dba-oracle.com/tips_killing_oracle_sessions.htm
http://www.dba-oracle.com/t_sessions.htm
Hope this helps. . .
Don Burleson
Oracle Press author
Similar Messages
-
Disconnection leaves inactive sessions
Hi I am new to this forum, I have looked but cannot find any reference to my problem, apologies if it has been discussed earlier.
When in SQLDev (EA2 and also earlier versions) on windows2000prof v5 sp4, when I disconnect from a connection inactive sessions are still on the DB (9i r2), this for reasons I won't go into here causes us problems. We have to save all our work and exit sqldev then restart to ensure connections disappear.
I assume this is so connections are reused if you reconnect, and on the face of it seems reasonable, however, it is a problem for us.
Is there some config I can do to stop this behaviour either by connection or for all connections ?
Help appreciated.
btw really like this product, EA2 now has support for AQ's and Materialised views which we use ( we have now decided not to renew TOAD licences because sqldev seems to be mature enough for our purposes now - and is cheaper :-) )
Message was edited by:
CharlieColsonMany thanks for your reply.
I am not doing anything special, it must be designed behaviour because as soon as I exit sqldev the sessions are gone :-
open a connection
run some sql in a worksheet, close worksheet
disconnect from the connection using the connection tree
inactive sessions remain on the database, one for connection and one for insight.
I was hoping that there is some java/config/connection setting I could use, it dosen't happen from TOAD so I can't think it is server behaviour ( and neither does my DBA ).
Cheers -
Inactive sessions of oracle consume resources?
We Red Hat and Data Base Oracle 10g.
Gracias y saludos.Please define 'inactive session'.
I see several possible definitions. A few of the more likely include:
- a session that is still connected to the end client, and therefore prepared to perform some work and therefore will consume resources
- a session that has been forcibly disconnected and is rolling back or waiting to roll back, and is therefore consuming resources
- a Linux or Unix zombie session, which may still hold memory but no CPU cycles
Depending on the tools used to report the information, the SGA memory may be reported again and again for each session's process. This can cause some alarming interpretations. -
Inactive sessions accumulate exceed the max session
Hi All,
once i checked the v$session, always find lots of inactive session.nearly after two month it will exceed the max session value in the init.ora profile.
I have check the sqlnet.ora profile and the value of expire_time is 10 minuter, while not sure why so many inactive session? and if i need to kill all inactive session?
Best Regards,
ChelseaINACTIVE users are users not actively running a query, but they are connected to the database.
If SQL expire time is set, you can verify the logfiles, if users get disconnected because of idle connections.
For the remainder I agree with the other post.
Cheers
FJFranken -
So many INACTIVE sessions in Database
Hi,
Actually PMON will clears all inactive sessions from database.
But i can see there are sessions like more then 3,4 days old.
Why PMON is not clearing them. ?
On which intervals will PMON do inactive sessions cleaning.
thanks in Advance.>
But i can see there are sessions like more then 3,4 days old.
>
Heed the advice of the other responders.
But for idle sessions that you want cleared immediately you can use
ALTER SYSTEM DISCONNECT SESSION . . . IMMEDIATENOTE - this acts differently than the 'KILL SESSION' syntax typically used.
See 'DISCONNECT SESSION' clause in the SQL Language reference section for ALTER SYSTEM
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.
>
Then contrast that with the text for KILL SESSION -
JDBC sessions timout - for inactive sessions
how can i define the timeout of inactive sessions (connections) on oracle database thru JDBC connetionPool technology - to de disconnected physically, is there a default timeout for the sessions to be disconnected.?
thanks for any help.The following is the Data Source that I am using:
<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE data-sources PUBLIC "Orion data-sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
<data-sources>
<data-source
name="jdev-connection-Teradata"
class="com.evermind.sql.DriverManagerDataSource"
location="jdbc/TeradataCoreDS"
xa-location="jdbc/xa/TeradataXADS"
ejb-location="jdbc/TeradataDS"
pooled-location="jdbc/TeradataPooledDS"
connection-driver="com.ncr.teradata.TeraDriver"
username="GavinLDCHBull"
password="xxxxxx"
url="jdbc:teradata://FONEBONE/DATABASE=HABWaiver"
inactivity-timeout="30">
</data-source>
</data-sources>
We are using the ADF framework (i.e. entities and simple views) for accessing all Teradata data. I do not explicitly issue any JDBC calls for accessing the data. When I update the data, I use JDBC calls to initiate stored procedures. However, the problem (not closing the statements) happens almost immediately after starting the application, and prior to issuing any stored procedures.
I have not tried to duplicate the problem using a simple java program because I am using ADF for data access (again, I don't explicitly issue any JDBC statements). -
PL/SQL procedure to kill inactive session
Hi all ,
Please i am trying to write a procedure to kill inactive sessions of the shema 'TESTSCHEMA' .This is my first procedure , am not use to pl/sql but i went through many turtorial but have some errors at compliation .when i try to compile the procedure the errors are as below :
15:50:28 Start Find Objects [TESTSCHEMA@TESTDB_UNIX(2)] ...
15:50:28 End Find Objects [TESTSCHEMA@ TESTDB_UNIX(2)]
15:50:32 Start Compiling 1 object(s) ...
15:50:32 Executing ALTER PROCEDURE fib_dead_cnx_cleanup COMPILE ...
15:50:32 [13:2] PL/SQL: ORA-00933: SQL command not properly ended
15:50:32 [9:3] PL/SQL: SQL Statement ignored
15:50:32 [18:12] PLS-00103: Encountered the symbol "(" when expecting one of the following:
15:50:32 constant exception <an identifier>
15:50:32 <a double-quoted delimited-identifier> table LONG_ double ref
15:50:32 char time timestamp interval date binary national character
15:50:32 nchar
15:50:32 The symbol "<an identifier>" was substituted for "(" to continue.
15:50:32 [18:21] PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
15:50:32 := ; not null default character
15:50:32 The symbol "; was inserted before "LOOP" to continue.
15:50:32 [27:8] PLS-00103: Encountered the symbol "ALTER" when expecting one of the following:
15:50:32 begin case declare exit for goto if loop mod null pragma
15:50:32 raise return select update while with <an identifier>
15:50:32 <a double-quoted delimited-identifier> <a bind variable> <<
15:50:32 close current delete fetch lock insert open rollback
15:50:32 savepoint set sql execute commit forall merge pipe
15:50:32 Compilation complete - 5 error(s) found
15:50:32 End Compiling 1 object(s)
below is the procedure code :
CREATE OR REPLACE
PROCEDURE fib_dead_cnx_cleanup
AS
l_serial CHAR(100);
l_sid CHAR (100);
l_sid_serial CHAR(100);
l_count NUMBER(10,0);
CURSOR session_cur IS
SELECT sid,serial#,sid||','||serial# as sid_serial
FROM v$session
WHERE username='EBBFCAT' and schemaname='TESTSCHEMA'
and status='INACTIVE'
BEGIN
BEGIN
l_count := 0;
OPEN session_cur;
WHILE ( 1 = 1) LOOP
BEGIN
FETCH session_cur INTO l_sid ,l_serial,l_sid_serial ;
EXIT WHEN session_cur%NOTFOUND ;
BEGIN
alter system kill session 'l_sid_serial' ;
END;
END;
END;
CLOSE session_cur;
END;
END FIB_DEAD_CNX_CLEANUP;
ThanksHi,
Never write, let alone post, unformatted code.
When posting any formatted text on this site, type these 6 characters:
{code}
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
Among the benefits of formatting: you can indent to show the extent of blocks, such as BEGIN-END.
Different types of blocks need modifiers after the end, such as "END *IF* " and " END *LOOP* ". If each opening statement (BEGIN, IF, LOOP) is directly above its corresponding END, then it's easy to check if you got the right modifier.
Here's what you code looks like with some formatting, and a couple of corrections added. Look for -- comments.
CREATE OR REPLACE
PROCEDURE fib_dead_cnx_cleanup
AS
l_serial CHAR(100);
l_sid CHAR (100);
l_sid_serial CHAR(100);
l_count NUMBER(10,0);
CURSOR session_cur IS
SELECT sid
, serial#
, sid || ','
|| serial# as sid_serial
FROM v$session
WHERE username = 'EBBFCAT'
and schemaname = 'TESTSCHEMA'
and status = 'INACTIVE'; -- need semicolon here
BEGIN
BEGIN -- Why?
l_count := 0;
OPEN session_cur;
WHILE ( 1 = 1)
LOOP
BEGIN -- Why?
FETCH session_cur
INTO l_sid
, l_serial
, l_sid_serial ;
EXIT WHEN session_cur%NOTFOUND ;
BEGIN -- Why?
alter system kill session 'l_sid_serial' ; -- Not a PL/SQL command
END;
END;
END LOOP; -- LOOP ends with END LOOP
CLOSE session_cur;
END;
END FIB_DEAD_CNX_CLEANUP;Take baby steps.
I've been wrtiing PL/SQL for 20 years, and I would never write that much code at once. If you're a beginner, all the more reason to start small. Write as little as possible, test, debug and test again (if necessary). When you have someting working, add 2 or 3 more lines and test again.
It looks like you have three BEGIN statements that don't serve any purpose. You should get rid of them (and their corresponding END statements, of course).
One error I did not fix: ALTER SYSTEM is not a PL/SQL statement. It's a SQL statement. You can run a SQL statement inside PL/SQL by using dynamic SQL, where you construct a string containing the SQL statement, and then use dbms_sql or EXECUTE IMMEDIATE to run it.
Edited by: Frank Kulash on Aug 18, 2009 12:37 PM -
Cannot log back into a disconnected RD session
I have a 2012 R2 domain server that I RD into frequently. None of the GPO's I have are effecting RD. I need to have the ability to disconnect a RD session and reconnect to the same session. It seems like after about 20min the disconnected session just disappears
and anything i had running in it closes. I have tried setting the local policies without luck. secpol > local policies > security options > Microsoft network server: Amount of idle time required before suspending session to 1440.
gpedit.msc on local machine
Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Session Time Limits\ all to disable
User Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Session Time Limits\ all to disable
Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Connections\Configure keep-alive connection interval to Disabled
Computer Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Connections\Restrict Remote Desktop Services users to a single Remote Desktop Services session to Enable
I have tried to add remote desktop services\remote desktop session host but it wants a license server and this is only on a local machine. How can i get the ability to log back into a disconnected RD session. Like we were able to do before 2012?
Thanks in advance for your help.
Thanks for your helpHi,
The behavior could be caused by domain group policy settings, I would suggest you double check group policy settings by running command below:
GPresult /h filepath:filename.
More information for you:
Gpresult
https://technet.microsoft.com/en-us/library/cc733160.aspx?f=255&MSPPError=-2147217396
Best Regards,
Amy
Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Iam in need of a script to kill all the inactive sessions in the database and the same script should kill all the pid related in the OS also.
can anyone send me a scripts or any input on this will be of great help ?
KaiKaiS,
See both functions and wrap around in your unix script, this should magic for you I suppose :) and you should replace sqlplus "/as sysdba" by sqlplus '/as sysdba'
*function readSqlstmt {*
typeset stmt=$1
echo "
set feedback off
set verify off
set heading off
set pagesize 0
whenever sqlerror exit 1
whenever oserror exit 2
*$stmt;*
exit
*" | sqlplus -S "/as sysdba" >> test.log*
function killpid {
killpidsql=killpid.sql
sqlplus -s "/as sysdba" << ENDOFSQL >> test.log
whenever sqlerror exit 1
whenever oserror exit 2
SET pagesize 0
SET verify off
SET feedback off
SPOOL ${killpidsql}
SELECT 'ALTER system kill session ''' || s.sid || ',' || s.serial# || ''';'
FROM v\$session s, v\$process p
WHERE s.paddr = p.addr AND s.status = 'INACTIVE';
SPOOL OFF
@${killpidsql}
ENDOFSQL
Example: How to use above readSqlstmt function, to kill unix process id and call "killpid" to kill sessions from oracle.
*readSqlstmt "SELECT p.spid FROM v\$session s, v\$process p WHERE s.paddr = p.addr AND s.status = 'INACTIVE'" | while read u*
*do*
* #echo "kill -9" $u >> test.log*
* echo $u*
*done*
*Regards*
Edited by: OrionNet on Dec 10, 2008 10:52 PM
Edited by: OrionNet on Dec 10, 2008 10:54 PM -
Inactive sessions in v$session
Hi,
why there are so many apps user inactive sessions in v$session?
RegardsHi Hussein,
The process which are arctive are shown as inactive in v$session view,We cannot trust the status column of this view,By default as soon the apps is started the oracle is creating around 82 to 85 apps processes which are inactive but i think they are active.
The option referenced above is a good one to follow in this situation
A discussion of Dead Connection Detection, Resource Limits, V$SESSION, V$PROCESS and OS processes
Thanks Hussein and Anchorage
Regards -
Inactive sessions in v$session. True problem
Hi,
I am working in an Oracle 9i/Weblogic/J2EE platform. And when i look for session info in v$session view, i see that there are many sessions that have a status "Inactive". I already figured out what it means- the session is ACTIVE when it is doing an SQL query at the time and the session is INACTIVE when it is not doing an SQL query at that particular moment.
But i have questions:
1) If a client logs in to my webapplication and does a SQL query- then the sessions status is ACTIVE. After that, when the client just leaves (logs out just closes the browser) then Oracle marks that connection as 'INACTIVE'- Oracle does not KILL that session.
Ok let that be, but can another client then log in to my webapplication (from different computer) and get that same INACTIVE connection and start to use it?? If not, then these "abandoned" connection are truly useless, because they still use ORACLE resources (memory).
2)Another thing is that there are many INACTIVE sessions in v$session that have a name "plsqldev.exe" in PROGRAM column. That is a database client that i use to connect directly to my DB. But basicly i have only one PL/SQL program with one SQL query window open (this session is marked ACTIVE in v$session). So are these other 10 INACTIVE "plsqldev.exe" sessions meant for new plsql clients that may start to use the database or can only that particular user for whom the session was created at first place use that session?
And finally- sessions that are INACTIVE and have "plsqldev.exe" as a PROGRAM in v$session - is there any chance that a client logs in to webapplication and then gets that INACTIVE session?
If not, then these 10 INACTIVE plsqldev sessions (allthough the user has maybe shut down the program) are wasteless for webapplication users and they just starve the database.
Also a screenshot for illustration.
Waiting for your comments,
Thanks!If connection pooling is in use then yes a different end-user can reuse the "inactive" session. Remember that ACTIVE and INACTIVE really only refers to if the session is executing SQL at the exact moment you query v$session.
In the case of a dedicated user connection using a product like Oracle Forms where the user spends much of the time reading and filling in screen fields the Oracle background session can show INACTIVE almost constantly because the queries being ran by the user are very fast.
Take a look at the last_call_et column. This is the time in seconds from when the last SQL statement was issued (not completed). If this value is resetting then the queries are being done.
If the time is large and the status is INACTIVE then you could have a 'dead' or 'runaway' background process which is a background process without a front-end process. Those can and should be terminated. For that matter sessions that are idle for long periods of time should probably also be killed. If nothing else runaway and idle sessions may make it appear you are using all your licensed connections even if you really are not.
Most connection pools wil automatically restart a terminated connection so if you clean-up process terminates an idle pooled connection it should not be a problem.
HTH -- Mark D Powell -- -
We are using Oracle 11 as a backend to PowerSchool (a student information system) with 6 application servers (dc-ps-01 thru -06). Using the following SQL, we are seeing numerous INACTIVE sessions vs ACTIVE.
select
count(b.machine) as mCount,
b.machine box,
b.status,
b.osuser os_user,
b.program program
from
v$session b, v$process a
where
b.paddr = a.addr and type='USER'
group by
b.machine,b.osuser,b.program,b.status
order by
b.status, mCount desc, box;
Sample output:
MCOUNT Box Status OS_USER Program
*2 DC-PS-01* ACTIVE powerschool JDBC Thin Client
1 DC-PS-DB1 ACTIVE DC-PS-DB1$ OMS
1 DC-PS-DB1 ACTIVE SYSTEM ORACLE.EXE (J001)
1 DC-PS-DB1 ACTIVE SYSTEM ORACLE.EXE (J000)
406 DC-PS-05 INACTIVE powerschool JDBC Thin Client
*44 DC-PS-01* INACTIVE powerschool JDBC Thin Client
36 DC-PS-03 INACTIVE powerschool JDBC Thin Client
32 DC-PS-04 INACTIVE powerschool JDBC Thin Client
28 DC-PS-02 INACTIVE powerschool JDBC Thin Client
17 DC-PS-06 INACTIVE powerschool JDBC Thin Client
7 DC-PS-DB1 INACTIVE DC-PS-DB1$ OMS
While the number of ACTIVE sessions fluctuate, the number of INACTIVE ones do not decrease. Would someone explain the internal working of this?
Thanks!Note that the status column of v$session only shows ACTIVE while the Oracle session background process is busy performing a SQL statement on behalf of the front-end session. If the application spends most of its time with the user entering data onto or reading results off a screen then the session is going to appear INACTIVE most of the time in Oracle.
Also check the last_call_et to see how long it has been since the session issued a request to Oracle. This is how to tell if the session is truely INACTIVE.
If the front-end application uses connection pooling then depending on how many connections the application is set to grab and what kind of connection pool session management the front-end product provides you can have a lot of basically unneeded and truely inactive sessions.
HTH -- Mark D Powell -- -
DBA Reports large number of inactive sessions with 11.1.1.1
All,
We have installed System 11.1.1.1 on some 32 bit windows test machines running Windows Server 2003. Everything seems to be working fine, but recently the DBA is reporting that there are a large number of inactive sessions throwing alarms that we are reaching our Max Allowed Process on the Oracle Database server. We are running Oracle 10.2.0.4 on AIX.
We also have some System 9.3.1 Development servers that point at separate schemas in this environment and we don't see the same high number of inactive connections?
Most of the inactive connections are coming from Shared Services and Workspace. Anyone else see this or have any ideas?
Thanks for any responses.
Keith
Just a quick update. Originally I said this was only with 11.1.1.1 but we see the same high number of inactive sessions in 9.3. Anyone else see a large number of inactive sessions. They show up in Oracle as JDBC_Connect_Client. Does Shared Service, Planning Workspace etc utilize persistent connections or does it just abandon sessions when the windows service associated with an application is shutdown? Any information or thoughts are appreciated.
Edited by: Keith A on Oct 6, 2009 9:06 AMHi,
Not the answer you are looking for but have you logged it with Oracle as you might not get many answers to this question on here.
Cheers
John
http://john-goodwin.blogspot.com/ -
Is there a way to set inactive sessions to timeout after a certain period of time?
You may consider to use SQLNET.EXPIRE_TIME
REFERENCE: http://download.oracle.com/docs/cd/B12037_01/network.101/b10776/sqlnet.htm
============================================================
SQLNET.EXPIRE_TIME
Purpose
Use parameter SQLNET.EXPIRE_TIME to specify a the time interval, in minutes, to send a probe to verify that client/server connections are active. Setting a value greater than 0 ensures that connections are not left open indefinitely, due to an abnormal client termination. If the probe finds a terminated connection, or a connection that is no longer in use, it returns an error, causing the server process to exit. This parameter is primarily intended for the database server, which typically handles multiple connections at any one time.
Limitations on using this terminated connection detection feature are:
* It is not allowed on bequeathed connections.
* Though very small, a probe packet generates additional traffic that may downgrade network performance.
* Depending on which operating system is in use, the server may need to perform additional processing to distinguish the
connection probing event from other events that occur. This can also result in degraded network performance.
Default 0
Minimum Value 0
Recommended Value 10
Example
SQLNET.EXPIRE_TIME=10 -
[SOLVED]What is the meaning of any/active/inactive session in polkit?
Wiki said 「inactive sessions are generally remote sessions (SSH, VNC, etc.) 」.
So I changed the *.policy file like below to execute the action without password only when I am logging in remotely.
(Just for clarifying the difference between any/active/inactive session.)
<allow_any>no</allow_any>
<allow_inactive>yes</allow_inactive>
<allow_active>no</allow_active>
Contrary to expectations, I couldn't execute the action remotely without password.
So I changed again like below.
<allow_any>yes</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>no</allow_active>
This time, I was able to execute the action remotely without password.
From the above, I think the remote session is neither active nor inactive.
Is it true? If so, what is the inactive session?
What is the definition of active/inactive?
Last edited by remingtontonpon (2014-08-04 06:16:52)'man polkit' explains that 'allow_inactive' and 'allow_active' are for sessions on local consoles.
Only 'allow_any' applies to any client local or remote.
This seems confirmed by what you observe on your machine.
Maybe you are looking for
-
Is it possible to use a portlet backing file on the dvt_enabler portlet?
We currently have a 9.2 portal with a simple login form portlet that uses a backing file to do much security checking, authentication against ActiveDir, etc. Our requirement is to convert to WLP 10.3 using the DVT enabler portlet or something like it
-
Personnel area without assigning to Company code.
Hi All, Can you let me know the scenario where it is not mandatory to assign a company code to the personnel area ? Also, is it possible to configure SAP HR for a personnel area in such a situation? Thanks & Regards, Swapnil Mishra
-
Hi, I have some issues regarding standby database. Oracle version : 10.2.0.1.0 on windows 2003R2 64bit. MRP process is not active in standby database.yesterday I have re-boot standby server,but still MRP process in not running. In Alert log I found
-
Layouts looking 'right' in Dreamweaver
Hi all, I seem to have this reoccurring problem, when I design layouts, I get them the way I want they look great in IE/Firefox but when working on them in Dreamweaver the layout looks messy and sometimes quite hard to work with.... I attach my CSS a
-
Dump error after applying patches
Dear all; after applying SAP_BASIS Packs (SAPKB62019 and SAPKB62020) the transaction was canceled before finched implementing the patches and We are receiving ABAP dump errors while executing any transaction ( syntax_error) could you help me to resol