Home » RDBMS Server » Server Administration » CPU Utilization - Find long running SQL query
CPU Utilization - Find long running SQL query [message #221064] Fri, 23 February 2007 10:09 Go to next message
prashanth_gs
Messages: 67
Registered: November 2005
Location: chennai
Member
Hi,

We have a Production Testing to find the CPU ultilzation in the Production Database Server.

We has to track out the current SQL commands which uses CPU of more than 2% while this testing.

Can any one please tell me how to find out the current SQL queries getting executed on that time? Any query for this?

Thanks and Regards,
Prashanth

Re: CPU Utilization - Find long running SQL query [message #221075 is a reply to message #221064] Fri, 23 February 2007 12:24 Go to previous message
ehk007
Messages: 1
Registered: February 2007
Location: Quebec
Junior Member
Try this SQL Statement
SELECT TOTALWORK ,
UNITS,
to_char(START_TIME,'hh24:mi:ss') Start,
to_char(LAST_UPDATE_TIME,'hh24:mi:ss') "Last Update",
TIME_REMAINING "Time remaining",
ELAPSED_SECONDS "Time Elapsed"
from v$session_longops
where sid = &1;

Or this

SELECT '***Ora/Os user :'||LTRIM(s.username)||'/'||LTRIM(s.osuser)||
'***Programme:'||LTRIM(s.program)||
'***Serveur :'||LTRIM(s.machine),
a.sql_text
FROM v$process p,
v$session s,
v$sqlarea a
WHERE s.sql_address = a.address
AND s.sid = p.pid
AND p.spid = &1
AND s.username=&2;


Previous Topic: DBMS_METADATA.GET_DDL formatting problem
Next Topic: Tnsnames issue
Goto Forum:
  


Current Time: Mon Dec 02 15:27:47 CST 2024