SET ECHO off
REM NAME:   rbs_wrap_time.sql
REM ------------------------------------------------------------------------
REM REQUIREMENTS:
REM    SELECT onV$INSTANCE, V$ROLLNAME, V$ROLLSTAT
REM ------------------------------------------------------------------------
REM PURPOSE:
REM    Reports how many hours it has been since the rollback segments
REM    wrapped.
REM ------------------------------------------------------------------------
REM EXAMPLE:
REM    NAME                                          Hour
REM    ---------------------------------------- ----------
REM    SYSTEM                                  399.1
REM    R01             241.2
REM    R02                                            73.5
REM
REM ------------------------------------------------------------------------
REM DISCLAIMER:
REM    This script is provided for educational purposes only. It is NOT
REM    supported by Oracle World Wide Technical Support.
REM    The script has been tested and appears to work as intended.
REM    You should always run new scripts on a test instance initially.
REM ------------------------------------------------------------------------
REM Main text of script follows:

select n.name, 
       round(24*(sysdate-startup_time) /
         (s.writes/s.rssize),1) "Hours"
from v$instance i1,
     v$rollname n,
     v$rollstat s
where n.usn = s.usn
and   s.status = 'ONLINE'
/

