Oracle DBMS_INTERNAL_SAFE_SCN
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 Undocumented but appears to relate to obtaining a safe System Change Number off the stack for use with DataPump.
AUTHID CURRENT_USER
Dependencies
DBMS_INTERNAL_LOGSTDBY KUPM$MCP KUPW$WORKER
DBMS_STREAMS_DATAPUMP    
Documented No
First Available Not known
Security Model Owned by SYS with EXECUTE granted to the EXECUTE_CATALOG_ROLE and LOGSTDBY ADMINISTRATOR roles
Source {ORACLE_HOME}/rdbms/admin/prvtlsss.plb
Subprograms
 
GET_EXPORT_DML_SCN
Undocumented dbms_internal_safe_scn.get_export_dml_scn(
SCHEMA        IN VARCHAR2,
TABLENAME     IN VARCHAR2,
COOKIE        IN VARCHAR2,
FLASHBACK_SCN IN NUMBER)
RETURN NUMBER;
TBD
 
MATCHED_PRIMARY
Returns 1 if the DBID is valid for the primary database dbms_internal_safe_scn.matched_primary(dbid IN NUMBER)
RETURN NUMBER;
SELECT dbid
FROM v$database;

SELECT dbms_internal_safe_scn.matched_primary(428676178)
FROM dual;

SELECT dbms_internal_safe_scn.matched_primary(428676180)
FROM dual;
 
NEED_SCN
Undocumented dbms_internal_safe_scn.need_scn(
DBLINK        IN     VARCHAR2,
DBVERSION     IN     VARCHAR2,
COMPATIBILITY IN     VARCHAR2,
INTEREST         OUT BOOLEAN,
COOKIE        IN OUT VARCHAR2);
-- a test seems to indicate that this must be run from within a datapump job
DECLARE
 b BOOLEAN;
 c VARCHAR2(200) := 'TEST';
BEGIN
  dbms_internal_safe_scn.need_scn('','18.0.0.0','18.1.0', b, c);
  dbms_output.put_line(c);
END;
/
DECLARE
*
ERROR at line 1:
ORA-31623: a job is not attached to this session via the specified handle
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4747
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4494
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5973
ORA-06512: at "SYS.DBMS_STREAMS_DATAPUMP_UTIL", line 18
ORA-06512: at "SYS.DBMS_STREAMS_DATAPUMP_UTIL", line 80
ORA-06512: at "SYS.DBMS_STREAMS_DATAPUMP", line 219
ORA-06512: at "SYS.DBMS_INTERNAL_SAFE_SCN", line 44
ORA-06512: at line 5
 
SET_EXPORT_SCN
Undocumented dbms_internal_safe_scn.set_export_scn(
SCHEMA          IN VARCHAR2,
NAME            IN VARCHAR2,
TYPE            IN VARCHAR2,
COOKIE          IN VARCHAR2,
SCN             IN NUMBER,
ORIGINAL_SCHEMA IN VARCHAR2,
ORIGINAL_NAME   IN VARCHAR2);
TBD
 
SET_SESSION_STATE
Undocumented dbms_internal_safe_scn.set_session_state(cookie IN VARCHAR2);
TBD
 
WAIT_FOR_SAFE_SCN
Returns the next, safe, SCN based above the current SCN dbms_internal_safe_scn.wait_for_safe_scn(
SCHEMA    IN VARCHAR2,
TABLENAME IN VARCHAR2,
TIMEOUT   IN VARCHAR2,
SCN       IN NUMBER,
DBID      IN NUMBER)
RETURN NUMBER;
SELECT current_scn
FROM v$database;

CURRENT_SCN
-----------
   18766958


DECLARE
 retVal NUMBER;
BEGIN
  retVal := dbms_internal_safe_scn.wait_for_safe_scn('UWCLASS', 'SERVERS', '1', 5340538, 428676178);
  dbms_output.put_line(TO_CHAR(retVal));
END;
/

PL/SQL procedure successfully completed.

Related Topics
Built-in Functions
Built-in Packages
DBMS_INTERNAL_LOGSTDBY
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