Thursday, April 2, 2009

Change Oracle XE default HTTP and DB ports

  • Stop listener in command window:
lsnrctl stop
  • Modify ORACLE_HOME/app/oracle/product/10.2.0/server/NETWORK/ADMIN/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
)
)
Change the PORT to the number wanted. Also modify PORT in tnsnames.ora and save.
  • Start listener:
lsnrctl start
  • Run SQL Plus to add local listener for that port, then change HTTP listening port:
conn system/password;
alter system set local_listener = "(ADDRESS=(PROTOCOL=TCP)(HOST=your.com)(PORT=1522))";
exec dbms_xdb.sethttpport(nnnn);
alter system register;
disc;
If "set local_listener" is omitted, you probably will get get "ORA-12514: TNS:listener does not currently know of service requested when openning SQL Plus with sqlplus system@xe

alter system register" is also important as it reregisters the DB and all services with the listener. Otherwise you can find the port is not listening with netstat -an. Also you can verify with lsnrctl status, and a line like following should be there:
...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=your.com)(PORT=8090))(Presentation=HTTP)(Session=RAW))

  • Confirm:
select dbms_xdb.gethttpport as "HTTP Port",
dbms_xdb.getftpport as "FTP Port" from dual;
Ref: http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25107/network.htm#BHCCDEIH

No comments: