ORA-31098: Internal event to turn on XDB tracing

“Do not document”…

…if not only due to that comment, it is a very interesting event, if not only that it seems that it is used for multiple items and not only tracing. I tried to figure out what I could do with this event regarding the XDB Protocol Server trying to figure out how it works and to trace a partially documented/undocumented feature in the manuals that makes use of the XDB Protocol Server.

The XDB Procotol Server architecture is used for more than the (APEX) PL/SQL Gateway. It also supports HTTP, FTP and WebDAV (so called) “servlets” and a hook-in into C kernel library that enables the XMLDB Native Database Web Service (NDWS).


The following should only be done asked by Oracle Support and/or are at your own risk. Always test on a test environment (so if when the database is corrupt is not a big deal)


Anyway, “events” can be set on session and system level and/or via the oradebug facility. Julian Dyke has a good post on the basics. As Julian describes, there are four types of numeric events: Immediate dumps, Conditional dumps, Trace dumps, Events that change database behavior. The “fun” with the ORA-31098 seems that is used for multiple things. It at least creates DDL scripts in trace file during dbms_xmlschema registration and it also traces XDB Protocol Server issues. During X-Mas and new years eve I had some time, so I tried to figure out some of them…

Described in a small overview XDB event post, some of these settings can be found somewhere in the Oracle manuals…

Debugging XML Schema Registration

ORA-31098: Internal event to turn on XDB tracing

When you store your data via the object relational method, using DBMS_XMLSCHEMA.RegisterSchema, you can use the following event to debug or see which statements are used to create the tables and object types. You should call this event before you execute DBMS_XMLSCHEMA.

alter session set events = '31098 trace name context forever'

The trace file with the statements is created in the udump directory. The udump directory is set via the parameter user_dump_dest

Tracing The Protocol Server

This event is tracing the XDB protocol server. Trace files will be written to the udump directory. Look out for shared server trace files like the following: SID_s000_17016.trc. Depending on the amount of shared servers you have defined, you will encounter more then one trace file. Be ware that this is causing a lot of extra overhead, so switch it off (remove the event setting from the database parameter file / spfile) if you don’t use it any more…

For multiple system event 31098 level x settings, although tedious I checked level 1-16, while doing every time the following, after bouncing the database with the new event 31098 level setting:

SQL> alter system set event= 
     '31098 trace name context forever, level x' scope=spfile;
SQL> shutdown immediate
SQL> startup

HTTP

  • Connected via HTTP on default port 8080 while using the SYSTEM database account
  • Clicked on the OLAP_XDB folder
  • Clicked on the dsclass.xml file and therefore opening it
  • Closed the Windows Internet Explorer

FTP

  • Opened a FTP session by connecting on default port 2100
  • Logging in via the SYSTEM database account
  • Did a “ls” statement
  • Did a “cd OLAP_XDB” statement
  • Did a “get dsclass.xml” statement
  • Exited the ftp session via “bye”

Now to the results of my attempt to document the undocumented…

31098 trace name context forever, level 1

HTTP – Level 1 showed simple tracing of HTTP 1.1 messages like

*** 2009-06-08 23:07:40.120
HTTP: GET : /OLAP_XDS/ : HTTP/1.1 200 OK
HTTP: GET : /favicon.ico : HTTP/1.1 404 Not found

FTP – Level 1 caused connection problems…

ftp> ls
200 PORT Command successful
150 ASCII Data Connection
Aborting any active data connections...
550 NLST error in processing request

The NLST statement for ftp is the raw statement that returns a list of file names in the given directory.

31098 trace name context forever, level 2

HTTP – Level 2 showed HTTP 1.1 tracing:

  • HTTP 1.1 state messagecodes
  • DAV security calls
  • Client info like browser version etc
  • Directory info send
  • File get statement
  • Directory get statement
  • File content
  • Server info
  • ETag and GUID / mime info

FTP – No information about the ftp session was traced.

31098 trace name context forever, level 3

HTTP – Level 3 showed HTTP 1.1 tracing

  • HTTP 1.1 state messagecodes
  • DAV security calls
  • Client info like browser version etc
  • Directory info send
  • File get statement
  • Directory get statement
  • ETag and GUID / mime info

FTP – No information about the ftp session was traced.

31098 trace name context forever, level 4

No HTTP or FTP tracing but tracing of execution of XDB repository event triggers…

--------Dumping Sorted Master Trigger List --------
Trigger Owner : XDB
Trigger Name : XDBCONFIG_VALIDATE
Trigger Owner : XDB
Trigger Name : XDB$CONFIG$xd
--------Dumping Trigger Sublists --------
 trigger sublist 0 :
 trigger sublist 1 :
Trigger Owner : XDB
Trigger Name : XDBCONFIG_VALIDATE
 trigger sublist 2 :
 trigger sublist 3 :
Trigger Owner : XDB
Trigger Name : XDB$CONFIG$xd
 trigger sublist 4 :

HTTP – No information about the http session was traced.
FTP – No information about the ftp session was traced.

31098 trace name context forever, level 5

HTTP – Level 5 showed HTTP 1.1 server tracing

qmhGetHTTPError: Got unknown oracle error. Error stack is:
HTTP/1.1 500 Internal Server Error
MS-Author-Via: DAV
DAV: 1,2,
Server: Oracle XML DB/Oracle Database
Date: Mon, 08 Jun 2009 21:52:37 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 165

< !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

500 Internal Server Error

Internal Server Error

FTP – No information about the ftp session was traced.

31098 trace name context forever, level 6

As far as I could detect, it looked the same as level 3…
To give you an example, trace output had the following output.

*** 2009-06-08 23:56:01.513
GET
/OLAP_XDS/
HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://10.252.252.102:8080/
Accept-Language: nl
UA-CPU: x86
Accept-Encoding: gzip, deflate
If-None-Match: "6850905AC52423DBE040E40AD6DE7A51786D04180B2E2F68C47904"
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.2)
Host: 10.252.252.102:8080
Connection: Keep-Alive
Authorization: ***

FTP – No information about the ftp session was traced.

31098 trace name context forever, level 7

HTTP tracing is the same as level 3 and 6

FTP tracing showed the following (based on the statements used showed below):

ftp> open localhost
ftp: connect: Connection refused
ftp> open localhost 2100
Connected to localhost.localdomain.
220- srv01-18-102.amis.local
Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
220 srv01-18-102.amis.local FTP Server (Oracle XML DB/Oracle Database) ready.
530  Please login with USER and PASS.
530  Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:oracle): system
331 pass required for SYSTEM
Password:
230 SYSTEM logged in
Remote system type is Unix.
ftp> ls
227 Entering Passive Mode (10,252,252,102,62,156)
150 ASCII Data Connection
drw-r--r--   2 SYS      oracle         0 APR 24 10:45 OLAP_XDS
drw-r--r--   2 SYS      oracle         0 MAY 25 07:49 home
drw-r--r--   2 SYS      oracle         0 APR 24 11:01 images
drw-r--r--   2 SYS      oracle         0 APR 24 10:45 olap_data_security
drw-r--r--   2 SYS      oracle         0 MAY 27 17:29 public
drw-r--r--   2 SYS      oracle         0 MAY 11 18:34 sys
-rw-r--r--   1 SYS      oracle         0 MAY 15 14:35 xdbconfig.xml
drw-r--r--   2 SYS      oracle         0 APR 24 10:45 xds
226 ASCII Transfer Complete
ftp> cd OLAP_XDS
250 CWD Command successful
ftp> ls
227 Entering Passive Mode (10,252,252,102,39,101)
150 ASCII Data Connection
-rw-r--r--   1 SYS      oracle         0 APR 24 10:45 dsclass.xml
226 ASCII Transfer Complete
ftp> get dsclass.xml
local: dsclass.xml remote: dsclass.xml
227 Entering Passive Mode (10,252,252,102,221,72)
150 ASCII Data Connection
226 ASCII Transfer Complete
1078 bytes received in 0.004 seconds (2.6e+02 Kbytes/s)
ftp> bye
221 QUIT Goodbye.

The trace output for these statements were traced as follows:

*** 2009-06-09 00:08:45.916
220- srv01-18-102.amis.local 
Unauthorised use of this FTP server is prohibited and may be subject to civil and criminal prosecution.
220 srv01-18-102.amis.local FTP Server (Oracle XML DB/Oracle Database) ready.
AUTH GSSAPI
530  Please login with USER and PASS.
AUTH KERBEROS_V4
530  Please login with USER and PASS.

*** 2009-06-09 00:08:48.034
USER system
331 pass required for SYSTEM

*** 2009-06-09 00:08:49.176
PASS XXXXXXX
230 SYSTEM logged in
SYST
215 Unix Type:A Version:Oracle XML DB 

*** 2009-06-09 00:08:50.449
PASV
227 Entering Passive Mode (10,252,252,102,62,156)
LIST
150 ASCII Data Connection
226 ASCII Transfer Complete

*** 2009-06-09 00:08:52.244
CWD OLAP_XDS
250 CWD Command successful

*** 2009-06-09 00:08:53.159
PASV
227 Entering Passive Mode (10,252,252,102,39,101)
LIST
150 ASCII Data Connection
226 ASCII Transfer Complete

*** 2009-06-09 00:08:55.688
PASV
227 Entering Passive Mode (10,252,252,102,221,72)
RETR dsclass.xml
150 ASCII Data Connection
226 ASCII Transfer Complete

*** 2009-06-09 00:08:56.907
QUIT
221 QUIT Goodbye.

31098 trace name context forever, level 8

Level 8 traced the same kind of error as in level 5 (server errors)

31098 trace name context forever, level 9

Level 9 traced the same kind of error as in level 7 (FTP & HTTP output)

31098 trace name context forever, level 10

Level 10 traced the same kind of error as in level 7 (FTP & HTTP output)

31098 trace name context forever, level 11

Level 11 traced the same kind of error as in level 7 (FTP & HTTP output)

31098 trace name context forever, level 12

Level 12 traced the same kind of error as in level 5 (server errors)

31098 trace name context forever, level 13 – 16

Level 13 until level 16 didn’t produce any trace files regarding my FTP and HTTP statements.

Summery

Although this tracing is far from complete regarding actions I could have done like WebDAV access or to trigger automatic shredding of objects or other XDB event (repository?) relevant actions, at least some events could be useful for further investigation if needed regarding HTTP tracing (level 2), FTP tracing (eg. level 7) and repository event XML Schema triggers (level 4) and automatic XDB shredding mechanisms.

Setting event level 2 could be useful regarding APEX PL/SQL Gateway tracing and/or for APEX PL/SQL Gateway “hacking”, although I think your asking for it, if the PL/SQL Gateway via the XDB Proctocol Server has been put on the internet unprotected, and does not at least a proxy server in front of it to protect for some unauthorized access…

HTH

🙂

Marco Gralike Written by: