Oracle DBMS_INTERNAL_SAFE_SCN
Version 18.3.0.1

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 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 4750
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4497
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5950
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;
-- it appears the timeout parameter must be a string that evaluates to a number
SELECT current_scn
FROM v$database;

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;
/

Related Topics
Built-in Functions
Built-in Packages
DBMS_INTERNAL_LOGSTDBY
What's New In 18cR3
What's New In 19cR3

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