Oracle REDO_DIFF
Version 21c

General Information
Library Note Morgan's Library Page Header
ACE Director Alum Daniel Morgan, founder of Morgan's Library, is scheduling complimentary technical Workshops on Database Security for the first 30 Oracle Database customers located anywhere in North America, EMEA, LATAM, or APAC that send an email to asra_us@oracle.com. Request a Workshop for your organization today.
Purpose The source code for the package specification and body are listed below but the origin of how it got into the 21.3 database, and what it is intended to accomplish, is still a mystery. That said, it is a decent piece of work and I want to thank whoever thought to put it there.
AUTHID DEFINER
Dependencies
DBMS_OUTPUT V_$SYSSTAT  
Documented No
First Available 21c
Security Model Owned by SYS with no privileges granted
Source: Formatted for clarity cd $ORACLE_HOME
grep -ir "REDO_DIFF"

did not identify a single file that contained this string.
CREATE OR REPLACE NONEDITIONABLE PACKAGE "SYS"."REDO_DIFF" AUTHID DEFINER IS
 PROCEDURE diff_it;
END redo_diff;
/

CREATE OR REPLACE NONEDITIONABLE PACKAGE BODY "SYS"."REDO_DIFF" IS
 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;
--=========================================
-- intialization section
BEGIN
 s := get_size;
END redo_diff;
/
 
DIFF_IT (new 21c)
Reports the amount of redo generated in by the system from the time of initialization in the current session until it is rerun redo_diff.diff_it;
set serveroutput on;

exec redo_diff.diff_it;
redo diff: 0

PL/SQL procedure successfully completed.

-- do some stuff for 5 to 10 minutes then rerun

exec redo_diff.diff_it;
redo diff: 631856

PL/SQL procedure successfully completed.

Related Topics
Built-in Functions
Built-in Packages
Database Security
What's New In 21c
What's New In 23c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2023 Daniel A. Morgan All Rights Reserved
  DBSecWorx