From:Steve Adams
Date:02-May-2001 11:48
Subject:   Rollback segment wraps

OK. In the following example, I will create a small table and a new rollback segment with 20 small extents. Then I'll delete all the rows from the table using this rollback segment. I'll expect to see several WRAPS into new rollback segment extents, but the total number of bytes written (WRITES) will still be less than the size of the rollback segment (RSSIZE). Here goes ...

	SQL> create table t as select * from dba_objects;

	Table created.

	SQL> create rollback segment rb_small storage (initial 64K next 64K minextents 20);

	Rollback segment created.

	SQL> alter rollback segment rb_small online;

	Rollback segment altered.

	SQL> select s.extents, s.rssize, s.writes, s.wraps
	  2  from v$rollstat s, v$rollname n
	  3  where n.name = 'RB_SMALL' and n.usn = s.usn;

	   EXTENTS     RSSIZE     WRITES      WRAPS
	---------- ---------- ---------- ----------
	        20    1308672          0          0

	SQL> set transaction use rollback segment rb_small;

	Transaction set.

	SQL> delete t;

	3465 rows deleted.

	SQL> select s.extents, s.rssize, s.writes, s.wraps
	  2  from v$rollstat s, v$rollname n
	  3  where n.name = 'RB_SMALL' and n.usn = s.usn;

	   EXTENTS     RSSIZE     WRITES      WRAPS
	---------- ---------- ---------- ----------
	        20    1308672     753008         12

	SQL>
In general, for any rollback segment, if you divide WRITES by WRAPS you'll get a number just less than the extent size.

Here is a quote from your Q&A on RBS wraps

    Rollback segment wraps                 23 June 1999

    What is the definition of a rollback segment wrap? I
    thought it was when a transaction needed to "wrap"
    back to the first extent to carry on. Then how
    come I'm getting wraps on my 8M segments when my total
    writes are not even close to 8M?

    It is a little counter-intuitive, but a wrap is
    defined as when the head of undo generation moves from
    any one extend into any other extent.
Recently there was an Oracle representative I was talking to, who said that a wrap is when the last extent of RBS wraps back to the first extent of RBS. He claims to have seen the code.

Do you have a defence for your statement against his claim?