blog.gralike.com About Oracle, XMLDB and other interests

30Jul/100

C based XML tools in your $ORACLE_HOME

Being triggered by Laurent Schneider's post "extract xml from the command line"; I completely forgot about the C-based XDK tooling you nowadays can find in your $ORACLE_HOME. You, probably just like me, weren't even aware, there were some (C-based that is). Most of these are executable's and not "just" Java tools, although xsql is a shell script that still starts Java. More information can be found here in the "Oracle® XML Developer's Kit Programmer's Guide 11.2"

I mean in principle they are not "new", they were there since 8.1.x, but now they are compiled executables which you can use on the shell prompt and or in scripting and that is, at least for me, easier than doing the same via their $ORACLE_HOME/xdk Java counterparts.

A shortlist:

29Jul/100

External Views (XML based)

Something new? Eh? Should you do this? Eh?

In all, probably not, but for me this was a good exercise towards some more updated demo scripting for my "Boost your environment with XMLDB" presentation or hopefully more clearer relabeled Oracle Open World name for the almost same presentation called "Interfacing with Your Database via Oracle XML DB" (S319105). Just up front, there are some issues with the following:

  • Why should you do it at all. You should have a good reason doing so...
  • It can cause a lot of Physical I/O, at least initially when not cached in the SGA
  • Until current versions, AFAIK, it will do a lot of "Pickler Fetching", serializing in memory, which is very resource intensive (CPU/PGA)
  • ...and its probably not supported...?

...but it is good fun for a small exercise based on the following OTN Thread: "Error with basic XMLTable"...

Let me show you what I mean.

Via "bfilename" you are able, since a long time, I guess Oracle 9.2 and onwards, to read a file as a BLOB and because an "XMLTYPE" can swallow almost any datatype, you could do the following...

[oracle@localhost ~]$ sqlplus / AS sysdba
 
SQL*Plus: Release 11.2.0.1.0 Production ON Thu Jul 29 09:20:24 2010
 
Copyright (c) 1982, 2009, Oracle.  ALL rights reserved.
 
 
Connected TO:
Oracle DATABASE 11g Enterprise Edition Release 11.2.0.1.0 - Production
WITH the Partitioning, OLAP, DATA Mining AND Real Application Testing options
 
SQL> CREATE user otn IDENTIFIED BY otn account UNLOCK;
 
User created.
 
SQL> GRANT dba TO otn;
 
GRANT succeeded.
 
SQL> conn otn/otn
Connected.
 
SQL> sho user
USER IS "OTN"
 
SQL> SET pages 5000
SQL> SET LINES 1000
SQL> SET long 10000
 
SQL> SELECT xmltype(cursor(SELECT owner, schema_url, LOCAL FROM all_xml_schemas ORDER BY owner)) FROM dual;
 
XMLTYPE(CURSOR(SELECTOWNER,SCHEMA_URL,LOCALFROMALL_XML_SCHEMASORDERBYOWNER))
-----------------------------------------------------------------------------------------------------------
< ?xml version="1.0"?>
<rowset>
  <row>
    <owner>EXFSYS</owner>
    <schema_url>http://xmlns.oracle.com/rlmgr/rclsprop.xsd</schema_url>
    <local>NO</local>
  </row>
  <row>
    <owner>EXFSYS</owner>
    <schema_url>http://xmlns.oracle.com/rlmgr/rulecond.xsd</schema_url>
    <local>NO</local>
  </row>
  <row>
    <owner>MDSYS</owner>
    <schema_url>http://www.opengis.net/gml/feature.xsd</schema_url>
    <local>NO</local>
  </row>
  <row>
...
  </row><row>
    <owner>XDB</owner>
    <schema_url>http://xmlns.oracle.com/xdb/dav.xsd</schema_url>
    <local>NO</local>
  </row>
</rowset>
 
51 rows selected.

Lets write the output to disk in the /tmp directory or my Oracle Enterprise Linux environment...

 
SQL> sho user
USER IS "OTN"
 
SQL> CREATE OR REPLACE directory XMLDIR AS '/tmp/';
 
Directory created.
 
SQL> declare
  2     rc sys_refcursor;
  3  begin
  4     open rc FOR SELECT * FROM (SELECT owner, schema_url, LOCAL FROM all_xml_schemas ORDER BY owner);
  5  dbms_xslprocessor.clob2file(xmltype(rc).getClobVal(),'TMPDIR','otn_dev_xsd_schema.xml');
  6  end;
  7 ;
 
PL/SQL procedure successfully completed.
 
SQL> commit;
 
commit complete
 
SQL> ! ls -ltra /tmp/*.xml
 
-rw-rw-r-- 1 oracle oracle 6563 Jul 29 09:36 /tmp/otn_dev_xsd_schema.xml

Due to the fact the content of this XML file (be aware: 6K) is wellformed XML, for example the alert log is not wellformed, and I know its format, I could read it directly from my database session via the following...

29Jul/100

Advert: The Michigan OakTable Symposium

Lets say you can't make it to those presentations of Oracle Open World this year and you also hadn't the budget to come to Europe to see really (technically) in depth, practice driven, great (probably new) views on your performance and architecture work at work during Miracle Open World, then there is a great alternative: The Michigan OakTable Symposium.

Its "only" a 2 day symposium but you have a chance there to come up personal, discuss issues during presentations and on site, for instance in the lobby, with some of the top people in their field like, among others, Jonathan Lewis, Tanel Poder or Cary Millsap.

I really like those mini-conferences, because they always bring me new ideas how to solve problems at work or stuff that I am dealing with in my mind, seeing them from a new perspective or get new info and techniques, involving Oracle software, I didn't know about yet...

During this years The Michigan OakTable Symposium you have to chance to enjoy Cary's extended version (2 slots, one on Tuesday and one on Friday) of his "Thinking Clearly About Performance" presentation that won this year's ODTUG Editor's Choice Award. Anyway, almost all presenters during this 2 day event are Oracle ACE's, ACE Directors or the top in their field and really have something to say...

  • Christian Antognini
  • Mark Farnham
  • Randolph Geist
  • Alex Gorbachev
  • Tim Gorman
  • Marco Gralike
  • Eric Grancher
  • Jonathan Lewis
  • Cary Millsap
  • Doug Burns
  • Jeff Needham
  • Mogens Norgaard
  • Tanel Poder
  • Tuomas Pystynen
  • Robyn Sands
  • Joze Senegacnik
  • Riyaj Shamsudeen
  • Chen Shapira
  • Jeremiah Wilton
  • Andrew Zitelli

Their biographies of, I guess probably almost combined 200+ years of practical IT experience, can be found here:

As Mogens Norgaard said it during his remarks (see the video on Miracle Channel) on the new Second OakTable book called "Expert Oracle Practices: Oracle Database Administration from the Oak Table" that those "new" people really made a better book than the first one, they know their stuff...

Anyway, in short, I suggest to have a look at the MOTS agenda yourself:

See you there? If your not convinced look them up on the internet or via the OakTable aggregated www.oaktable.net blog site.

8-)

29Jul/100

XMLDB Oracle Open World Agenda…

Becoming a bit of a tradition actually...

Trying for others to avoid the same, at least it was in 2008/2009, ordeal going thru the O.O.W. Schedule / Content builder trying to find XMLDB topics, I listed those I could find on the XMLDB OTN Forum. As said, trying to follow up on a tradition and to get myself (and hopefully you) an overview on things to come during Oracle Open World 2010 (/Oracle Develop /JavaOne). This year I think its becoming BIG regarding amounts /attendance of people if not only due to the combination of O.O.W./Develop/JavaOne on the same spot in San Francisco...

So, for me and those who are interested, just like the year before, hereby an attempt to find all XMLDB related presentations, workshops and other events during Oracle Open World 2010. I will try to add info, time and days later on (and/or you might) if I find them and/or if they become known. See for XMLDB presentations and Hands-on Lab sessions here:

I hope you enjoy your presentations during O.O.W. and who knows we meet this year.

Not really into XMLDB presentations? Have a look at the 50+ Oracle ACE(D) presentations Oracle Open World and JavaOne, Oracle Develop listing here...

15Jul/100

XMLDB Whitepapers and Tooling about Design, Performance and Selectivity

From time to time the main Oracle XML DB page gets updated with new whitepapers, tooling or Oracle By Example/ Hands-on Lab examples. "Lately" some cool and interesting new whitepapers and updated tooling content were created on this main Oracle XML DB page. The following items and content are really worth reading. Small issue, though, is that you need a bit more than basic understanding to put all this "lessons learned from the last one, two years" into context, but its worth it and otherwise a small reprise on the Oracle XML DB Developers Guide is always useful. A bit like re-reading the Oracle Concepts Manual.

The "Ease of Use Tools" (xdbutilities.zip tool set) for handling XMLType Object Relational storage has been updated and is now applicable on Oracle 10.x and 11.x. No specific to be installed versioned tool set needed anymore. This prepacked tool set on PL/SQL packages is installable on both versions. The zip file also contains a whitepaper that describes some of the (performance) lessons learned while using XMLType Object Relational storage.

"Choosing the Best XMLType Storage Option for Your Use Case" gives you a good overview on what to choose regarding design / supporting structure principles and performance indications on what works best for your XML document.

"Best Practices to Get Optimal Performance out of XML Queries" has been written with the other two in mind. The principles and design decisions are the basis on which the XPath and XQuery solutions are explained. You will have to have a good understanding of the other two to effective implement the advice given in this whitepaper. In all a good whitepaper with lots of lessons learned and a bit of inside information if you can read between the lines on how things tick in XML DB land.

Very useful information if you seek a bit more detailed information after the Oracle XML DB Developers Guide doesn't supply all the answers anymore.

M.