René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Package to determine amount of redo generated in Oracle

The following package and table allow to find out how much redo has been genearated between two calls of the procedure.
reate table last_redo_size as select value redo_size 
 from v$sysstat where name = 'redo size';


create or replace package redo_diff as
  procedure diff_it;
end;
/

create or replace package body redo_diff as
  s number;

  function get_size return number is
    s_ number;
  begin
    select value into s_ from sys.v_$sysstat where name = 'redo size';
    return s_;
  end get_size;
 
  procedure diff_it is
    s_new number;
  begin
    s_new := get_size; 
    dbms_output.put_line('redo diff: ' || to_char(s_new - s));
    s    := s_new;
  end diff_it;

  begin
    s := get_size;
end;
/
This package is demonstrated in creating global temporary tables