Changing values in the XML DB configuration

To get to the point, here's an example for changing the HTTP port of XML DB's WebDav server:
CALL DBMS_XDB.CFG_UPDATE(
  UPDATEXML(
    DBMS_XDB.CFG_GET(),
    '/xdbconfig/descendant::http-port/text()',
    '8888'
  )
);
Run it with user "SYS as SYSDBA" in the database.
Read on for some explanation of the details.

If you install XML DB into a database (using DBCA), a WebDav and an FTP server are created on the 8080 and 2100 TCP ports by default. These services are provided by the database through TNSListener, however the configuration for them is not stored in files (eg. in listener.ora, as one could expect), but inside the database. The config is available in a file named xdbconfig.xml in the WebDav server's root directory, so if your database server is called oracle9i.example.com, then the config will be available through WebDav (which you can access/read with any normal webbrowser) at http://oracle9i.example.com:8080/xdbconfig.xml.

Now back to the example. The DBMS_XDB package is a normal package in the SYS schema. However UPDATEXML() is a builtin SQL (!) function and it's not available inside PL/SQL blocks. Therefore we have to use the CALL SQL statement to execute our code ... since CALL executes in the SQL engine and not the PL/SQL engine. This way UPDATEXML will be recongnized and interpreted as required. If you tried to run the same code in a begin ... end; block (or with an EXECUTE command in SQLPlus, which is a kind of the same) instead of CALL, you'd get an error message indicating that "identifier 'UPDATEXML' must be declared".

Syndicate content