现在的位置: 首页 > 综合 > 正文

XDB: XML DB Port Assignments

2013年09月27日 ⁄ 综合 ⁄ 共 10287字 ⁄ 字号 评论关闭

XML DB Port Assignments

by Jeff Hunter, Sr. Database Administrator

Portions of this article are written by Roby Sherman and Copyright 2002

http://www.idevelopment.info/data/Oracle/DBA_tips/xmldb/XMLDB_2.shtml


Contents

  1. Introduction
  2. Repository Views and Default Ports
  3. Changing XML DB Default Ports
  4. Disabling the Port Assignment


Introduction

Oracle introduced the XML Database in release 9i. Along with this new feature, Oracle continues the practice of incorporating new, barely documented port assignments that often leave the DBA to search endlessly for possible configuration file(s) that define these port assignments. Well, when it comes to searching for where these port numbers related to XML DB are defined, you will not find them on the file system, but rather inside the database. This article will attempt to unravel some of the mysteries on managing port assignments related to Oracle XML DB.


Repository Views and Default Ports

The key XML DB technologies can be grouped into two major classes - a XMLType that provides a native XML storage and retrieval capability strongly integrated with SQL, and a XML Repository that provides foldering, access control, versioning etc. for XML resources. Users view and manage XML objects like files and schemas in the XML Repository as a hierarchy of folders. This repository aspect of XML DB involves access through standard protocols such as HTTP/WebDAV and FTP. These servers will bind to ports 8080 and 2100 respectively by default.

DBA's will sometimes wonder why their Web Server, that always used to work, has all of the sudden been hijacked after installing Oracle9i and creating a database using DBCA. After some research, they attempt to shutdown the Oracle TNS listener and notice that the port in question (mostly 8080) is no longer being utilized. Unfortunately, there is little to tell the DBA that these ports are going to be used until they find out the hard way: When the database starts and steals the ports away from another process that hasn't yet started or when the other process errors and/or is unreachable.


Changing XML DB Default Ports

The following section describes the syntax that can be used to alter XML DB configuration information from within SQL*Plus. Ensure that you are logged into the database from a DBA account. In the following example, the default HTTP/WebDAV and FTP ports are changed from 8080 and 2100 to 8081 and 2111 respectively:

  SQL> -- Change the HTTP/WEBDAV port from 8080 to 8081
  SQL> call dbms_xdb.cfg_update(updateXML(
    2        dbms_xdb.cfg_get()
    3      , '/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()'
    4      , 8081))
    5  /

  Call completed. 


  SQL> -- Change the FTP port from 2100 to 2111
  SQL> call dbms_xdb.cfg_update(updateXML(
    2         dbms_xdb.cfg_get()
    3       , '/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()'
    4       , 2111))
    5  /

  Call completed. 


  SQL> COMMIT;

  Commit complete. 


  SQL> EXEC dbms_xdb.cfg_refresh;

  PL/SQL procedure successfully completed.


  SQL> -- Verify the change
  SQL> set long 100000
  SQL> set pagesize 9000
  SQL> SELECT dbms_xdb.cfg_get FROM dual;

CFG_GET
--------------------------------------------------------------------------------
<xdbconfig xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd" xmlns:xsi="http://w
ww.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/x
db/xdbconfig.xsd                                     http://xmlns.oracle.com/xdb
/xdbconfig.xsd">
  <sysconfig>
    <acl-max-age>900</acl-max-age>
    <acl-cache-size>32</acl-cache-size>
    <invalid-pathname-chars>,</invalid-pathname-chars>
    <call-timeout>300</call-timeout>
    <max-session-use>100</max-session-use>
    <default-lock-timeout>3600</default-lock-timeout>
    <resource-view-cache-size>1048576</resource-view-cache-size>
    <protocolconfig>
      <common>
        <extension-mappings>
          <mime-mappings>
            <mime-mapping>
              <extension>au</extension>
              <mime-type>audio/basic</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>avi</extension>
              <mime-type>video/x-msvideo</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>bin</extension>
              <mime-type>application/octet-stream</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>bmp</extension>
              <mime-type>image/bmp</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>doc</extension>
              <mime-type>application/msword</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>eml</extension>
              <mime-type>message/rfc822</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>gif</extension>
              <mime-type>image/gif</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>htm</extension>
              <mime-type>text/html</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>html</extension>
              <mime-type>text/html</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>jpe</extension>
              <mime-type>image/jpeg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>jpeg</extension>
              <mime-type>image/jpeg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>jpg</extension>
              <mime-type>image/jpeg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>jsp</extension>
              <mime-type>text/html</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>mid</extension>
              <mime-type>audio/mid</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>mov</extension>
              <mime-type>video/quicktime</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>movie</extension>
              <mime-type>video/x-sgi-movie</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>mp3</extension>
              <mime-type>audio/mpeg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>mpe</extension>
              <mime-type>video/mpg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>mpeg</extension>
              <mime-type>video/mpg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>mpg</extension>
              <mime-type>video/mpg</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>msa</extension>
              <mime-type>application/x-msaccess</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>msw</extension>
              <mime-type>application/x-msworks-wp</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>pcx</extension>
              <mime-type>application/x-pc-paintbrush</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>pdf</extension>
              <mime-type>application/pdf</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>ppt</extension>
              <mime-type>application/vnd.ms-powerpoint</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>ps</extension>
              <mime-type>application/postscript</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>qt</extension>
              <mime-type>video/quicktime</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>ra</extension>
              <mime-type>audio/x-realaudio</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>ram</extension>
              <mime-type>audio/x-realaudio</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>rm</extension>
              <mime-type>audio/x-realaudio</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>rtf</extension>
              <mime-type>application/rtf</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>rv</extension>
              <mime-type>video/x-realvideo</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>sgml</extension>
              <mime-type>text/sgml</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>tif</extension>
              <mime-type>image/tiff</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>tiff</extension>
              <mime-type>image/tiff</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>txt</extension>
              <mime-type>text/plain</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>url</extension>
              <mime-type>text/plain</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>vrml</extension>
              <mime-type>x-world/x-vrml</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>wav</extension>
              <mime-type>audio/wav</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>wpd</extension>
              <mime-type>application/wordperfect5.1</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>xls</extension>
              <mime-type>application/vnd.ms-excel</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>xml</extension>
              <mime-type>text/xml</mime-type>
            </mime-mapping>
            <mime-mapping>
              <extension>zip</extension>
              <mime-type>application/x-zip-compressed</mime-type>
            </mime-mapping>
          </mime-mappings>
          <lang-mappings>
            <lang-mapping>
              <extension>en</extension>
              <lang>english</lang>
            </lang-mapping>
          </lang-mappings>
          <charset-mappings/>
          <encoding-mappings>
            <encoding-mapping>
              <extension>gzip</extension>
              <encoding>zip file</encoding>
            </encoding-mapping>
            <encoding-mapping>
              <extension>tar</extension>
              <encoding>tar file</encoding>
            </encoding-mapping>
          </encoding-mappings>
        </extension-mappings>
        <session-pool-size>50</session-pool-size>
        <session-timeout>6000</session-timeout>
      </common>
      <ftpconfig>
        <ftp-port>2111</ftp-port>
        <ftp-listener>local_listener</ftp-listener>
        <ftp-protocol>tcp</ftp-protocol>
        <session-timeout>6000</session-timeout>
      </ftpconfig>
      <httpconfig>
        <http-port>8081</http-port>
        <http-listener>local_listener</http-listener>
        <http-protocol>tcp</http-protocol>
        <session-timeout>6000</session-timeout>
        <server-name>XDB HTTP Server</server-name>
        <max-header-size>16384</max-header-size>
        <max-request-body>2000000000</max-request-body>
        <servlet-realm>Basic realm="XDB"</servlet-realm>
        <webappconfig>
          <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
          </welcome-file-list>
          <error-pages/>
          <servletconfig>
            <servlet-mappings>
              <servlet-mapping>
                <servlet-pattern>/Test</servlet-pattern>
                <servlet-name>TestServlet</servlet-name>
              </servlet-mapping>
              <servlet-mapping>
                <servlet-pattern>/oradb/*</servlet-pattern>
                <servlet-name>DBURIServlet</servlet-name>
              </servlet-mapping>
            </servlet-mappings>
            <servlet-list>
              <servlet>
                <servlet-name>TestServlet</servlet-name>
                <servlet-language>Java</servlet-language>
                <display-name>XDB Test Servlet</display-name>
                <description>A servlet to test the internals of the XDB Servlet API</description>
                <servlet-class>xdbtserv</servlet-class>
                <servlet-schema>xdb</servlet-schema>
              </servlet>
              <servlet>
                <servlet-name>DBURIServlet</servlet-name>
                <display-name>DBURI</display-name>
                <servlet-language>C</servlet-language>
                <description>Servlet for accessing DBURIs</description>
                <security-role-ref>
                  <role-name>authenticatedUser</role-name>
                  <role-link>authenticatedUser</role-link>
                </security-role-ref>
              </servlet>
            </servlet-list>
          </servletconfig>
        </webappconfig>
      </httpconfig>
    </protocolconfig>
  </sysconfig>
</xdbconfig>


Disabling the Port Assignment

One of the easist ways to disable Oracle from assigning both XML DB ports (FTP and HTTP/WebDAV) is to remove the following instance parameter from the database:

    dispatchers='(PROTOCOL=TCP) (SERVICE=<ORACLE_SID>XDB)'

This change would obviously require bouncing the database.

A second way to disable the XML DB ports is to simply change their port assignments to the value of zero (0). This is an attractive option since it uses code that can be incorporated directly into database creation scripts so that the value can be tweaked each time you create a new database.

Modifying these ports to zero can also be accomplished using a GUI; Oracle Enterprise Manager (version 9.2.0.1 or higher). Simply open OEM, select and expand the database. Next, expend the XML Database item and click on Configuration. You should be able to see and change any of the XML DB configuration parameters on the right-hand side of the OEM console. Simply make your changes and click APPLY to make them permanent.

For more information on Managing Oracle XML DB Using Oracle Enterprise Manager, click here.

抱歉!评论已关闭.