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-2017 Jeffrey M. Hunter. All rights reserved.