Oracle Database 11g Release 2 - XMLDB New Features
1. Oracle XML Database Oracle Database 11g Release 2 New Features Marco Gralike – AMIS – OOW 2009
2. Started as DBA with Oracle 7 on Windows NT 3.1 (1994) Experienced with Oracle 7.x / 8.x / 9.x / 10.x and 11.1 Oracle 11g Beta tester for Oracle XMLDB Active Oracle OTN XMLDB Forum Member Oracle ACE Award for XMLDB Community Contributions OakTable Network member Who Am I
3. Other Improvements XDB Repository DBMS_METADATA RAC Support Structured XMLIndex aka: XMLIndex Structured Component Object Relational Partitioning (V 11.1.0.7.0) Equi-Partitioning by Reference Binary XML Partitioning Range, List, Hash New Features
6. XDB Repository Speed Improvement Now Securefile based were possible DBMS_METADATA Now supports Object Relational XMLType Structures DBMS_METADATA.GET_DDL RAC Protocol Server Support Other Improvements
8. XML Data Structure Structured XML Semi- Structured Unstructured XML Searching / Handling XML Content Document Driven Content / Data Driven Before we start Some definitions…
13. XML Index Options BTree Index BTree Index BTree Index bookstore Oracle Text Index Secondary Oracle Text Index Function based Index (XPath) book whitepaper Unstructured XMLIndex title author author chapter title author id paragraph content content
15. Simple: Unstructured XMLIndex SQL> CREATEINDEXxmlindex_idx ON “XMLTYPE_COLUMN"(xdata) INDEXTYPEISXDB.XMLINDEX; Index created. SQL> CREATEINDEXxmlindex_idx ON “XMLTYPE_TABLE"(object_value) INDEXTYPEISXDB.XMLINDEX; Index created.
31. With highly Structured XML data Likely candidates: ComplexTypes Structured Islands of Data Can be nested, but only one level They deliver Relational Performance…! Usage
32. Index Options – 11g Release 2 BTree Index BTree Index BTree Index bookstore Secondary Oracle Text Index Function based Index (XPath) book whitepaper Structured XMLIndex Un-structured XMLIndex title author author chapter title author id paragraph content content Highly Structured Islands of Data
33. Simpe: Structured XMLIndex SQL> CREATE INDEX xmlindex_sxi on xmldata_table (doc) indextype is xdb.xmlindex parameters ('GROUP elementinfo_group XMLTABLE xml_cnt_tab_elementinfo ' '/root/element' ' COLUMNS infocol VARCHAR2(4000) PATH ' 'info' ' '); Be aware ' '
34. XMLIndex Structured Component “Structured XMLIndex” Content Table(s) BasedonXMLTABLE syntax XMLTable construct canbenestedbut: Only ONE XMLType column allowed VIRTUAL column is passed CanbemaintainedManually Secondairyindexespossible Structured XMLIndex f (x) Content Tables
35. Structured XMLIndex (Partitioned) SQL> CREATE INDEX xmlindex_sxi on xmldata_table (doc) indextype is xdb.xmlindex LOCAL parameters ('GROUP elementinfo_group XMLTABLE xml_cnt_tab_elementinfo ' '/root/element' ' COLUMNS infocol VARCHAR2(4000) PATH ' 'info' ' '); LOCAL
40. Adding Structured Indexes SQL> ALTER INDEX xmlindex_sxi parameters ('ADD_GROUP GROUP new_group XMLTABLE xml_cnt_tab_added ' '/root/extra' ' COLUMNS extracol VARCHAR2(4000) PATH ' 'new_element' ' ');
41. Combining XML Index Options Unstructured XMLIndex bookstore Secondary Index book Structured XMLIndex whitepaper Structured XMLIndex title author author paragraph title author id chapter content content
42. Mixed XMLIndex structures CREATE INDEX xmlindex on TEST_RANGE_XML (doc) indextype is xdb.xmlindex PARAMETERS (' PATH TABLE path_table PATHS (EXCLUDE(/root)) '); BEGIN DBMS_XMLINDEX.registerParameter ('StructuredXML', 'ADD_GROUP GROUP ElementInfo XMLTABLE xml_content_table_info ' '/root/ElementInfo' ' COLUMNS ValueInfo VARCHAR2(4000) PATH ' 'ValueInfo' '); END; / ALTER INDEX xmlindex PARAMETERS('PARAM StructuredXML');
43. XMLIndex Maintenance ALTER INDEX XMLIndex Parameter Changes DBMS_XMLINDEX.DROPPARAMETER DBMS_XMLINDEX.MODIFYPARAMETER DBMS_XMLINDEX.REGISTERPARAMETER Manual Synchronizing an XMLIndex DBMS_XMLINDEX.SYNCINDEX DBMS_XMLINDEX.SYNCINDEX(user, ‘TAB', REINDEX=>TRUE);
45. New XML Partitioning Options Object Relational Partitioning Equi-Partitioning since version Oracle 11.1.0.7.0 Binary XML Partitioning Range List Hash Local partitioned XMLIndex LOCAL keyword in XMLIndex create syntax XMLIndex is not supported for HASH partitioning
46. XML Partitioning – Object RelationalStorage Generatevia DBMS_XMLSCHEMA XML Schema Based XDB Annotations xdb:defaultTable xdb:tableProps JDeveloper orXMLSpy ManualCreation DBMS_METADATA.GET_DDL EVENT setting [alter session set events='31098 trace name context forever'; ] For Data centric XML Data + XML Schema
47. An Example (V9.2-10.2) <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb"> <xs:element name="TestElement" type="TestElementType" xdb:defaultTable="TESTELEMENT" xdb:tableProps="PARTITION BY RANGE (XMLDATA.IDENTIFIER) (PARTITION P01 VALUES LESS THAN (10) TABLESPACE users, PARTITION P02 VALUES LESS THAN (20) TABLESPACE users, PARTITION P03 VALUES LESS THAN (MAXVALUE) TABLESPACE users)"/> <xs:complexType name="TestElementType"> <xs:sequence> <xs:element name="Identifier" type="xs:int" xdb:SQLName="IDENTIFIER"/> <xs:element name="Person" type="xs:string"/> <xs:element name="Street" type="xs:string"/> <xs:element name="City" type="xs:string"/> <xs:element name="State" type="xs:string"/> <xs:element name="Zipcode" type="xs:string"/> </xs:sequence> </xs:complexType></xs:schema>
50. XML Partitioning – Binary XML Storage ManualCreation Partition Options: Range – List – Hash XML Schema basedor Schema less XML Partitioningbasedon Column Virtual Column XMLTABLEsyntax BasicfileorSecurefileStorage Post-parseRepresentation of XML Data For Document centric XML Data +/- XML Schema
51. Binary XML – RANGE Partitioning SQL> CREATE TABLE TEST_RANGE_XML 2 ( "ID" NUMBER(15,0), 3 "DOC" "SYS"."XMLTYPE" 4 ) SEGMENT CREATION IMMEDIATE 5 NOCOMPRESS NOLOGGING 6 TABLESPACE "XML_DATA" 7 XMLTYPE COLUMN "DOC" STORE AS SECUREFILE BINARY XML 8 (TABLESPACE "XML_DATA" 9 NOCOMPRESS KEEP_DUPLICATES) 10 XMLSCHEMA "http://www.server.com/XMLSchema_V1.0.xsd" 11 ELEMENT "ROOT" 12 DISALLOW NONSCHEMA 13 PARTITION BY RANGE("ID") 14 (PARTITION RANGE_PART_01 VALUES LESS THAN (100) TABLESPACE "XML_DATA" 15 ,PARTITION RANGE_PART_02 VALUES LESS THAN (200) TABLESPACE "XML_DATA") 16 ,PARTITION RANGE_PART_MAX VALUES LESS THAN (MAXVALUE));
52. Binary XML – LIST Partitioning SQL> CREATE TABLE TEST_LIST_XML 2 ( "REGION" VARCHAR2(3), 3 "DOC" "SYS"."XMLTYPE" 4 ) SEGMENT CREATION IMMEDIATE 5 NOCOMPRESS NOLOGGING 6 TABLESPACE "XML_DATA" 7 XMLTYPE COLUMN "DOC" STORE AS SECUREFILE BINARY XML 8 (TABLESPACE "XML_DATA" 9 NOCOMPRESS KEEP_DUPLICATES) 10 XMLSCHEMA "http://www.server.com/XMLSchema_V1.0.xsd" 11 ELEMENT "ROOT" 12 DISALLOW NONSCHEMA 13 PARTITION BY LIST("REGION") 14 (PARTITION LIST_PART_01 VALUES ('AAA', 'BBB') 15 ,PARTITION LIST_PART_02 VALUES ('CCC', 'DDD'));
53. Binary XML – HASH Partitioning XMLIndex is not allowed SQL> CREATE TABLE TEST_HASH_XML 2 ( "ID" NUMBER(15,0), 3 "DOC" "SYS"."XMLTYPE" 4 ) SEGMENT CREATION IMMEDIATE 5 NOCOMPRESS NOLOGGING 6 TABLESPACE "XML_DATA" 7 XMLTYPE COLUMN "DOC" STORE AS SECUREFILE BINARY XML 8 (TABLESPACE "XML_DATA" 9 NOCOMPRESS KEEP_DUPLICATES) 10 XMLSCHEMA "http://www.server.com/XMLSchema_V1.0.xsd" 11 ELEMENT "ROOT" 12 DISALLOW NONSCHEMA 13 PARTITION BY HASH("ID") 14 (PARTITION "HASH_SECTION_01" TABLESPACE "XML_DATA_01" 15 ,PARTITION "HASH_SECTION_02" TABLESPACE "XML_DATA_02" 16 ,PARTITION "HASH_SECTION_03" TABLESPACE “XML_DATA_03" ); but an Oracle Text Index is
55. Notes To Remember… Only ONE XMLIndex is allowed in a user schema Add extra XMLIndex structures (structured or unstructured) via ADD_GROUP syntax Only SYNC=ALWAYS is allowed while using mixed XMLIndex structures or add more than one You need the LOCAL parameter to create local partitioned XMLIndexes An XMLIndex on a HASH partitioned XMLType column or XMLType table, isnot allowed But you can create an Oracle Text Index on such structures
58. Maintenance, Storage Improvements XML Partitioning Binary XML & Object Relational XMLType DBMS_METADATA Object Relational Support Performance Improvements New XMLIndex Option More Flexibility Securefile XDB Repository Enhancements / New XMLDB Features in 11gR2
60. References XMLDB DevelopersGuide http://www.oracle.com/pls/db112/homepage The XMLDB Forum http://forums.oracle.com/forums/forum.jspa?forumID=34 XML DB FAQ Thread http://forums.oracle.com/forums/thread.jspa?threadID=410714 Blog http://technology.amis.nl/blog http://blog.gralike.com
61.
62.
63. Security Principals Database Users and Roles LDAP Users and Groups Oracle Fusion Users and Roles = (Your) Application Users and Roles Security Classes A security class is a named set of privileges. It includes privileges that it inherits from other security classes, and it can include privileges that it defines. Extra Fine Grained Security possible Security Improvements