Script to monitor oracle sessions
Hi i am looking for a script to monitor oracle sessions......which should find idle sessions which are idle for more than 25 mins and it should be killed...
is that possible.
Thanks
user11278505 wrote:
Hi i am looking for a script to monitor oracle sessions......which should find idle sessions which are idle for more than 25 mins and it should be killed...
is that possible.
ThanksYes it is, use Resource Manager to manage your users,
http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/dbrm.htm#ADMIN027
HTH
Aman....
Similar Messages
-
Automatic scripts to monitor oracle performance
Hi,
I am in the process of developing standard scripts to monitor performance.Whenever I feel performance is not good I can run these to findout what is happening rather than going through each v$table.Please suggest me any links to these scripts.So that I can get good Idea about How to customize mine accroding to my environment
ThanksWhat is your database version? 9i or 10g.
There are plenty of information in AWR (automatic Workload Repository) in 10g that will help you detect/manage your performance problems and you won't need to write scripts. It will also allow you to define baselines/metrics and notification methods.
The beauty of the AWR is that you will be able to customize it based on your environment.
Doc URL:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14211/autostat.htm -
Monitoring Oracle session with SQL_ID
Hi All,
How can I know a SQL_ID belonging to a user/schema in Oracle. Can anyone post me the query to find the SQL QUERY/SQL_ID belonging to a user session. I have googled but dint get what i expected. Hope I get it here. We dont have OEM configured to monitor the session.
Oracle DB version : 10.2.0.5
OS version : IBM - AIX
Regards,
Imran Khanimran khan wrote:
Hi All,
How can I know a SQL_ID belonging to a user/schema in Oracle. Can anyone post me the query to find the SQL QUERY/SQL_ID belonging to a user session. I have googled but dint get what i expected. Hope I get it here. We dont have OEM configured to monitor the session.
Oracle DB version : 10.2.0.5
OS version : IBM - AIX
Regards,
Imran Khanlook for SQL_ID below
SQL> desc v$session
Name Null? Type
SADDR RAW(4)
SID NUMBER
SERIAL# NUMBER
AUDSID NUMBER
PADDR RAW(4)
USER# NUMBER
USERNAME VARCHAR2(30)
COMMAND NUMBER
OWNERID NUMBER
TADDR VARCHAR2(8)
LOCKWAIT VARCHAR2(8)
STATUS VARCHAR2(8)
SERVER VARCHAR2(9)
SCHEMA# NUMBER
SCHEMANAME VARCHAR2(30)
OSUSER VARCHAR2(30)
PROCESS VARCHAR2(24)
MACHINE VARCHAR2(64)
PORT NUMBER
TERMINAL VARCHAR2(30)
PROGRAM VARCHAR2(48)
TYPE VARCHAR2(10)
SQL_ADDRESS RAW(4)
SQL_HASH_VALUE NUMBER
SQL_ID VARCHAR2(13)
SQL_CHILD_NUMBER NUMBER
SQL_EXEC_START DATE
SQL_EXEC_ID NUMBER
PREV_SQL_ADDR RAW(4)
PREV_HASH_VALUE NUMBER
PREV_SQL_ID VARCHAR2(13)
PREV_CHILD_NUMBER NUMBER
PREV_EXEC_START DATE
PREV_EXEC_ID NUMBER
PLSQL_ENTRY_OBJECT_ID NUMBER
PLSQL_ENTRY_SUBPROGRAM_ID NUMBER
PLSQL_OBJECT_ID NUMBER
PLSQL_SUBPROGRAM_ID NUMBER
MODULE VARCHAR2(64)
MODULE_HASH NUMBER
ACTION VARCHAR2(64)
ACTION_HASH NUMBER
CLIENT_INFO VARCHAR2(64)
FIXED_TABLE_SEQUENCE NUMBER
ROW_WAIT_OBJ# NUMBER
ROW_WAIT_FILE# NUMBER
ROW_WAIT_BLOCK# NUMBER
ROW_WAIT_ROW# NUMBER
TOP_LEVEL_CALL# NUMBER
LOGON_TIME DATE
LAST_CALL_ET NUMBER
PDML_ENABLED VARCHAR2(3)
FAILOVER_TYPE VARCHAR2(13)
FAILOVER_METHOD VARCHAR2(10)
FAILED_OVER VARCHAR2(3)
RESOURCE_CONSUMER_GROUP VARCHAR2(32)
PDML_STATUS VARCHAR2(8)
PDDL_STATUS VARCHAR2(8)
PQ_STATUS VARCHAR2(8)
CURRENT_QUEUE_DURATION NUMBER
CLIENT_IDENTIFIER VARCHAR2(64)
BLOCKING_SESSION_STATUS VARCHAR2(11)
BLOCKING_INSTANCE NUMBER
BLOCKING_SESSION NUMBER
FINAL_BLOCKING_SESSION_STATUS VARCHAR2(11)
FINAL_BLOCKING_INSTANCE NUMBER
FINAL_BLOCKING_SESSION NUMBER
SEQ# NUMBER
EVENT# NUMBER
EVENT VARCHAR2(64)
P1TEXT VARCHAR2(64)
P1 NUMBER
P1RAW RAW(8)
P2TEXT VARCHAR2(64)
P2 NUMBER
P2RAW RAW(8)
P3TEXT VARCHAR2(64)
P3 NUMBER
P3RAW RAW(8)
WAIT_CLASS_ID NUMBER
WAIT_CLASS# NUMBER
WAIT_CLASS VARCHAR2(64)
WAIT_TIME NUMBER
SECONDS_IN_WAIT NUMBER
STATE VARCHAR2(19)
WAIT_TIME_MICRO NUMBER
TIME_REMAINING_MICRO NUMBER
TIME_SINCE_LAST_WAIT_MICRO NUMBER
SERVICE_NAME VARCHAR2(64)
SQL_TRACE VARCHAR2(8)
SQL_TRACE_WAITS VARCHAR2(5)
SQL_TRACE_BINDS VARCHAR2(5)
SQL_TRACE_PLAN_STATS VARCHAR2(10)
SESSION_EDITION_ID NUMBER
CREATOR_ADDR RAW(4)
CREATOR_SERIAL# NUMBER
ECID VARCHAR2(64) -
Monitor PeopleSoft sessions with Oracle Coherence
Hello,
I installed Oracle coherence ( one Cache Server ) and two managed servers ( PIA1 and PIA2 ---weblogic 10.3.4).When trying to monitor peoplesoft sessions thru weblogic admin console ( Deployments - Peoplesoft - / - Monitoring - Sessions tab ) nothing displays or no session info . I have parameters ( monitoring - id and session-monitor-enabled = true ) included in weblogic.xml file. Can anyone please guide me here on what I missing ?Yes I installed C*Web for weblogic session management when I login to Admin console under monitoring tab I can see the coherence servers under coherence tab but under sessions tab it display empty info ( ex it doesn't show who the user logged into the peoplesoft app) and I am not sure how to check the users logged info in the cache server.Can you please let me know if any parameters that needs to be checked wither in web.xml or weblogic.xml files.
thanks NJ for your response... -
Monitoring orphan sessions on db tier
Hi,
Is there a way to monitor orphan sessions on db tier? does any body have script to monitor and kill orphan sessions? appreciate your replies.user738145 wrote:
Is there a way to monitor orphan sessions on db tier? does any body have script to monitor and kill orphan sessions? appreciate your replies.This is not really an Oracle problem. If the client does not say bye-bye to Oracle via the OCI (as a well behaved client should), the next layer deeper down needs to tell Oracle that.
That means that the network layer (on the client side) needs to send a TCP packet to tear down the client-server network connection (done by setting the FIN/RSET bit in the packet header).
Now if that network layer does not do that, the Oracle server process will not know the client is gone - and patiently sits idle waiting for the client to send instructions to the server to execute.
The Oracle server process will only discover that the client is no longer there when it attempts to use the network connection to the client, from its side. A network connection that is deemed to be still valid by the protocol stack in the kernel of that server platform.
There is a method called DCD (Dead Connection Detection) that can be configured in SQL*Net on the server - that instructs the server process to every now and then check the network link to the client and to determine if the connection is still valid and whether the client is still there and responding. See the SQLNET.EXPIRE_TIME SQL*NET parameter. -
I have a java application running at the front end.
The user logs into the java application and access the data.
I have user complaining regarding slow response of application(not always but atleast 2 to 3 times in a day while she is working)
Since the user is accessing through JAVA application and the apps server we are using is weblogic,Iam not able to track her session.
We are using ORACLE 9i ,and when I try to monitor the schema through which the data is accessed I see the status INACTIVE, though I asked user to logoff and login .
I have tried monitoring v$session views but it didnt work.I usually have 5 to 6 sessions always in inactive state on my enterprise manager for that particular schema.
Please help me out and give me a way how can I monitor or track that particular user.
Iam new to administartion
tahnk you
Message was edited by:
penn_vikAssuming that your middle tier is using a connection pool (the norm), the problem is that there is no relationship between a particular user's logical session and a physical database session. Each page the user hits in the application, for example, is potentially going to use a different connection from the connection pool and thus a different database session. And different users may be using the same database session just before and just after your user.
In general, when you have this sort of architecture, you need to have instrumentation built into the middle tier application in order to get anything useful done, at least to the point that the middle tier can enable and disable tracing when it gets a connection from the pool for a particular logical user session. Otherwise, you could enable tracing for the entire database, which is going to be a significant overhead, and try to comb through dozens of trace files to figure out what sessions were related to your particular user, which is at a minimum likely to be a substantial undertaking.
Justin -
Calling Unix-Script from within Oracle and store stdout/stderr in table
Hi,
What I want to do is:
1. Calling a UNIX script (e.g. hello.sh) (from inside the Database)
hello.sh
echo Hello World!
2. and get the stdout/stderr output back in my Database in a table (e.g. temp_back)
table temp_back
ID stdout stderr
1 Hello World!
I think Number 1 isnt a big problem, but how to get stdout back in DB?
Any solution?
I searched a bit in this Forum and found this Post.
re:Calling Host Command Through Database Procedures or Triggers
This may be what I am searching for, but cant access the Link
Since I am not really fit with UNIX and packages/procedures in Oracle it would be nice if you could post a very detailed answer.
(Please no java)
-What packages do I need? (heard DBMS_OUTPUT would be useful)
-example PL/SQL script
Thanks a lot!
Marcus
Environment:
Oracle 9.2.0 DBMarcus, if you opened the Java sandbox to access any o/s file, you can call any Unix command, shell script, or program, that the Oracle o/s user has exec privs on.
Just remember that there's a very basic Unix environment when you make the call - the settings in the .profile does not apply. Thus PATH for example is not set. When making the call make sure that the complete path is given. As for the environment, that is a problem as you cannot set that and make the call at the same time.
In that case it is much simpler to rather write a Unix shell script that does all for you. Set the environment. Run the command(s). Format output. Etc.
Then you call that Unix script, via Java, from SQL or PL/SQL. Treat the Unix scripts like the Unix-version of stored procedures for your Oracle application.
Some technical details. When you connect to Oracle, a Unix process services you. This can be either a dedicated server process (servicing only your Oracle session) or a shared server process (from the shared service pool of processes).
In either case, it is a Unix process running as a background process (thus detached from any tty device). PL/SQL and SQL are executed by this process. The Oracle JVM created by your session also lives in this process. When you therefore make o/s calls, these calls are made by this process.
Therefore you are limited to what this process can and can't do. E.g. it runs as the oracle o/s user and will fail on accessing paths and commands does the oracle user does not have privs on. Etc. -
Use OEM to monitor oracle database size
Hello All,
We currently have several database which are currently monitored via OEM however i will appreciate if anyone can tell me how i can monitor the the size of my oracle databases via oem
ThanksHi,
I'm not sure of OEM will monitor database size, but many 3rd party tools do.
There are many ways to achieve Oracle table monitoring, and many create specialized extension metadata tables to monitor Oracle table growth. In Oracle 10g you can perform Oracle tables monitoring with the dba_hist_seg_stat tables, specifically the space_used_total column.
On my databases, I create STATSPACK extension tables to track table and overall database growth:
http://www.dba-oracle.com/te_table_monitoring.htm
The full scripts are in my Oracle Press book, Oracle tuning with STATSPACK . . .
http://www.amazon.com/Oracle9i-High-Performance-Tuning-STATSPACK-Burleson/dp/007222360X
Hope this helps . . .
Donald K. Burleson
Oracle Press author
Author of "Oracle Tuning: The Definitive Reference"
http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm -
Monitoring Users session with specific profiles
Hi,
I created a specific profile that terminates a session with idle time 4 minutes. I would like to know how to monitoring which sessions are been disconnected by Oracle.
Thanks in advance,enable auditing by using
alter system set audit_trail = db scope=spfile
and bounce
Then issue audit connect
The dba_audit_session view will have the reason why the process was disconnected.
Sybrand Bakker
Senior Oracle DBA -
How can I monitor Oracle StoredProcedure Running Progress
How can I monitor Oracle StoredProcedure Running Progress ?
Because My stored Procedure run a long time ,
How can I do by calling (parent) program?
To monitor the StoredProcedure run step ??
Thanks !
nullFranco Lin (guest) wrote:
: How can I monitor Oracle StoredProcedure Running Progress ?
: Because My stored Procedure run a long time ,
: How can I do by calling (parent) program?
: To monitor the StoredProcedure run step ??
: Thanks !
my approge
create pl proc
CREATE OR REPLACE PROCEDURE ASIDENTL(
P_NAME VARCHAR2 ,
P_ACTION VARCHAR2 )
IS
-- @(#) klema 99/06/22 init
/* Hint
as sys
grant select on sys.v_$session to public;
kot <user> app
grant execute on ASIDENTL to <user> ;
begin
sys.dbms_application_info.set_module( P_NAME, P_ACTION);
end asidentl;
snip for long run-code
for cc in c loop
n := n + 1;
asidentl( 'myProc'
, to_char( n ) -
Monitoring oracle ebs system.
Hi,
I am trying to develop a shell script to monitor the EBS (db and apps).
basically, the script should send email if any of the component is down or system is unaccessible.
For appstier i am using adompnctl.sh status output to, if any component is down, grep and send email
For concurrent, looking for ICM
for database , run a small script to connect db and find status.
Kindly suggest if there are better wasy to do it.
Regards,Sanjay Desai wrote:
Hi
System Admin. involving in planning, configuring, testing, deploying, trouble shooting and managing the Oracle Business Suite of applications .
Work involves providing enterprise-wide, Oracle e-Business Applications System Administration support for development, staging and production systems.
Responsible for determining the most appropriate procedures for implementing and using current and new applications/systems;
Testing, implementing, and supporting Oracle e-Business applications; monitoring and tuning application and system performance; identifying end-user information requirements; developing conversion and system implementation plans; ensuring that developed and deployed software solutions adhere to specified requirements which satisfy customer needs and expectations .
HTH
SanjayAnd change control examples... -
Situation:
Oracle Forms 9i application, with multiple oracle forms (MDI). When I call a new forms I use OPEN_FORM(v_cm_module, ACTIVATE, session, pl_id) so I create a new oracle session.
Problem:
The user open a lot of windows (oracle forms .fmx with diferent sessions each one) in the oracle forms application, when they close the browser window (X botom of the browser, mozilla, internet explorer), the session are still alive (only kill one session....the first I think).
I know that after 15 minutes oracle kill the rest of the sessions, but if the user was editing a block (locking a record), and close the browser, the table still lock 15 minutes!!!!.
Any sugestions:???
ThanksIs it necessary to create a session for each form?
If so you could do the following:
in the formsweb.cfg set the seperateframe property on true; and place some JavaScript code into the htmlafterform property:
HTMLafterForm=<script type="text/javascript"> window.moveTo(-10000, -10000); </script>
now you have a seperate frame, the browser window gets moved to a position where you can't see it ;-). when clicking the X button in the seperate frame the current form will be closed; your MDI application is still running...if you wan't you can write a JavaBean, and get the windowlisteners of the seperate frame and replace them with your own...of course you can close the Browser by right clicking and closing it in the taskbar; but that's a thing you must live with...
besides that I have no clue how to get rid of those sessions, as I don't you have any event you can act with when closing the Browser. But if so you could save every sid in every when-new-form-instance trigger (you can get it from v$mystat), and when this event occurs you could kill all those sessions (alter system kill session ....) ;-). but as far as I know that's not possible...
regards
christian -
Call a UNIX shell script from an oracle stored procedure
We need to call a UNIX shell script from an oracle stored procedure
i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?There are various ways in achieving this.
For Example, you can call a PRO*C-Library residing on the database server.
This requires a PL/SQL library to be generated and some changes to the Listener configuration.
It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
Be careful with this, because it really works ;)
Refer to :
http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
Message was edited by:
user434854 -
Shell scripts to monitor data guard
Hi All,
Please help me to have the shell scripts for monitoring the data guard.
Thanks,
Mahihere is the shell script we use to monitor dataguard, it sends mail if there is a gap for more than 20 archive logs..
#set Oracle environment for Sql*Plus
#ORACLE_BASE=/oracle/app/oracle ; export ORACLE_BASE
ORACLE_HOME=/oracle/app/oracle/product/10.2.0 ; export ORACLE_HOME
ORACLE_SID=usagedb ; export ORACLE_SID
PATH=$PATH:/oracle/app/oracle/product/10.2.0/bin
#set working directory. script is located here..
cd /oracle/scripts
#Problem statemnt is constructed in message variable
MESSAGE=""
#hostname of the primary DB.. used in messages..
HOST_NAME=`/usr/bin/hostname`
#who will receive problem messages.. DBAs e-mail addresses seperated with space
DBA_GROUP='[email protected] '
#SQL statements to extract Data Guard info from DB
LOCAL_ARC_SQL='select archived_seq# from V$ARCHIVE_DEST_STATUS where dest_id=1; \n exit \n'
STBY_ARC_SQL='select archived_seq# from V$ARCHIVE_DEST_STATUS where dest_id=2; \n exit \n'
STBY_APPLY_SQL='select applied_seq# from V$ARCHIVE_DEST_STATUS where dest_id=2; \n exit \n'
#Get Data guard information to Unix shell variables...
LOCAL_ARC=`echo $LOCAL_ARC_SQL | sqlplus -S / as sysdba | tail -2|head -1`
STBY_ARC=`echo $STBY_ARC_SQL | sqlplus -S / as sysdba | tail -2|head -1`
STBY_APPLY=`echo $STBY_APPLY_SQL | sqlplus -S / as sysdba | tail -2|head -1`
#Allow 20 archive logs for transport and Apply latencies...
let "STBY_ARC_MARK=${STBY_ARC}+20"
let "STBY_APPLY_MARK= ${STBY_APPLY}+20"
if [ $LOCAL_ARC -gt $STBY_ARC_MARK ] ; then
MESSAGE=${MESSAGE}"$HOST_NAME Standby -log TRANSPORT- error! \n local_Arc_No=$LOCAL_ARC but stby_Arc_No=$STBY_ARC \n"
fi
if [ $STBY_ARC -gt $STBY_APPLY_MARK ] ; then
MESSAGE=${MESSAGE}"$HOST_NAME Standby -log APPLY- error! \n stby_Arc_No=$STBY_ARC but stby_Apply_no=$STBY_APPLY \n"
fi
if [ -n "$MESSAGE" ] ; then
MESSAGE=${MESSAGE}"\nWarning: dataguard error!!! \n .\n "
echo $MESSAGE | mailx -s "$HOST_NAME DataGuard error" $DBA_GROUP
fi -
Unit Testing and Oracle Sessions
We have an issue regarding Oracle session and SQL Developer Unit Testing.
Every time we run a Unit Test in SQLDeveloper a new Oracle session is created. When closing that Unit Test, the session, however, is not disconnected.
And the only way to close that "Unit Test" session is to close SQLDeveloper.
This is causing problems with the no. of sessions available to developers.
Any help would be much appreciated.
SubbossThe focus of this forum is report design. The actual testing of reports would be subject to your own internal policies and procedures.
Jason
Maybe you are looking for
-
HP LaserJet Enterprise 500 Color MFP M575 - Can't scan from Windows
We recently purchased and installed an HP LaserJet Enterprise 500 Color MFP M575 to be used as a networked all-in-one solution for a number of offices. I have been able to get it set up on our network and have installed the appropriate drivers on the
-
Numbers file wont open. please help asap!
I've been workin on a Numbers file for some days and have always safed it at the end of the day. Today i wanted to open it but i keep on getting this error that it can not be opened. Does anybody know a quick solution to it?
-
How do I add another apple ID TO MY IPAD For purchasing games???
I am sharing my iPad with someone in my home. How does she purchase games using her credit card. I can't figure out how to get her apple ID to come up on the screen. Thanks
-
How to pass parameter from javascript to applet ?
i have some parameters from form in html, and i would like to pass from javascript to an applet, (which a type of calling method in applet from javascript) and get back data from applet to display in html how could i do this ?
-
Line numbers related to order number
hi, the requirement is , i have two parameters order number and line number. i want to display the line numbers related to that particular order number while submitting the request from srs window. so first i created table value set for order num. an