来源:http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb19rpl.htm
DBMS_XDB: Configuration Management
Table 23-3 lists the DBMS_XDB Oracle XML DB configuration management functions and procedures.
Table 23-3 DBMS_XDB: Configuration Management Functions and Procedures
Function/Procedure Description
cfg_get
Returns the configuration information for the current session.
cfg_refresh
Refreshes the session configuration information using the current Oracle XML DB configuration file, xdbconfig.xml.
cfg_update
Updates the Oracle XML DB configuration information. This writes the configuration file, xdbconfig.xml.
getFTPPort
Returns the current FTP port number.
getHTTPPort
Returns the current HTTP port number.
setFTPPort
Sets the Oracle XML DB FTP port to the specified port number.
setHTTPPort
Sets the Oracle XML DB HTTP port to the specified port number.
See Also:
Oracle Database PL/SQL Packages and Types Reference
The examples in this section illustrate the use of these functions and procedures.
Example 23-6 Using Function DBMS_XDB.cfg_get
In this example, function cfg_get is used to retrieve the Oracle XML DB configuration file, xdbconfig.xml.
CONNECT SYSTEM/MANAGER
Connected.
SELECT DBMS_XDB.cfg_get() FROM DUAL;
DBMS_XDB.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>
<case-sensitive>true</case-sensitive>
<call-timeout>300</call-timeout>
<max-link-queue>65536</max-link-queue>
<max-session-use>100</max-session-use>
<persistent-sessions>false</persistent-sessions>
<default-lock-timeout>3600</default-lock-timeout>
<xdbcore-logfile-path/>
<xdbcore-log-level>0</xdbcore-log-level>
<resource-view-cache-size>1048576</resource-view-cache-size>
<protocolconfig>
<common>
. . .
</common>
<ftpconfig>
. . .
</ftpconfig>
<httpconfig>
<http-port>8000</http-port>
<http-listener>local_listener</http-listener>
<http-protocol>tcp</http-protocol>
<max-http-headers>64</max-http-headers>
<max-header-size>16384</max-header-size>
<max-request-body>2000000000</max-request-body>
<session-timeout>6000</session-timeout>
<server-name>XDB HTTP Server</server-name>
<logfile-path/>
<log-level>0</log-level>
<servlet-realm>Basic realm="XDB"</servlet-realm>
<webappconfig>
. . .
</webappconfig>
</httpconfig>
</protocolconfig>
<xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound>
<xdbcore-loadableunit-size>16</xdbcore-loadableunit-size>
</sysconfig>
</xdbconfig>
1 row selected.
Example 23-7 Using Procedure DBMS_XDB.cfg_update
This example illustrates the use of procedure cfg_update. The current configuration is retrieved as an XMLType instance and modified. It is then rewritten using cfg_update.
DECLARE
configxml SYS.XMLType;
configxml2 SYS.XMLType;
BEGIN
-- Get the current configuration
configxml := DBMS_XDB.cfg_get();
-- Modify the configuration
SELECT updateXML(
configxml,
'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()',
'8000',
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"')
INTO configxml2 FROM DUAL;
-- Update the configuration to use the modified version
DBMS_XDB.cfg_update(configxml2);
END;
/
PL/SQL procedure successfully completed.
SELECT DBMS_XDB.cfg_get() FROM DUAL;
DBMS_XDB.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>
<case-sensitive>true</case-sensitive>
<call-timeout>300</call-timeout>
<max-link-queue>65536</max-link-queue>
<max-session-use>100</max-session-use>
<persistent-sessions>false</persistent-sessions>
<default-lock-timeout>3600</default-lock-timeout>
<xdbcore-logfile-path/>
<xdbcore-log-level>0</xdbcore-log-level>
<resource-view-cache-size>1048576</resource-view-cache-size>
<protocolconfig>
<common>
. . .
</common>
<ftpconfig>
. . .
</ftpconfig>
<httpconfig>
<http-port>8000</http-port>
. . .
</httpconfig>
</protocolconfig>
<xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound>
<xdbcore-loadableunit-size>16</xdbcore-loadableunit-size>
</sysconfig>
</xdbconfig>
1 row selected.
DBMS_XDB: Configuration Management
Table 23-3 lists the DBMS_XDB Oracle XML DB configuration management functions and procedures.
Table 23-3 DBMS_XDB: Configuration Management Functions and Procedures
Function/Procedure Description
cfg_get
Returns the configuration information for the current session.
cfg_refresh
Refreshes the session configuration information using the current Oracle XML DB configuration file, xdbconfig.xml.
cfg_update
Updates the Oracle XML DB configuration information. This writes the configuration file, xdbconfig.xml.
getFTPPort
Returns the current FTP port number.
getHTTPPort
Returns the current HTTP port number.
setFTPPort
Sets the Oracle XML DB FTP port to the specified port number.
setHTTPPort
Sets the Oracle XML DB HTTP port to the specified port number.
See Also:
Oracle Database PL/SQL Packages and Types Reference
The examples in this section illustrate the use of these functions and procedures.
Example 23-6 Using Function DBMS_XDB.cfg_get
In this example, function cfg_get is used to retrieve the Oracle XML DB configuration file, xdbconfig.xml.
CONNECT SYSTEM/MANAGER
Connected.
SELECT DBMS_XDB.cfg_get() FROM DUAL;
DBMS_XDB.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>
<case-sensitive>true</case-sensitive>
<call-timeout>300</call-timeout>
<max-link-queue>65536</max-link-queue>
<max-session-use>100</max-session-use>
<persistent-sessions>false</persistent-sessions>
<default-lock-timeout>3600</default-lock-timeout>
<xdbcore-logfile-path/>
<xdbcore-log-level>0</xdbcore-log-level>
<resource-view-cache-size>1048576</resource-view-cache-size>
<protocolconfig>
<common>
. . .
</common>
<ftpconfig>
. . .
</ftpconfig>
<httpconfig>
<http-port>8000</http-port>
<http-listener>local_listener</http-listener>
<http-protocol>tcp</http-protocol>
<max-http-headers>64</max-http-headers>
<max-header-size>16384</max-header-size>
<max-request-body>2000000000</max-request-body>
<session-timeout>6000</session-timeout>
<server-name>XDB HTTP Server</server-name>
<logfile-path/>
<log-level>0</log-level>
<servlet-realm>Basic realm="XDB"</servlet-realm>
<webappconfig>
. . .
</webappconfig>
</httpconfig>
</protocolconfig>
<xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound>
<xdbcore-loadableunit-size>16</xdbcore-loadableunit-size>
</sysconfig>
</xdbconfig>
1 row selected.
Example 23-7 Using Procedure DBMS_XDB.cfg_update
This example illustrates the use of procedure cfg_update. The current configuration is retrieved as an XMLType instance and modified. It is then rewritten using cfg_update.
DECLARE
configxml SYS.XMLType;
configxml2 SYS.XMLType;
BEGIN
-- Get the current configuration
configxml := DBMS_XDB.cfg_get();
-- Modify the configuration
SELECT updateXML(
configxml,
'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()',
'8000',
'xmlns="http://xmlns.oracle.com/xdb/xdbconfig.xsd"')
INTO configxml2 FROM DUAL;
-- Update the configuration to use the modified version
DBMS_XDB.cfg_update(configxml2);
END;
/
PL/SQL procedure successfully completed.
SELECT DBMS_XDB.cfg_get() FROM DUAL;
DBMS_XDB.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>
<case-sensitive>true</case-sensitive>
<call-timeout>300</call-timeout>
<max-link-queue>65536</max-link-queue>
<max-session-use>100</max-session-use>
<persistent-sessions>false</persistent-sessions>
<default-lock-timeout>3600</default-lock-timeout>
<xdbcore-logfile-path/>
<xdbcore-log-level>0</xdbcore-log-level>
<resource-view-cache-size>1048576</resource-view-cache-size>
<protocolconfig>
<common>
. . .
</common>
<ftpconfig>
. . .
</ftpconfig>
<httpconfig>
<http-port>8000</http-port>
. . .
</httpconfig>
</protocolconfig>
<xdbcore-xobmem-bound>1024</xdbcore-xobmem-bound>
<xdbcore-loadableunit-size>16</xdbcore-loadableunit-size>
</sysconfig>
</xdbconfig>
1 row selected.