Oracle DBMS_INTERNAL_LOGSTDBY
Version 21c

General Information
Library Note Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have? Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
Purpose Internal support utilities for Data Guard Logical Standby Databases
AUTHID DEFINER
Dependencies
ALL_MVIEW_LOGS DBMS_DDL LOGSTDBY$EDS_TABLES
ALL_OBJECTS DBMS_IJOB LOGSTDBY$EVENTS
AUDIT_ACTIONS DBMS_INTERNAL_SAFE_SCN LOGSTDBY$HISTORY
CDEF$ DBMS_LOB LOGSTDBY$PARAMETERS
COL$ DBMS_LOCK LOGSTDBY$SCN
DBA_LOGSTDBY_EDS_SUPPORTED DBMS_LOGMNR_INTERNAL LOGSTDBY$SKIP
DBA_LOGSTDBY_EDS_TABLES DBMS_LOGSTDBY LOGSTDBY$SKIP_SUPPORT
DBA_LOGSTDBY_LOG DBMS_LOGSTDBY_LIB LOGSTDBY$SKIP_TRANSACTION
DBA_LOGSTDBY_PARAMETERS DBMS_REFRESH LOGSTDBY_INTERNAL
DBA_LOGSTDBY_PROGRESS DBMS_SQL OBJ$
DBA_LOGSTDBY_SKIP DBMS_STANDARD PRVT_COMPRESSION
DBA_LOGSTDBY_UNSUPPORTED DBMS_SYSTEM SYSLSBY_EDS_DDL_TRIG
DBA_NESTED_TABLES DBMS_UTILITY TAB$
DBA_OBJECT_TABLES DUAL TS$
DBA_PROCEDURES IND$ USER$
DBA_REFS INDPART$ UTL_RECOMP
DBA_TABLES KUPM$MCP V$DATABASE
DBA_TAB_COLS KUPV$FT V$INSTANCE
DBA_USERS KUPV$FT_INT V$LOGSTDBY_STATE
DBA_VIEWS KUPW$WORKER V$PARAMETER
DBMS_AQ_SYS_IMP_INTERNAL LOGMNR_LOG$ V$TRANSACTION
DBMS_ASSERT LOGMNR_SESSION$ X$KRVSLVST
DBMS_AUDIT_MGMT LOGSTDBY$APPLY_MILESTONE  
Documented No
First Available 12.1
Security Model Owned by SYS with EXECUTE granted to AUDSYS
Source {ORACLE_HOME}/rdbms/admin/prvtlsis.plb
Subprograms
ADD_PREFIX_ENQUOTE ENABLE_LOGICAL_REPLICATION LOCK_LSBY_META
APPLY_GET END_STREAM LSBY_LOCK_TABLE
APPLY_IS_OFF END_STREAM_SHARED LSBY_UNLOCK_TABLE
APPLY_SET ENQUOTE_QUALIFIED_COL_NAME MATCHED_PRIMARY
APPLY_STOP_NOWAIT ESCAPE_ENQUOTE_LITERAL NEED_SCN
APPLY_UNSET ESCAPE_QUOTES PARDEL
AUDDEL FGADEL PARINS
AUDINS FGAINS PARUPD
AUDUPD FGAUPD PREPARE_FOR_NEW_PRIMARY
BUILD FLUSH_SRLS PRIMARY_DBID
CANCEL_FUTURE GET_DB_ROLE PRINTLOB
CAPTURE_SCN GET_EXPORT_DML_SCN PURGE_LOGS
CHECK_SKIP_LIKE GET_OBJ_NUM REBUILD
CLEAR_LOGICAL_INSTANTIATION GET_SAFE_SCN REPAIR_LSBY
DATA_ONLY_PREREQ GUARD_BYPASS_CHK REPLACE_DICTIONARY
DISABLE_LOGICAL_REPLICATION GUARD_BYPASS_OFF REPORT_ERROR
DUMP_XDAT GUARD_BYPASS_ON RETRIEVE_STATEMENT
EDS_ADD_PREREQ GUARD_CHECK SEQUENCE_UPDATE
EDS_ADD_TABLE_FINISH HIST_READ_RECORD SEQUPD
EDS_ADD_TABLE_INT HIST_SYNCH SET_EXPORT_SCN
EDS_CHECK_EVOLVE_STARTED HIST_WRITE_RECORD_CANCEL SET_LOGICAL_INSTANTIATION
EDS_CLEANUP_METADATA HIST_WRITE_RECORD_CURRENT SET_TABLESPACE
EDS_DROP_MVIEW HIST_WRITE_RECORD_FUTURE SET_TABLE_SCN
EDS_DROP_TRIGGER HIST_WRITE_RECORD_PREVIOUS SKIP_SUPPORT
EDS_EVAL_CHANGE_VECTOR HSTDEL SKIP_TRANSACTION
EDS_EVOLVE HSTINS UNLOCK_LSBY_CON
EDS_EVOLVE_DISABLE HSTUPD UNLOCK_LSBY_META
EDS_EVOLVE_ENABLE INSTANTIATE_TAB_LOG UNSKIP_TRANSACTION
EDS_EVOLVE_TABLE_CANCEL INSTANTIATE_TAB_PREREQ UPCASE_NAME
EDS_EVOLVE_TABLE_END IS_EDS_MAINTAINED UPDATE_DYNAMIC_LSBY_OPTION
EDS_EVOLVE_TABLE_START IS_EDS_SUPPORTABLE VALIDATE_SET
EDS_GEN_MV IS_LSBY_SUPPORTABLE VALIDATE_SKIP_ACTION
EDS_GEN_TRIGGERS IS_PDB_ROOT VALIDATE_SKIP_AUTHID
EDS_GET_NAMES IS_SUPP_AND_NOTSKIP VERIFY_NOSESSION
EDS_GET_TABLESPACE JOBDEL VERIFY_SESSION
EDS_REMOVE_TABLE_FINISH JOBINS VERIFY_SESSION_LOGAUTODELETE
EDS_REMOVE_TABLE_INT JOBUPD WAIT_FOR_SAFE_SCN
EDS_USER_CURSOR LOCK_LSBY_CON  
 
APPLY_IS_OFF
Disables apply dbms_internal_logstdby.apply_is_off;
exec dbms_internal_logstdby.apply_is_off;

PL/SQL procedure successfully completed.
 
APPLY_STOP_NOWAIT
Immediate apply stop dbms_internal_logstdby.apply_stop_nowait;
exec dbms_internal_logstdby.apply_stop_nowait;

PL/SQL procedure successfully completed.
 
BUILD
Turns on supplemental logging and ensures supplemental logging is enabled properly and builds the LogMiner dictionary: Takes several minutes dbms_internal_logstdby.build;
exec dbms_internal_logstdby.build;

PL/SQL procedure successfully completed.
 
CANCEL_FUTURE
This is totally undocumented and I have no idea what it does but the name was just too good to allow for resistance and the syntax mindlessly simple dbms_internal_logstdby.cancel_future;
exec dbms_internal_logstdby.cancel_future;

PL/SQL procedure successfully completed.
 
CAPTURE_SCN
Undocumented dbms_internal_logstdby.capture_scn;
exec dbms_internal_logstdby.capture_scn;
BEGIN dbms_internal_logstdby.capture_scn; END;
*
ERROR at line 1:
ORA-16287: operation not permitted due to active apply state
ORA-06512: at "SYS.DBMS_INTERNAL_LOGSTDBY", line 378
ORA-06512: at line 1
 
CLEAR_LOGICAL_INSTANTIATION
Clears instantiation dbms_internal_logstdby.clear_logical_instantiation;
exec dbms_internal_logstdby.clear_logical_instantiation;

PL/SQL procedure successfully completed.
 
DISABLE_LOGICAL_REPLICATION
Poorly named ... returns the current logical replication state dbms_internal_logstdby.disable_logical_replication RETURN BOOLEAN;
See ENABLE_LOGICAL_REPLICATION below
 
DUMP_XDAT
Undocumented dbms_internal_logstdby.dump_xdat;
exec dbms_internal_logstdby.dump_xdat;
 
EDS_EVOLVE_DISABLE
Undocumented dbms_internal_logstdby.eds_evolve_disable;
exec dbms_internal_logstdby.eds_evolve_disable;
 
EDS_EVOLVE_ENABLE
Undocumented dbms_internal_logstdby.eds_evolve_enable;
exec dbms_internal_logstdby.eds_evolve_enable;
 
EDS_USER_CURSOR
Undocumented dbms_internal_logstdby.eds_user_cursor(
user_issued OUT BOOLEAN,
table_owner OUT VARCHAR2,
table_name  OUT VARCHAR2);
See {ORACLE_HOME}/rdbms/admin/catlsby.sql
 
ENABLE_LOGICAL_REPLICATION
Enables logical replication dbms_internal_logstdby.enable_logical_replication(repl_state IN BOOLEAN);
DECLARE
 retVal BOOLEAN := dbms_internal_logstdby.disable_logical_replication;
BEGIN
  IF retVal THEN
    dbms_output.put_line('TRUE');
  ELSE
    dbms_output.put_line('FALSE');
  END IF;
END;
/
TRUE

PL/SQL procedure successfully completed.


exec dbms_internal_logstdby.enable_logical_replication(TRUE);

PL/SQL procedure successfully completed.

DECLARE
 retVal BOOLEAN := dbms_internal_logstdby.disable_logical_replication;
BEGIN
  IF retVal THEN
    dbms_output.put_line('TRUE');
  ELSE
    dbms_output.put_line('FALSE');
  END IF;
END;
/
TRUE

PL/SQL procedure successfully completed.

exec dbms_internal_logstdby.enable_logical_replication(FALSE);

PL/SQL procedure successfully completed.

DECLARE
 retVal BOOLEAN := dbms_internal_logstdby.disable_logical_replication;
BEGIN
  IF retVal THEN
    dbms_output.put_line('TRUE');
  ELSE
    dbms_output.put_line('FALSE');
  END IF;
END;
/
FALSE

PL/SQL procedure successfully completed.
 
GET_DB_ROLE
Returns the current database role

It would be interesting to know why anyone chose to do this with a proc rather than a function.
dbms_internal_logstdby.get_db_role(dbrole OUT VARCHAR2);
DECLARE
 lDBRole VARCHAR2(30);
BEGIN
  dbms_internal_logstdby.get_db_role(lDBRole);
  dbms_output.put_line(lDBRole);
END;
/
PRIMARY

PL/SQL procedure successfully completed.
 
GET_OBJ_NUM
Return the object number for the identified table

Faster than querying DBA_OBJECTS
dbms_internal_logstdby.get_obj_num(
table_owner IN  VARCHAR2,
table_name  IN  VARCHAR2,
dblink      IN  VARCHAR2,
objno       OUT NUMBER);
conn / as sysdba

SELECT object_id
FROM dba_objects
WHERE object_name = 'OBJ$';

 OBJECT_ID
----------
        18


Elapsed: 00:00:00.03

set serveroutput on

DECLARE
 objid obj$.obj#%TYPE;
BEGIN
  dbms_internal_logstdby.get_obj_num(USER, 'OBJ$', NULL, objid);
  dbms_output.put_line(TO_CHAR(objid));
END;
/
18

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.01
 
GET_SAFE_SCN
Appears to return the current SCN dbms_internal_logstdby.get_safe_scn(safe_scn OUT NUMBER);
DECLARE
 scnVal NUMBER;
BEGIN
  dbms_internal_logstdby.get_safe_scn(scnVal);
  dbms_output.put_line('Safe SCN: ' || TO_CHAR(scnVal));

  dbms_output.put_line('Curr SCN" ' || TO_CHAR(dbms_flashback.get_system_change_number));
END;
/
Safe SCN: 18758626
Curr SCN" 18758626

PL/SQL procedure successfully completed.

Elapsed: 00:00:00.02
 
GUARD_BYPASS_OFF
Disable Data Guard Bypass dbms_internal_logstdby.guard_bypass_off;
exec dbms_internal_logstdby.guard_bypass_off;

PL/SQL procedure successfully completed.
 
GUARD_BYPASS_ON
Enable Data Guard Bypass dbms_internal_logstdby.guard_bypass_on;
exec dbms_internal_logstdby.guard_bypass_on;

PL/SQL procedure successfully completed.
 
GUARD_CHECK
Undocumented dbms_internal_logstdby.guard_check;
exec dbms_internal_logstdby.guard_check;

PL/SQL procedure successfully completed.
 
IS_EDS_MAINTAINED
Undocumented dbms_internal_logstdby.is_eds_maintained(
owner      IN VARCHAR2,
table_name IN VARCHAR2)
RETURN BOOLEAN;
BEGIN
  IF dbms_internal_logstdby.is_eds_maintained(USER, 'OBJ$') THEN
    dbms_output.put_line('Extended Data Type Supportable');
  ELSE
    dbms_output.put_line('Not Extended Data Type Supportable');
  END IF;
END;
/
Not Extended Data Type Supportable

PL/SQL procedure successfully completed.
 
IS_EDS_SUPPORTABLE
Extended Datatype Supportable dbms_internal_logstdby.is_eds_supportable(
owner      IN VARCHAR2,
table_name IN VARCHAR2)
RETURN BOOLEAN;
BEGIN
  IF dbms_internal_logstdby.is_eds_supportable(USER, 'OBJ$') THEN
    dbms_output.put_line('Extended Data Type Supportable');
  ELSE
    dbms_output.put_line('Not Extended Data Type Supportable');
  END IF;
END;
/
Not Extended Data Type Supportable

PL/SQL procedure successfully completed.
 
IS_LSBY_SUPPORTABLE
Is Logical Standby Supported dbms_internal_logstdby.is_lsdby_supportable(
owner      IN VARCHAR2,
table_name IN VARCHAR2)
RETURN BOOLEAN;
BEGIN
  IF dbms_internal_logstdby.is_lsby_supportable(USER, 'OBJ$') THEN
    dbms_output.put_line('Logical Standby Supportable');
  ELSE
    dbms_output.put_line('Not Logical Standby Supportable');
  END IF;
END;
/
Not Logical Standby Supportable

PL/SQL procedure successfully completed.
 
IS_PDB_ROOT
Returns TRUE if the current container is CDB$ROOT otherwise appears to exit without returning FALSE dbms_internal_logstdby.is_pdb_root RETURN BOOLEAN;
conn / as sysdba

BEGIN
  IF dbms_internal_logstdby.is_pdb_root THEN
    dbms_output.put_line('Current container is CDB$ROOT');
  ELSE
    dbms_output.put_line('Current container is ' || SYS_CONTEXT('USERENV','CON_NAME'));
  END IF;
END;
/
Current container is CDB$ROOT

PL/SQL procedure successfully completed.


ALTER SESSION SET CONTAINER = PDBDEV;

BEGIN
  IF dbms_internal_logstdby.is_pdb_root THEN
    dbms_output.put_line('Current container is CDB$ROOT');
  ELSE
    dbms_output.put_line('Current container is ' || SYS_CONTEXT('USERENV','CON_NAME'));
  END IF;
END;
/

PL/SQL procedure successfully completed.

-- unfortunately another example of Oracle doing EXCEPTION WHEN OTHERS THEN NULL
 
IS_SUPP_AND_NOTSKIP
Undocumented dbms_internal_logstdby.is_supp_and_skip(
owner      IN VARCHAR2,
table_name IN VARCHAR2)
RETURN BOOLEAN;
BEGIN
  IF dbms_internal_logstdby.is_supp_and_notskip(USER, 'OBJ$') THEN
    dbms_output.put_line('LTRUE');
  ELSE
    dbms_output.put_line('FALSE');
  END IF;
END;
/
TRUE

PL/SQL procedure successfully completed.
 
REPLACE_DICTIONARY
Undocumented dbms_internal_logstdby.replace_dictionary;
exec dbms_internal_logstdby.replace_dictionary;

PL/SQL procedure successfully completed.
 
SET_LOGICAL_INSTANTIATION
Undocumented dbms_internal_logstdby.set_logical_instantiation;
exec dbms_internal_logstdby.set_logical_instantiation;

PL/SQL procedure successfully completed.
 
UNLOCK_LSBY_META
Undocumented dbms_internal_logstdby.unlock_lsby_meta;
exec dbms_internal_logstdby.unlock_lsby_meta;

PL/SQL procedure successfully completed.
 
UPCASE_NAME
Apparently the UPPER function was inadequate for someone dbms_internal_logstdby.upcase_name(
inname        IN  VARCHAR2,
quoted_name   OUT VARCHAR2,
unquoted_name OUT VARCHAR2);
DECLARE
 qname   dbms_id;
 unqname dbms_id;
BEGIN
  dbms_internal_logstdby.upcase_name('uwclass.test', qname, unqname);
  dbms_output.put_line(qname);
  dbms_output.put_line(unqname);
END;
/
"UWCLASS.TEST"
UWCLASS.TEST

PL/SQL procedure successfully completed.
 
VERIFY_NOSESSION
Undocumented dbms_internal_logstdby.verify_nosession;
SQL> exec dbms_internal_logstdby.verify_nosession;

PL/SQL procedure successfully completed.
 
VERIFY_SESSION
Undocumented dbms_internal_logstdby.verify_session;
SQL> exec dbms_internal_logstdby.verify_session;
BEGIN dbms_internal_logstdby.verify_session; END;
*
ERROR at line 1:
ORA-16100: not a valid Logical Standby database
ORA-06512: at "SYS.DBMS_INTERNAL_LOGSTDBY", line 919
ORA-06512: at line 1

Related Topics
Built-in Functions
Built-in Packages
Data Guard
DBMS_DG
DBMS_DRS
DBMS_LOGSTDBY
DBMS_LOGSTDBY_CONTEXT
LOGSTDBY_INTERNAL
What's New In 19c
What's New In 20c-21c

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-2021 Daniel A. Morgan All Rights Reserved
  DBSecWorx