Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Check SQL Server edition SQL Server
  • get_vmstat_solaris Oracle
  • Which environment is used by currently running process ( Very good) Linux/Unix
  • Important Script Method for tuning Oracle
  • refre.sql Oracle
  • find_string_in_database.sql Oracle
  • Find_stale_dr.sql finding stale physical DR.. Oracle
  • Find_planinfo.sql Oracle
  • tblwopk.sql tablewopk.sql Oracle
  • Import and export statements Oracle
  • USER_TABLES.Freelists Oracle
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • Very Good Oralce Internal Tuning Book Oracle
  • Does DBMS_JOB recompute the NEXT_DATE interval after or before Oracle
  • Difference between SYNC and AFFIRM Oracle

longtx.sql

Posted on 10-Jul-2008 By Admin No Comments on longtx.sql

Find long running transaction that are running for more than 5 minutes with transaction id.

col machine format a30

col sid format 99999

col Transaction_id format a20

col username format a10

col days format 99.99

col minutes format 999999

set lines 120 pages 200

select a.sid, a.username, a.machine,

round((sysdate – to_date(b.start_time, ‘MM/DD/YY HH24:MI:SS’)) * 1440) minutes,

round((sysdate – to_date(b.start_time, ‘MM/DD/YY HH24:MI:SS’)), 2) days,

a.status, b.status, b.xidusn||’.’||b.xidslot||’.’||b.xidsqn Transaction_id

from v$session a , v$transaction b

where a.SADDR = b.SES_ADDR

and (sysdate – to_date(b.start_time, ‘MM/DD/YY HH24:MI:SS’)) * 1440 > 5

order by (sysdate – to_date(b.start_time, ‘MM/DD/YY HH24:MI:SS’)) * 1440

/

Oracle, SQL scripts

Post navigation

Previous Post: V$transaction notes for finding XID composition.
Next Post: RAC with RHEL4 and 11g

Related Posts

  • CTAS with LONG Column for 9i and higher Oracle
  • Generating XML from SQLPLUS Oracle
  • Query to Generate aggregate on every 30 mins. Oracle
  • To see how much time or progress of long transaction Oracle
  • How to set Processes Parameter Oracle
  • mutex in Oracle 10.2.0.2 or Oracle 10g 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 (394)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (343)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • 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
  • Checking SQL Server Version25-Jul-2025

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • Load SPM baseline from AWR Oracle
  • cur_sql.sql Oracle
  • Goldengate Tutorial Oracle
  • Proc code Oracle
  • ORA-00064: object is too large to allocate on this O/S during startup Oracle
  • All About oracle password and security from metalink Oracle
  • DBMS_SQL for alter session. Oracle

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme