| XDB: Utility package to change the HTTP and FTP ports used by XML DB. | ||||
| Doc ID: | Note:209564.1 | Type: | BULLETIN | |
| Last Revision Date: | 22-JUL-2008 | Status: | 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.1Information 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
本文介绍如何通过Oracle Enterprise Manager或SQL脚本更改XMLDB的HTTP和FTP默认端口(8080和2100),适用于9.2至10.2.0.1版本的Oracle Server,并提供了针对10.2.0.1及以上版本的更新方法。
936

被折叠的 条评论
为什么被折叠?



