DBA Tips Archive for Oracle
Tuning buffer busy waits by file
by Jeff Hunter, Sr. Database Administrator
Most DBAs are aware of the view V$WAITSTAT. This view (based on X$KCBWAIT) reports the number of times an instance has had buffer busy waits on different classes of blocks since the instance was started.
Oracle also provides a companion view called X$KCBFWAIT which duplicates the function of X$KCBWAIT, but summarises the waits by file id.
The following script will list the contents of X$KCBFWAIT along with the datafiles. This script has been tested in both Oracle7, Oracle8 and Oracle8i.
SET linesize 180 SET pagesize 9000 COLUMN filename FORMAT a80 HEAD "File Name" COLUMN file# FORMAT 999 HEAD "File #" COLUMN ct FORMAT 999,999,999 HEAD "Waits" COLUMN time FORMAT 999,999,999 HEAD "Time" COLUMN avg FORMAT 999.999 HEAD "Avg Time" SPOOL file_wait SELECT indx+1 file# , b.name filename , count ct , time , time/(DECODE(count,0,1,count)) avg FROM x$kcbfwait a , v$datafile b WHERE indx < (select count(*) from v$datafile) AND a.indx+1 = b.file# / spool off
Copyright (c) 1998-2018 Jeffrey M. Hunter. All rights reserved.
All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at email@example.com.
I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.