 |
|
Oracle
10g XML file formatting
Oracle Database Tips by Burleson Consulting |
Tagging flat files is the wave of the
future and being able to manage Oracle log files with XML is an
exciting new Oracle10g feature. For complete details, see
Oracle 10g new features.
We also see the Oracle 10 release 2 new
XQuery
feature, and starting in 11g, you can store XML either as a CLOB or a binary
data type, adding flexibility. Oracle11g will support query mechanisms for XML
including XQuery and SQL XML, emerging standards for querying XML data stored
inside tables.
XML in ApEx (HTML-DB)
There is a distinct difference between
Importing XML data and the other imports. The user will not be asked if they
would like to import into an existing table or a new table as in the other
import wizards. The XML Import requires there be an existing table into which to
import.
The XML Import is a transactional operation meaning it is all-or-nothing. If one
record fails, the entire transaction is rolled back and none of the data will be
imported.
It is important to note that APEX itself is written with APEX. The XML
Import wizard is performing the following tasks:
- Uploading an XML file
- Storing the XML file in the database
- Inserting the data from the XML file into
the selected table
If APEX is doing this, so can you. With the
growing popularity of XML formatted files, it may be necessary to write a few
web pages to perform this very same function in your own applications.
XML for analytic workspaces
Oracle
10g introduces the new
package dbms_aw_xml, which comes with a comprehensive set of
functions. This package allows you to create the Analytic Workspace (AW)
and execute the calculations specified in the XML metadata.
The dbms_aw_xml contains the
following functions:
-
validate - This function verifies that the XML provided by the user is
well-formed and is ready for execution. It checks that all the
implicit AW constraints are met.
-
interpret - This function interprets the input and makes changes to the AW named
?awname?. If there is no AW named awname, one is created by this
function. INTERPRET accepts the users XML and calls the
aw_create olap dml package to create the AW and perform the
specific calculations
-
describe -
This function allows the users to examine the contents of the AW. It
takes the awname as the input and outputs the information as XMLType.
If the input is provided, it outputs the information about all AW
objects.
See here for details on using the
Oracle XML export wizard.
Oracle audit logs in XML
One of the foremost issues with Oracle auditing
is the management of the huge volumes of audit data (for "select auditing", the
daily log size could exceed the entire database size, every day). Oracle
10g now has XML formatting for the audit logs, facilitating the display of the
audit details in web pages.
You need to set two init.ora parms to enable
XML audit trail formatting:
audit_trail=xml
audit_file_dest='directorypath'
Best of all, even though the audit logs are stored outside of the database,
they can still be queried as external tables, and you can also use the
v$xml_audit_trail view to query audit log details.
 |
If you like Oracle tuning, see the book "Oracle
Tuning: The Definitive Reference", with 950 pages of tuning tips and
scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot of Oracle tuning scripts. |