Subscribe to Posts by Email

Subscriber Count

    696

Disclaimer

All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove. Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only. This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only. If you see any issues with Content and copy write issues, I am happy to remove if you notify me. Contact Geek DBA Team, via geeksinsights@gmail.com

Pages

Scripts: Finding the object or statement that is causing excessive redo generation

How to find the object that is causing excessive redo or archive generation between a given date. You can get from the v$log_history but for history you will need to query the awr history views as below.

SELECT dhso.object_name,
sum(db_block_changes_delta)
FROM dba_hist_seg_stat dhss,
dba_hist_seg_stat_obj dhso,
dba_hist_snapshot dhs
WHERE dhs.snap_id = dhss.snap_id
AND dhs.instance_number = dhss.instance_number
AND dhss.obj# = dhso.obj#
AND dhss.dataobj# = dhso.dataobj#
AND begin_interval_time BETWEEN to_date('2012_05_02 04','YYYY_MM_DD HH24') AND to_date('2012_05_02 07','YYYY_MM_DD HH24')
GROUP BY dhso.object_name
order by sum(db_block_changes_delta) desc
/

OBJECT_NAME                    SUM(DB_BLOCK_CHANGES_DELTA)
------------------------------ ---------------------------
XXXXXXX                                     315744448

Find the statement related to it.

SELECT distinct dbms_lob.substr(sql_text,4000,1)
FROM dba_hist_sqlstat dhss,
dba_hist_snapshot dhs,
dba_hist_sqltext dhst
WHERE upper(dhst.sql_text) LIKE '%XXXXXXXXXX%'
AND dhss.snap_id=dhs.snap_id
AND dhss.instance_Number=dhs.instance_number
AND dhss.sql_id = dhst.sql_id and rownum<2;

DBMS_LOB.SUBSTR(SQL_TEXT,4000,1)
--------------------------------------------------------------------------------
update XXXXXXXX set LATEST_VERSION=:1  where ID=:2  and VERSION<:3

SQL> SQL>

Hope this helps!!!

-Thanks

Geek DBA

2 comments to Scripts: Finding the object or statement that is causing excessive redo generation