Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Optimizer SORT Operations Oracle
  • Find nth max and min. Oracle
  • proc.sql Oracle
  • find_string_in_database.sql Oracle
  • Which environment is used by currently running process ( Very good) Linux/Unix
  • Jai Shree Ram Oracle
  • Composite Index creation tip from Vivek Oracle
  • Roles and Stored Procs II Oracle
  • Useful Solaris Commands on 28-SEP-2005 Linux/Unix
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • Vivek Tuning for Row Locks. Oracle
  • Metalink Note: Note:250655.1 : ADDM Basics USING THE AUTOMATIC DATABASE DIAGNOSTIC MONITOR Oracle
  • RAC 11g with vmware Oracle
  • cif crons Linux/Unix
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle

Find Time Consuming SQL Statements in Oracle 10g

Posted on 22-Dec-2005 By Admin No Comments on Find Time Consuming SQL Statements in Oracle 10g

spool badsql5

set lines 132

set pages 300

col USR format a14

col PAR heading “Parsing ID” format 9999999

col ELA heading “ELP time(Sec)” format 9999999.0

col HASH heading “Hash Value”

col USR heading “Parsing User”

col T heading “SQL Text having Elapsed time > 1 sec”

break on HASH on USR on ELA skip 1

select to_char(a.sql_fullText) T,

(elapsed_time/1000000) “ELA”,

a.hash_value “HASH” ,

b.username “USR”, a.executions, rows_processed, a.last_load_time, a.buffer_gets, a.disk_reads, a.sorts

from v$sql a,dba_users b

where (a.elapsed_time/1000000)>1

and b.username not in (‘SYS’,’SYSTEM’,’DBSNMP’,’VIVEK’, ‘SYSMAN’)

and a.PARSING_SCHEMA_ID = b.user_id

and a.elapsed_time =(select max(elapsed_time) from v$sql g where g.hash_value = a.hash_value)

order by elapsed_time desc;

spool off

Oracle, SQL scripts

Post navigation

Previous Post: Goog notes on X$ tables
Next Post: Find All internal Parameters

Related Posts

  • PLSQL Table Syntax 1 Oracle
  • 751131.1 New Article Error 2819 While Requesting a Systemstate Dump Oracle
  • Wait Based Tuning Step by step with SQL statement Oracle
  • tab.sql Oracle
  • Updated LCK.SQL file. Oracle
  • Another Tuning Article for subheap of shared pool Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Database logon trigger issue Oracle
  • catall.sh Linux/Unix
  • backspace in SQL Plus not working then..? Linux/Unix
  • SQL_PROFILE – I explaination Oracle
  • refre.sql Oracle
  • Btee and Bitmap Plans in Oracle 9i and higher Oracle
  • Convert multiple rows to single column Oracle
  • Monitor and Trace Unix processes using truss Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme