Tuesday, January 24, 2012

Enable "Dynamic service registration" with Oracle TNS Listener

-- shows if it is enabled
sqlplus / as sysdba
show parameter local_listener

alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=localhost)(PORT=1521))'
alter system register;

DBMS_XMLSCHEMA.registerSchema ORA-19046: Out-of-line table cannot be shared by two top-level tables.

During DBMS_XMLSCHEMA.registerSchema(?, ?, TRUE , TRUE, FALSE, TRUE, FALSE, ?, 2, 0) running Oracle DB 11.2.0.3 (.2) an error occurred:

ORA-19046: Out-of-line table cannot be shared by two top-level tables.
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 3
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 14
ORA-06512: at line 1
No issue on Oracle DB 11.2.0.1

ALTER SESSION SET events='31098 trace name context forever'; used for XMLDB tracing didn't show anything meaning full.

Searching Metalink I found that  gentables=TURE might be causing an issue.  Changing to DBMS_XMLSCHEMA.registerSchema(?, ?, TRUE , TRUE, FALSE, FALSE, FALSE, ?, 2, 0) fixed it.
Using XMLTYPE example_row STORE AS OBJECT RELATIONAL XMLSCHEMA I don't need those tables.

DBMS_XMLSCHEMA.REGISTERSCHEMA(
    schemaurl        IN  VARCHAR2,
    schemadoc        IN  VARCHAR2,
    local            IN  BOOLEAN := TRUE,
    gentypes         IN  BOOLEAN := TRUE,
    genbean          IN  BOOLEAN := FALSE,
    gentables        IN  BOOLEAN := TRUE,
    force            IN  BOOLEAN := FALSE,
    owner            IN  VARCHAR2 := NULL,
    enablehierarchy  IN  PLS_INTEGER := DBMS_XMLSCHEMA.ENABLE_CONTENTS,
    options          IN  PLS_INTEGER := 0);

24/Feb/2012 Update: Getting error when trying to insert data:
ORA-21700: object does not exist or is marked for delete
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 1

Thus returning back to  gentables := TRUE, and adding xdb:defaultTable="" into schema definition as recommended in  http://www.oracle.com/technetwork/database/features/xmldb/downloads/oow2010-complex-xml-schemas-176089.pdf
It seems "STORE AS OBJECT RELATIONAL" is only good for simple schemas when you really need super fast access to query underlying data. "store AS BINARY XML" is not available in 10g. See http://www.liberidu.com/blog/?p=203 for available storage options.