Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Small sample shell program Linux/Unix
  • How to analyze statspack or AWR report. Oracle
  • Complete Git Tutorial for Beginners GIT
  • Temporary Tablespsace Temp tablespace behaviour Oracle
  • Day to day MYSQL DBA operations (Compared with Oracle DBA) MYSQL
  • How to change hostname in Linux Linux/Unix
  • UTL_FILE test program Oracle
  • How do I get Oracle to automatically start when my server boots up? Oracle
  • All About oracle password and security from metalink Oracle
  • DBA_HIST_SQLSTAT contents Oracle
  • Oracle 10g Wait Model Oracle
  • Proc code Oracle
  • CTAS with LONG Column for 7.x and 8 and 8i Oracle
  • Resolving RMAN Hung Jobs Oracle
  • Reading config file from other folder inside class Python/PySpark

Find sort details from Db find_sort.sql

Posted on 10-May-2008 By Admin No Comments on Find sort details from Db find_sort.sql

select sql_text,(executions-sorts) “Diff” from v$sqlarea where (executions-sorts) < 20
and executions > 100 order by 2 ;

SELECT S.sid || ‘,’ || S.serial# sid_serial, S.username,

T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,

T.sqladdr address, Q.hash_value, Q.sql_text

FROM v$sort_usage T, v$session S, v$sqlarea Q, dba_tablespaces TBS

WHERE T.session_addr = S.saddr

AND T.sqladdr = Q.address (+)

AND T.tablespace = TBS.tablespace_name

ORDER BY S.sid;

SELECT S.sid || ‘,’ || S.serial# sid_serial, S.username, S.osuser, P.spid,

S.module, S.program,

SUM (T.blocks) * TBS.block_size / 1024 / 1024 mb_used, T.tablespace,

COUNT(*) sort_ops

FROM v$sort_usage T, v$session S, dba_tablespaces TBS, v$process P

WHERE T.session_addr = S.saddr

AND S.paddr = P.addr

AND T.tablespace = TBS.tablespace_name

GROUP BY S.sid, S.serial#, S.username, S.osuser, P.spid, S.module,

S.program, TBS.block_size, T.tablespace

ORDER BY sid_serial;

Oracle, SQL scripts

Post navigation

Previous Post: runsql_once.ksh
Next Post: pvm_rbs1.sql (to collect rbs info from db)

Related Posts

  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • create database syntax Oracle
  • tblwopk.sql tablewopk.sql Oracle
  • New Latest Param.sql for finding all hidden parameters also Oracle
  • exp syntax in oracle 10g Oracle
  • Rollback force for distributed transactions Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (395)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (343)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026
  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • find_longsql.sql Oracle
  • oracle 11g RAC on vmware Oracle
  • JSON/XML Types in Oracle Oracle
  • Optimizer_Index init.ora parameter explaination. Oracle
  • sql_doing_fts.sql Oracle
  • MYSQL and Oracle Comparison for Oracle DBA MYSQL
  • On solaris 10, “S” link is not part of $ORACLE_HOME/bin/oracle as default. ( For 9.2.0.8) Oracle
  • sess1.sql Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme