set pages 999;
set feedback off;

column c1 heading "server";
column c2 heading "tablespace";
column c3 heading "block #";
column c4 heading "count" format 999,999;

set pages 999;
set feedback off;

column c1 heading "server";
column c2 heading "tablespace";
column c3 heading "block #";
column c4 heading "count" format 999,999;

spool rpt_waits.lst;

set heading off;
select 'db sequential read waits' from dual;
set heading on;

select
  substr(tablespace_name,1,14) c2,
  count(*) c4
from
  system.oracheck_read_waits
having
  count(*) > 5
group by
  substr(tablespace_name,1,14)
order by c4 desc
;


set heading off;
select 'Buffer Busy Waits' from dual;
set heading on;

select
  substr(tablespace_name,1,14) c2,
  count(*) c4
from
  system.oracheck_buffer_busy_waits
having
  count(*) > 5
group by
  substr(tablespace_name,1,14)
order by c4 desc
;


set heading off;
select 'Lock Element Waits' from dual;
set heading on;
select
  substr(tablespace_name,1,14) c2,
  count(*) c4
from
  system.oracheck_lock_element_waits
having
  count(*) > 5
group by
  substr(tablespace_name,1,14)
order by c4 desc
;


set heading off;
select 'Lock Element Cleanups' from dual;
set heading on;
select
  substr(tablespace_name,1,14) c2,
  count(*) c4
from
  system.oracheck_lock_element_cleanup
having
  count(*) > 5
group by
  substr(tablespace_name,1,14)
order by c4 desc
;

set heading off;
select 'db sequential read waits' from dual;
set heading on;
