Registering non-default XMLDB HTTP/WebDAV and FTP ports on a non-default Oracle Listener port

It’s possible to have also two different version listeners (the 9 and 10 version) running, by settting different ORACLE_HOME’s and PATH’s, and starting the different listeners. I like to have 1 listener – as long as this can be maintained regarding incompatibility and bugs etc – therefore my latest listener version is leading (version 10g). Set your ORACLE_HOME accordingly. My 10g Oracle home is placed in directory/oracle/rdb10g/ and my TNS_ADMIN directory is set to directory /oracle/network/admin.

C:\> export ORACLE_HOME=/oracle/rdb10g
C:\> export TNS_ADMIN=/oracle/network/admin
C:\> export PATH=$ORACLE_HOME/bin:$PATH


I defined two listeners via a default LISTENER (dedicated for OAS and the older IAS environment) and a LISTENER_10G (dedicated for my 10g database with it’s XMLDB functionality). This is a local machine in a small local infrastructure. If you want to have a more secure listener configuration than please don’t forget to set a password on your listener.
You could set this via your listener control and set password {your password}.

C:\> lsnrctl
LSNRCTL> help set
The following operations are available after set
An asterisk (*) denotes a modifier or extended command:
password
rawmode
...

Set your ORACLE_HOME’s in the listener.ora file correctly and define your listeners on different port numbers (eg. 1521 and 1522).

My configuration of the listener.ora file is shown below:

 # Oracle version 9 environment
 LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)
                         (HOST = amisux22.amis.nl)
                         (PORT = 1521))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)
                         (KEY = EXTPROC))
      )
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /oracle/ias10g/infra)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = asdb.amis.nl)
      (ORACLE_HOME = /oracle/ias10g/infra)
      (SID_NAME = asdb)
    )
  )
 # Oracle version 10 environment
 LISTENER_10G =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)
                         (HOST = amisux22.amis.nl)
                         (PORT = 1522))
      )
    )
  )
SID_LIST_LISTENER_10G =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl.amis.nl)
      (ORACLE_HOME = /oracle/rdb10g)
      (SID_NAME = orcl)
    )
  )

After this you can start the listeners to check your used syntax via:

C:\> lsnrctl start (listener)
C:\> lsnrctl start listener_10g

You can check this on UNIX via:

$>  ps -ef | grep tns | grep -v grep
  oracle  9950     1  0 12:13:12 ?
        0:01 /oracle/rdb10g/bin/tnslsnr listener -inherit
  oracle  8267     1  0 11:56:44 ?
        0:00 /oracle/rdb10g/bin/tnslsnr listener_10g -inherit

Registering the database with the correct listener Starting the Oracle 10g database would cause the database to register itself with the listener running on port 1521 (the default listener). This is not what I wanted. It should register itself to the listener listener_10g defined on port 1522. For this to happen we have to add an extra line in the database parameter file init{$SID}.ora. The parameter used by oracle is LOCAL_LISTENER. The reference for this parameter in the Oracle Database Reference Guide says:

LOCAL_LISTENER:

LOCAL_LISTENER specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that are running on the same machine as this instance). The address or address list is specified in the TNSNAMES.ORA file or other address repository as configured for your system.
With default value: (ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=1521)) where hostname is the network name of the local host.

I added the following line, in accordance with the default syntax to my init{$SID}.ora file to my Oracle 10g (with XMLDB) database .

LOCAL_LISTENER=(ADDRESS=(PROTOCOL=TCP)
                        (HOST=AMISUX22)(PORT=1522))

If you don’t use a database parameter file, but use the spfile construction, then you can alter/set this setting via a SQL statement in eg. SQL*Plus and an account with the correct privileges:

SQL> ALTER system SET LOCAL_LISTENER=
        "(ADDRESS=(PROTOCOL=TCP)(HOST=AMISUX22)(PORT=1522))"
        scope=BOTH;
 
System altered.
 
SQL> SHOW parameter LISTENER
NAME             TYPE        VALUE
local_listener   string      (ADDRESS=(PROTOCOL=TCP)
                                  (HOST=AMISUX22)(PORT=1522))

The database will register itself to the correct listener_10g listener on port 1522. The XMLDB daemons are registered via the DISPATCHERS and LOCAL_LISTENER settings in the init{$SID}.ora file of your database, or via the ALTER SYSTEM statement with your spfile. I added the following line, in accordance with the default syntax for XMLDB – (PROTOCOL=TCP) (SERVICE={$SID}XDB) – to my init{$SID}.ora file to my Oracle 10g (with XMLDB) database .

DISPATCHERS=(ADDRESS=(PROTOCOL=TCP) (SERVICE=orclXDB)

You can also alter this setting via SQL*Plus:

SQL> ALTER system SET DISPATCHERS=
        "(PROTOCOL=TCP) (SERVICE=orclXDB)" scope=BOTH;
 
System altered.
 
SQL> SHOW parameter DISPATCHERS
NAME             TYPE        VALUE
dispatchers      string      (PROTOCOL=TCP) (SERVICE=orclXDB)

Registering the FTP / WebDAV and HTTP on different ports As said, the machine I am using is packed with application servers and other daemons, all trying to use their default port settings. So after checking via the lsnrctl status listener_10g statement, I noticed that the WebDAV / HTTP registration, on port 8080, was not showing up.

LSNRCTL> status listener_10g
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amisux22.amis.nl)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     listener_10g
Version                   TNSLSNR for Unix: Version 10.1.0.3.0 - Production
Start Date                03-MAR-2005 11:56:45
Uptime                    0 days 2 hr. 16 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/network/admin/listener.ora
Listener Log File         /oracle/network/log/listener_10g.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amisux22.amis.nl)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amisux22.amis.nl)(PORT=2100))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.amis.nl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

After checking on UNIX with statement netstat -na | grep 8080, I saw that (I should have known) the HTTP daemon of XMLDB and HTML of the 10g (9.0.4) Oracle Application Server, where both defined on port 8080. I decided to change the port settings in the XMLDB “repository”. To alter XMLDB FTP / HTTPbehaviour, we must alter the content of the xdbconfig.xsd file in the database. You could do this via a full update of this file via WebDAV or FTP but it is also do-able via a SQL statement.

SQL> set long 1000000
SQL> set pages 5000
SQL> set trimspool on
 
SQL> SELECT dbms_xdb.cfg_get "xdbconfig.xsd" FROM dual
  2  ;
 
xdbconfig.xsd
-----------------------------------------------------------------
 
    900
    32
    ,
    true
    300
    65536
    100
false
    3600
 
    0
    1048576
 
              au
              audio/basic
 
              avi
               ...etc

The FTP settings are shown here:

  2100
  local_listener
  tcp
 
  0
  6000
  8192

Some of the HTTP settings are shown here:

  8080
  local_listener
  tcp
  64
  16384
  2000000000
  6000
 
  0
  ...etc

We can alter these ports and other settings via a combination of updatexml and dbms_xdb.cfg_get in SQL*Plus. I used the following script / statements to set the ports to 6010 and 6020. Be aware that cfg_update() is auto-commit.

DECLARE
newconfig XMLType;
BEGIN
    --ftp port setting
    SELECT updatexml(
    dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()',6010) INTO newconfig FROM dual;
    dbms_xdb.cfg_update(newconfig);
    --http port setting
    SELECT updatexml(
    dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/httpconfig/http-port/text()',6020) INTO newconfig FROM dual;
    dbms_xdb.cfg_update(newconfig);
END;
/

After these update statements the xdbconfig.xsd file is updated with the new port settings. After restarting the listener_10g listener, FTP and WebDAV will register themselves via this listener.

LSNRCTL> status listener_10g
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=amisux22.amis.nl)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     listener_10g
Version                   TNSLSNR for Unix: Version 10.1.0.3.0 - Production
Start Date                03-MAR-2005 11:56:45
Uptime                    0 days 2 hr. 16 min. 39 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/network/admin/listener.ora
Listener Log File         /oracle/network/log/listener_10g.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amisux22.amis.nl)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amisux22.amis.nl)(PORT=6020))(Presentation=HTTP)(Session=RAW))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=amisux22.amis.nl)(PORT=6010))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl.amis.nl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

PS
(Small update, 04 june 2007 )

From Oracle version 10.2 and onwards it is easier to use the following syntax to update and/or enable HTTP(s), FTP(s), WebDav:

Enable Protocol Server

SQL> CALL dbms_xdb.setHttpPort(8080);
SQL> CALL dbms_xdb.setFtpPort(2100); 
 
{SQL> ALTER system SET shared_servers=5;}
 
SQL> ALTER system register;
Marco Gralike Written by:

9 Comments

  1. Eric Tao
    October 14

    Good work in explaining concepts and detailed action. Thanks.

  2. Ron Brink
    March 26

    I was reading this blog and everything you mention is correct except for the listener status. I do not get any message about the HTTP port. Any idea?

  3. March 26

    Hmmm,could be a lot of things though, for instance your network settings. Is your machine dhcp configured and/or while resolving your own machine name, is this done via a DNS…? The HTTP port and FTP port bind only to your machine (tcp/ip). Also if you set HTTP or FTP ports, too ports under or equal to 1024, you will need superuser privileges. Some ports are sometimes already bound by other programs like Tomcat that also binds default on port 8080. Only one program can bound to a specific port (afaik)

  4. August 7

    Hi Marco,
    a couple of questions that may fit well in this context.
    I noticed that in 10gR2 there are a couple of undocumented procedures (meaning that they are nowhere to be found in the 10gR2 docs, but they are showing up in 11g’s docs) called dbms_xdb.setListenerEndPoint and dbms_xdb.getListenerEndPoint.
    Now, i noticed that XDB handles two different endpoints called XDB_ENDPOINT_HTTP and XDB_ENDPOINT_HTTP2.
    I was wondering if i could configure XDB to listen on port 8081 for requests coming from addresses other than localhost, while listening on 8080 for requests coming from the same machine.
    Do you happen to know if the proper setting of these endpoints could make this work?
    This is meant to allow me to reach two distinct Apex environments when working from remote so that one maps to port 8081 and the second one to port 8082, while they would be still working on port 8080 when i connect locally.

    Does it make sense?
    What do you think?

    Flavio

  5. August 7

    They are probably not even really “undocumented”, but I noticed that there are probably procedures / packages maintained by the XMLDB team and some by the APEX team (they are sometimes referenced in different manuals: APEX/XMLDB; and/or used in scripting from APEX/XMLDB).

    They all, in this case, hook into, what I think, XMLDB functionality.

    The by you mentioned XDB_ENDPOINT_HTTP and XDB_ENDPOINT_HTTP2, reference HTTP and HTTPS: XDB_ENDPOINT_HTTP for HTTP listener endpoints and XDB_ENDPOINT_HTTP2 for HTTPS listener endpoints.

    AFAIK the functionality you need is not provided via the Protocol Listener functionality (“the local gateway” / listener functionality).

    You could ask the same question on the XMLDB forum. Maybe you get extra info there via Mark Drake (Sr Product Manager XMLDB Oracle).

    You could use “owa_util.redirect_url” as described in this post http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html

    An other alternative would be to use Apache in front of the APEX/XMLDB functionality and or as a reverse proxy (http://www.liberidu.com/blog/?p=1082) to achieve your goal.

    An other alternative would be to use the HTTP for one app and the HTTPS port for the other app. Securing the needed app for local localhost only via DBMS_XDB.SETLISTENERLOCALACCESS (http://www.liberidu.com/blog/?p=185)

    Marco

  6. August 7

    Marco,
    whatever the secondary HTTP port was meant for, it works. I configured it to listen on port 8082 using normal HTTP and it works. It can make sense to setup HTTPS though, so i get a “secure” connection when i connect from remote.

    Thanks,
    Flavio

  7. charlene
    November 4

    WOW. thanks for writing this document. i finally got the xml db and apex configured and working.
    not one oracle install guide had all the parts in one place!!!!!
    thank you so much

  8. Ramona
    December 11

    I am actually thankful to the owner of this web site who has shared this enormous article at at this time.

Comments are closed.