Oracle DBMS_REGISTRY
Version 12.1.0.1

General Information
Library Note Morgan's Library Page Footer
The Library is currently in the process of being upgraded from Oracle Database Version 11.2.0.3 to 12.1.0.1. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition) and may contain references to CDBs, PDBs, and other objects you may not be familiar with such as CDB_OBJECTS_AE: Welcome to 12c.
Purpose API for creating and maintaining registry entries. This is one of those undocumented packages where I feel it essential to warn readers that the demos here are for education purposes only. If you run any of them you may totally destroy your database. Oracle Support is likely not going to bail you out and neither will I.
AUTHID DEFINER
Constants
Name Data Type Value
release_status VARCHAR2(30) 'Beta'
release_version registry$.version%type '12.1.0.0.2'
Data Types -- Component Hierarchy Type and CONSTANTS
TYPE comp_list_t IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
IMD_COMPS CONSTANT NUMBER :=1; /* immediate subcomponents */
TRM_COMPS CONSTANT NUMBER :=2; /* terminal subcomponents */
ALL_COMPS CONSTANT NUMBER :=3; /* all subcomponents */

-- Schema List Parameter
TYPE schema_list_t IS TABLE OF VARCHAR2(30);

-- Component dependency Type - table of component IDs
TYPE comp_depend_list_t IS TABLE OF VARCHAR2(30);

-- Component dependency Type - table of component IDs and associated namespaces
TYPE comp_depend_record_t IS RECORD(
cid        VARCHAR2(30),   -- component id
cnamespace VARCHAR2(30));  -- component namespace
Dependencies
ADM_EXPFIL_SYSTRIG INITJVMAUX VALIDATE_APEX
APS_VALIDATE OBJ$ VALIDATE_CONTEXT
DBA_REGISTRY PLITBLM VALIDATE_DV
DBA_REGISTRY_HIERARCHY REGISTRY$ VALIDATE_EXF
DBA_SERVER_REGISTRY REGISTRY$DATABASE VALIDATE_OLS
DBMS_ASSERT REGISTRY$DEPENDENCIES VALIDATE_ORDIM
DBMS_CLUSTDB REGISTRY$LOG VALIDATE_OWM
DBMS_CRYPTO REGISTRY$PROGRESS VALIDATE_RUL
DBMS_EXPFIL_EXP REGISTRY$SCHEMAS VALIDATE_SDO
DBMS_EXPFIL_UTL USER$ WM_INSTALLATION
DBMS_REGISTRY_SYS USER_REGISTRY WWV_FLOW_DB_VERSION
DBMS_REGXDB UTL_RAW X$KSPPCV
DBMS_SYS_ERROR V$DATABASE X$KSPPI
DRVODM V$INSTANCE XMLVALIDATE
DUAL V$TIMEZONE_FILE XOQ_VALIDATE
EXPRESSIONINDEXMETHODS    
Documented No
First Available Not known
Registry Log Query col errmsg format a30
col namespace format a10
col optime format a30

SELECT * FROM registry$log;
Security Model Owned by SYS with EXECUTE granted to APEX_040200, CTXSYS, DVSYS, EXFSYS, LBACSYS, MDSYS, WMSYS, and XDB
Source {ORACLE_HOME}/rdbms/admin/dbmscr.sql
Subprograms
 
CHECK_SERVER_INSTANCE
Database must be open for upgrade or downgrade for this to be used dbms_registry.check_server_instance;
-- see $ORACLE_HOME/rdbms/admin/cmpupstr.sql
exec dbms_registry.check_server_instance;
 
COMP_NAME
Returns the component name corresponding to a component ID dbms_registry.comp_name(comp_id IN VARCHAR2) RETURN VARCHAR2;
desc registry$

SELECT pid FROM registry$;

-- loaded procedure from $ORACLE_HOME/rdbms/admin/catcr.sql altered to only show the use of this procedure

Warning: Running this code could be fatal to your system.
This demo is here for education purposes only and should not to be run.

PROCEDURE loaded(comp_id IN VARCHAR2) IS
 p_id VARCHAR2(30) := NLS_UPPER(comp_id);
 p_version VARCHAR2(17) := NLS_UPPER(comp_version);
 p_banner VARCHAR2(80) := comp_banner;
BEGIN
  IF exists_comp(p_id) THEN
    IF p_version IS NULL THEN
      SELECT version INTO p_version FROM v$instance;
    END IF;

    IF p_banner IS NULL THEN
      SELECT banner INTO p_banner FROM v$version
      WHERE rownum = 1;

      p_banner:= substr(p_banner, instr(p_banner,'-',1) + 2);
      p_banner:= dbms_registry.comp_name(p_id) || ' Release ' || p_version || ' - ' || p_banner;
    END IF;
  ELSE
    raise NO_COMPONENT;
  END IF;
END loaded;
/
 
DELETE_PROGRESS_ACTION
Undocumented dbms_registry.delete_progress_action(comp_id IN VARCHAR2, action IN VARCHAR2);
TBD
 
DOWNGRADED
Undocumented

The demo, at right, is copied from ?/rdbms/admin/dve112.sql
dbms_registry.downgraded(comp_id IN VARCHAR2, old_version IN VARCHAR2);
EXECUTE DBMS_REGISTRY.DOWNGRADING('DV');

-- Bug 6503742
update DVSYS.FACTOR$ SET GET_EXPR = 'UTL_INADDR.GET_HOST_ADDRESS(DVSYS.DBMS_MACADM.GET_INSTANCE_INFO(''HOST_NAME''))' where name='Database_IP';

EXECUTE DBMS_REGISTRY.DOWNGRADED('DV', '11.2.0');
 
DOWNGRADING
Undocumented dbms_registry.downgrading(
comp_id    IN VARCHAR2,
old_name   IN VARCHAR2,
old_proc   IN VARCHAR2,
old_schema IN VARCHAR2,
old_parent IN VARCHAR2);
See Downgraded Demo Above
 
EDITION (new 12.1)
Undocumented and appears to not work dbms_registry.edition(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT comp_id, comp_name
FROM dba_registry
ORDER BY 1;

SELECT dbms_registry.edition('APEX')
FROM dual;
 
GET_DEPENDENT_COMPS
Returns a list of dependent components dbms_registry.get_dependent_comps(comp_id IN VARCHAR2)
RETURN dbms_registry.comp_depend_list_t;
SELECT comp_id, comp_name
FROM dba_registry;

DECLARE
 outrec dbms_registry.comp_depend_list_t;
BEGIN
  outrec := dbms_registry.get_dependent_comps('OWB');
END;
/
 
GET_DEPENDENT_COMPS_REC
Undocumented dbms_registry.get_dependent_comps_rec(comp_id IN VARCHAR2) RETURN comp_depend_rec;
TBD
 
GET_PROGRESS_STEP
Undocumented dbms_registry.get_progress_step(comp_id IN VARCHAR2, action IN VARCHAR2) RETURN NUMBER;
TBD
 
GET_PROGRESS_VALUE
Undocumented dbms_registry.get_progress_value(comp_id IN VARCHAR2, action IN VARCHAR2) RETURN NUMBER;
TBD
 
GET_REQUIRED_COMPS
Undocumented dbms_registry.get_required_comps(comp_id IN VARCHAR2) RETURN dbms_registry.comp_depend_list_t;
SELECT comp_id, comp_name
FROM dba_registry;

DECLARE
 outrec dbms_registry.comp_depend_list_t;
BEGIN
  outrec := dbms_registry.get_required_comps('OWB');
END;
/
 
GET_REQUIRED_COMPS_REC
Undocumented dbms_registry.get_required_comps_rec(
<record> OUT dbms_registry.comp_depend_record_t,
comp_id  IN  VARCHAR2)
RETURN dbms_registry.comp_depend_rec;
TBD
 
INVALID
Mark an item in the registry as invalid dbms_registry.invalid(comp_id IN VARCHAR2);
col comp_id format a10

SELECT comp_id
FROM dba_registry
ORDER BY 1;

PROCEDURE validate IS
 start_time DATE;
 end_time   DATE;
 option_val VARCHAR2(64);
 g_null     CHAR(1);
BEGIN
  BEGIN
    SELECT null INTO g_null FROM obj$
    WHERE owner#=0 AND name='V$CACHE_TRANSFER';
    -- valid if v$ges_statistics exists
    SELECT value INTO option_val FROM v$option
    WHERE parameter = 'Real Application Clusters';
    -- check if RAC option has been linked in
    IF option_val = 'TRUE' THEN
      dbms_registry.valid('RAC');
    ELSE
      dbms_registry.invalid('RAC');
    END IF;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      dbms_registry.invalid('RAC');
  END;
END validate;
/
 
IS_COMPONENT
Determines whether a component id corresponds with a component dbms_registry.is_component(comp_id IN VARCHAR2) RETURN BOOLEAN;
set serveroutput on

BEGIN
  IF dbms_registry.is_component('XML') THEN
    dbms_output.put_line('Is a component');
  ELSE
    dbms_output.put_line('Not a component');
  END IF;
END;
/
 
IS_IN_REGISTRY
Determines whether a component is loaded into the registry dbms_registry.is_in_registry(comp_id IN VARCHAR2) RETURN BOOLEAN;
set serveroutput on

BEGIN
  IF dbms_registry.is_in_registry('XML') THEN
    dbms_output.put_line('Is in the registry');
  ELSE
    dbms_output.put_line('Not in the registry');
  END IF;
END;
/
 
IS_IN_UPGRADE_MODE (new 12.1)
Definitely returns FALSE if not in upgrade mode. Have not tested to determine if it returns TRUE or nothing when actually in upgrade mode dbms_registry.is_in_upgrade_mode RETURN BOOLEAN;
conn / as sysdba

set serveroutput on

BEGIN
  IF dbms_registry.is_in_upgrade_mode THEN
    dbms_output.put_line('In Upgrade Mode');
  ELSE
    dbms_output.put_line('Not In Upgrade Mode');
  END IF;
END;
/
 
IS_LOADED
Returns 1 if the componenet version number matches the name-value pair submitted: Otherwise 0 dbms_registry.is_loaded(comp_id IN VARCHAR2, version IN VARCHAR2) RETURN NUMBER;
SELECT comp_id, version
FROM dba_registry;

SELECT dbms_registry.is_loaded('XML', '12.1.0.0.1') FROM dual;

SELECT dbms_registry.is_loaded('XML', '12.1.0.0.2') FROM dual;
 
IS_STARTUP_REQUIRED
Returns whether a registry component requires a startup dbms_registry.is_startup_required(comp_id IN VARCHAR2) RETURN NUMBER;
SELECT comp_id, procedure, startup
FROM dba_registry;

SELECT dbms_registry.is_startup_required('XML') FROM dual;
 
IS_TRACE_EVENT_SET (new 12.1)
Undocumented and behaviour is not what I would expect even if the string I supplied is invalid which it very well could be dbms_registry.is_trace_event_set(trace_event VARCHAR2) RETURN BOOLEAN;
BEGIN
  IF dbms_registry.is_trace_event_set('10046') THEN
    dbms_output.put_line('10046 Trace Is Set');
  ELSE
    dbms_output.put_line('Trace Is Not Set');
  END IF;
END;
/
BEGIN
*
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "SYS.DBMS_REGISTRY", line 1616
ORA-06512: at line 2
 
IS_VALID
Determines if a registry component is valid dbms_registry.is_valid(comp_id IN VARCHAR2, version IN VARCHAR2) RETURN NUMBER;
BEGIN
  IF dbms_registry.is_valid('JAVAVM', dbms_registry.release_version) =1
  THEN
    dbms_registry.loaded('CATJAVA');
    dbms_registry_sys.validate_catjava;
  END IF;
END;
/
 
LOADED
Indicate load complete dbms_registry.loaded(
comp_id      IN VARCHAR2,
comp_version IN VARCHAR2,
comp_banner  IN VARCHAR2);
BEGIN
  dbms_registry.loaded('CATALOG');
END;
/
 
LOADING
Indicate that the component is in the process of being loaded

Overload 1
dbms_registry.loading(
comp_id     IN VARCHAR2,
comp_name   IN VARCHAR2,
comp_proc   IN VARCHAR2,
comp_schema IN VARCHAR2,
comp_parent IN VARCHAR2);
set linesize 121
col comp_name format a35
col procedure format a35
col schema format a10
col parent_id format a10

SELECT comp_id, comp_name, procedure, schema, parent_id
FROM dba_registry;

BEGIN
  dbms_registry.loading('CATALOG', 'Oracle Database Catalog Views', 'dbms_registry_sys.validate_catalog');
END;
/
Overload 2 dbms_registry.loading(
comp_id      IN VARCHAR2,
comp_name    IN VARCHAR2,
comp_proc    IN VARCHAR2,
comp_schema  IN VARCHAR2,
comp_schemas IN dbms_registry.schema_list_t,
comp_parent  IN VARCHAR2);
TBD
 
NOTHING_SCRIPT
Returns the path to nothing.sql dbms_registry.nothing_script RETURN VARCHAR2;
SELECT dbms_registry.nothing_script FROM dual;
 
NUM_OF_EXADATA_CELLS (new 12.1)
Returns the number of Exadata cells dbms_registry.num_of_exadata_cells RETURN NUMBER;
SELECT dbms_registry.num_of_exadata_cells
FROM dual;
 
OPTION_OFF (new 12.1)
Disables a component option in the registry.

Warning: I am not aware of any method of re-enabling an option so don't do this except in a throw-away training database.
dbms_registry.option_off(comp_id IN VARCHAR2);
SELECT comp_id, comp_name, status, startup
FROM dba_registry
ORDER BY 1;

exec dbms_registry.option_off('APEX');

SELECT comp_id, comp_name, status, startup
FROM dba_registry
ORDER BY 1;
 
PREV_VERSION
Returns the previous version of a registry component dbms_registry.prev_version(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT dbms_registry.prev_version('XML') FROM dual;
 
REMOVED
A component has been removed from the registry dbms_registry.removed(comp_id IN VARCHAR2);
EXECUTE dbms_registry.removed('EXF');
 
REMOVING
Removes a component from the registry dbms_registry.removing(comp_id IN VARCHAR2);
-- drop the Expression Filter user with cascade option

exec dbms_registry.removing('EXF');
drop user exfsys cascade;
 
RESET_VERSION
Undocumented dbms_registry.reset_version(comp_id IN VARCHAR2);
exec dbms_registry.reset_version('EXF');
 
SCHEMA
Returns the schema owner of a registry component dbms_registry.schema(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT dbms_registry.schema('EXF') FROM dual;
 
SCHEMA_LIST
Returns the schema owners of a registry component dbms_registry.schema_list(comp_id IN VARCHAR2) RETURN dbms_registry.schema_list_t;
TBD
 
SCHEMA_LIST_STRING
Undocumented dbms_registry.schema_list_string(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT dbms_registry.schema_list_string('EXF') FROM dual;
 
SCRIPT
Undocumented dbms_registry.script(comp_id IN VARCHAR2, script_name IN VARCHAR2) RETURN VARCHAR2;
-- create helper package for text index on xdb resource data

COLUMN xdb_name NEW_VALUE xdb_file NOPRINT;

SELECT dbms_registry.script('CONTEXT','@dbmsxdbt.sql') AS xdb_name
FROM DUAL;
 
SCRIPT_PATH
Returns the path to the script for a registry component dbms_registry.script_path(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT dbms_registry.script_path('EXF') FROM dual;
 
SCRIPT_PREFIX
Returns a registry component's prefix dbms_registry.script_prefix(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT dbms_registry.script_prefix('EXF') FROM dual;
 
SESSION_NAMESPACE
Returns the namespace for a session dbms_registry.session_namespace RETURN VARCHAR2;
SELECT dbms_registry.session_namespace FROM dual;
 
SET_COMP_NAMESPACE
Sets a registry component's namespace dbms_registry.set_comp_namespace(comp_id IN VARCHAR2, namespace IN VARCHAR2);
exec dbms_registry.set_comp_namespace('RAC', 'SERVER');
 
SET_EDITION (new 12.1)
Sets Database Edition: EE or SE
Overload 1
dbms_registry.set_edition(comp_id IN VARCHAR2);
exec dbms_registry.set_edition('APEX');
Overload 2 dbms_registry.set_edition(
comp_id     IN VARCHAR2,
edition_var IN VARCHAR2);
exec dbms_registry.set_edition('APEX', 'EE');
 
SET_PROGRESS_ACTION
Undocumented dbms_registry.set_progress_action(
comp_id IN VARCHAR2,
action  IN VARCHAR2,
value   IN VARCHAR2,
step    IN NUMBER);
TBD
 
SET_PROGRESS_STEP
Undocumented dbms_registry.set_progress_step(
comp_id IN VARCHAR2,
action  IN VARCHAR2,
step    IN NUMBER);
TBD
 
SET_PROGRESS_VALUE
Undocumented dbms_registry.set_progress_value(
comp_id IN VARCHAR2,
action  IN VARCHAR2,
value   IN VARCHAR2);
TBD
 
SET_RDBMS_STATUS (new 12.1)
Sets the component status in the registry

1 = VALID
dbms_registry.set_rdbms_status(
comp_id IN VARCHAR2,
status  IN NUMBER);
See SET_RDBMS_UPGRADED_STATUS Demo Below
 
SET_RDBMS_UPGRADED_STATUS (new 12.1)
Sets the component status in the registr to upgraded dbms_registry.set_rdbms_upgraded_status(comp_id IN VARCHAR2);
SELECT status
FROM dba_registry
WHERE comp_id = 'APEX';

exec dbms_registry.set_rdbms_upgraded_status('APEX');

SELECT status
FROM dba_registry
WHERE comp_id = 'APEX';

exec dbms_registry.set_rdbms_status('APEX', 1);
 
SET_REQUIRED_COMPS
Undocumented dbms_registry.set_required_comps(
comp_id          IN VARCHAR2,
comp_depend_list IN comp_depend_list_t);
TBD
Undocumented dbms_registry.set_required_comps(
comp_id          IN VARCHAR2,
comp_depend_list IN comp_depend_rec);
TBD
 
SET_SESSION_NAMESPACE
Sets the registry namespace for a component dbms_registry.set_session_namespace(namespace IN VARCHAR2);
exec dbms_registry.set_session_namespace('SERVER');
 
STARTUP_COMPLETE
Undocumented dbms_registry.startup_complete(comp_id IN VARCHAR2);
exec dbms_registry.startup_complete('RAC');
 
STARTUP_REQUIRED
Updates the registry to indicate that a component requires startup dbms_registry.startup_required(comp_id IN VARCHAR2);
TBD
 
STATUS
Determine the status of a database component from the registry dbms_registry.status(comp_id IN VARCHAR2) RETURN VARCHAR2;
BEGIN
  IF dbms_registry.status('CATJAVA') IS NULL THEN
    RAISE_APPLICATION_ERROR(-20000, 'CATJAVA has not been loaded.');
  END IF;
END;
/

BEGIN
  IF dbms_registry.status('XDB') = 'VALID' THEN
    execute immediate 'create table xdb.migr9202status (n integer)';
    execute immediate 'insert into xdb.migr9202status values (1000)';
  END IF;
END;
/
 
STATUS_NAME
Undocumented dbms_registry.status_name(status IN NUMBER) RETURN VARCHAR2;
SELECT dbms_registry.status_name(1)
FROM dual;

SELECT dbms_registry.status_name(0)
FROM dual;

SELECT dbms_registry.status_name(-1)
FROM dual;
 
SUBCOMPONENTS
Undocumented dbms_registry.subcomponents(
comp_id     IN VARCHAR2,
comp_option IN NUMBER,
RETURN dbms_registry.comp_list_t;
TBD
 
UPDATE_SCHEMA_LIST
Undocumented dbms_registry.update_schema_list(
comp_id      IN VARCHAR2,
comp_schemas IN dbms_registry.schema_list_t);
set serveroutput on

-- indicate CATPROC load complete and check validity
BEGIN
  dbms_registry.update_schema_list('CATPROC', dbms_registry.schema_list_t('SYSTEM', 'OUTLN', 'DBSNMP'));
  dbms_registry.loaded('CATPROC');
  dbms_registry_sys.validate_catproc;
  dbms_registry_sys.validate_catalog;
END;
/
 
UPGRADED
Undocumented

The demo, at right, is copied from ?/rdbms/admin/exfcpu.sql
dbms_registry.upgraded(
comp_id     IN VARCHAR2,
new_version IN VARCHAR2,
new_banner  IN VARCHAR2);
ALTER SESSION SET CURRENT_SCHEMA = EXFSYS;

EXECUTE dbms_registry.upgradeing(`EXF');

-- insert script invocations required to apply the CPU to the component

EXECUTE dbms_registry.upgraded(`EXF');

ALTER SESSION SET CURRENT_SCHEMA = SYS;
 
UPGRADING
Undocumented

Overload 1
dbms_registry.upgrading(
comp_id    IN VARCHAR2,
new_name   IN VARCHAR2,
new_proc   IN VARCHAR2,
new_schema IN VARCHAR2,
new_parent IN VARCHAR2);
See Upgraded Demo Above
Overload 2 dbms_registry.upgrading(
comp_id     IN VARCHAR2,
new_name    IN VARCHAR2,
new_proc    IN VARCHAR2,
new_schema  IN VARCHAR2,
new_schemas IN dbms_registry.schema_list_t,
new_parent  IN VARCHAR2);
See Upgraded Demo Above
 
VALID
Mark an item in the registry as valid dbms_registry.valid(comp_id IN VARCHAR2);
See INVALID Demo Above
 
VERSION
Returns the version of a registry component dbms_registry.version(comp_id IN VARCHAR2) RETURN VARCHAR2;
SELECT dbms_registry.version('CATPROC') FROM dual;

Related Topics
DBMS_REGISTRY_SERVER
DBMS_REGISTRY_SYS
Exadata
Packages

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