Wednesday, December 2, 2009

Troubleshooting Oracle connections related problem

/* Display the number of sessions created for this db connection */
select username,schemaname, osuser,machine, terminal, program, type, module, event,service_name sid,  command, status from v$session

SELECT name, value FROM gv$parameter WHERE name = 'resource_limit';


1 comment:

Anonymous said...

The following script joins the v$sql and v$session tables to show you all of the SQL that is executing at that moment in your database.

select
u.sid,
u.osuser,
u.machine,
u.terminal,
u.program,
substr(u.username,1,12) user_name,
s.sql_text
from
v$sql s,
v$session u
where
s.hash_value = u.sql_hash_value
and
sql_text not like '%from v$sql s, v$session u%'
order by
u.sid;

If you identify a runaway query, you can issue the

ALTER SYSTEM KILL SESSION 'SID, SER#'; command to kill the query:


Thanks to Donald.
Ref : http://www.oracle-training.cc/oracle_tips_v$sql.htm