XDB: Utility package to change the HTTP and FTP ports used by XML DB.

来源:互联网 发布:淘宝头条怎么注册流程 编辑:程序博客网 时间:2024/06/03 01:44
 
XDB: Utility package to change the HTTP and FTP ports used by XML DB.
 Doc ID: Note:209564.1Type: BULLETIN
 Last Revision Date: 22-JUL-2008Status: PUBLISHED

In this Document
  Purpose
  Scope and Application
  XDB: Utility package to change the HTTP and FTP ports used by XML DB.
     10.2.0.1 and above information
  References


Applies to:

Oracle Server - Enterprise Edition - Version: 9.2 to 10.2.0.1
Information in this document applies to any platform.

Purpose

To provide the ability to alter the ports which an XML DB uses for HTTP and FTP.

This does not apply to 10.2.0.1 and above , for these versions refer to the bottom section of the note.

Scope and Application

By default the XML Database (XDB) comes preconfigured with the http port set to 8080 and the ftp port set to 2100.

If this conflicts with other applications on your server, or you want to run 2 database instances then you need to be able to alter the ports which xdb uses.

The recommended way of doing this is via the XML Database Parameters window of  the Oracle Enterprise Manager (OEM) console, however if you have not installed this, or do not have access to it, this package provides the ability to change the ports via SQL.

This script must be run as sys.

Once it is installed you can change the port using the commands:

call xdb_utility.set_http_port(n)

and

call xdb_utility.set_ftp_port(m)

To verify that this has worked, drop to the operating system prompt and issue

lsnrctl status

And look for the entries under
Listening Endpoints Sumary...

e.g.
before:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=2100))(Presentation=FTP (Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=8080)(Presentation=HTTP)(Session=RAW))

after:
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=2105))(Presentation=FTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=8081))(Presentation=HTTP)(Session=RAW))

Note that it not necessary to restart either the database or the listener for these values to change.

Note You can also set these ports to 0 if you want to disable these end-points.

XDB: Utility package to change the HTTP and FTP ports used by XML DB.

CREATE OR REPLACE PACKAGE XDB_UTILITY as
   procedure SET_HTTP_PORT (PORT_NUMBER number);
   procedure SET_FTP_PORT (PORT_NUMBER number);
end XDB_UTILITY;
/

show errors
--
create or replace package body XDB_UTILITY as
--
   FTP_XPATH varchar2(256) :=
      '/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port';
   HTTP_XPATH varchar2(256) :=
      '/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port';
--
   procedure SET_XDB_PORT(PORT_XPATH varchar2, PORT_NUMBER number) as
      config XMLType;
   begin
      config := dbms_xdb.cfg_get();

      select updateXML(config, PORT_XPATH, PORT_NUMBER)
      into config
      from dual;

      dbms_xdb.cfg_update(config);
      commit;
      dbms_xdb.cfg_refresh();
   end;
----
-- Create the SET_HTTP_PORT and SET_FTP_PORT functions
--
   procedure SET_HTTP_PORT(PORT_NUMBER number) as
   begin
      SET_XDB_PORT(HTTP_XPATH || '/text()', PORT_NUMBER);
   end;
--
   procedure SET_FTP_PORT(PORT_NUMBER number) as
   begin
      SET_XDB_PORT(FTP_XPATH || '/text()', PORT_NUMBER);
   end;
--
end XDB_UTILITY;
/
show errors
--
create or replace public synonym XDB_UTILITY for XDB_UTILITY
/
grant execute on XDB_UTILITY to XDBADMIN
/



10.2.0.1 and above information

For database release 10.2.0.1 and on the FTP and HTTP ports are disabled by default.
By this it means they are defaulted to 0

The feature is also enhanced by providing a native API to adjust the ports

The API's are part of the DBMS_XDB procedure. The following can be run as XDB or sys or any account with DBA or XDBADMIN privileges.

SQL> exec dbms_xdb.setftpport(2100);

PL/SQL procedure successfully completed.

SQL> exec dbms_xdb.sethttpport(8080);

PL/SQL procedure successfully completed.

SQL> alter system register;

System altered.


lsnrctl status

LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 01-DEC-2005 10:39
:01

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521)))

STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
Start Date 01-DEC-2005 09:56:52
Uptime 0 days 0 hr. 42 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:/oracle/product/10.2.0/db_3/network/admin/listener.ora
Listener Log File D:/oracle/product/10.2.0/db_3/network/log/listener.log

Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(
PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=//./pipe/EXTPROC0ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(
PORT=2100))(Presentation=FTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostname)(
PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "X10GR2XDB" has 1 instance(s).
Instance "x10gr2", status READY, has 1 handler(s) for this service...
Service "X10GR2_XPT" has 1 instance(s).
Instance "x10gr2", status READY, has 1 handler(s) for this service...
Service "x10gr2" has 1 instance(s).
Instance "x10gr2", status READY, has 1 handler(s) for this service...
The command completed successfully

References

Note 362540.1 - How to Setup XDB Protocol Server: FTP, HTTP, WebDAV

Keywords

XML~DB ; XDB ; DBMS_XDB.CFG_UPDATE ; 
原创粉丝点击