Oracle DBMS_INTERNAL_SAFE_SCN
Version 12.2.0.1

General Information
Library Note Morgan's Library Page Header
"I spent my entire adult life looking out for the well-being, the training, the equipping of the troops for whom I was responsible. I will not be lectured about what our military needs by a five-deferment draft dodger,"
~ Sen. Tammy Duckworth
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('','12.1.0.1','12.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 3874
ORA-06512: at "SYS.DBMS_DATAPUMP", line 5041
ORA-06512: at "SYS.DBMS_STREAMS_DATAPUMP_UTIL", line 18
ORA-06512: at "SYS.DBMS_STREAMS_DATAPUMP_UTIL", line 72
ORA-06512: at "SYS.DBMS_STREAMS_DATAPUMP", line 219
ORA-06512: at "SYS.DBMS_INTERNAL_SAFE_SCN", line 48
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
DBMS_INTERNAL_LOGSTDBY
Packages
What's New In 12cR1
What's New In 12cR2

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