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

5

Yesterday, I had to install XMLDB on an already very heavy used system. On this UNIX system, an old Oracle IAS is installed, OAS 10g (version 9.0.4) and an Oracle 10.1.0.3 database. So in terms of used port numbers, it is a very crowded system. The Oracle listener was split-up by me in two different listeners. I defined a version 9 environment and a version 10 environment. I setup a TNS directory via setting the TNS_ADMIN variable in every profile. It makes stuff more complex, in the context of configuring, but it also centralizes all the SQL*Net information and configuration files on a default spot. By the way, I don’t make use of Oracle Names.

The following shows how you can setup different Oracle listeners and register XMLDB on the correct Listener.

Setting up two listeners


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.


> export ORACLE_HOME=/oracle/rdb10g
> export TNS_ADMIN=/oracle/network/admin
> 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}.


> 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:


> lsnrctl start (listener)
> 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>
SQL> SELECT dbms_xdb.cfg_get "xdbconfig.xsd" FROM dual
  2  /

xdbconfig.xsd
--------------------------------------------------------------------------------
<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>
    <acl -cache-size>32</acl>
    <invalid -pathname-chars>,</invalid>
    <case -sensitive>true</case>
    <call -timeout>300</call>
    <max -link-queue>65536</max>
    <max -session-use>100</max>
    <persistent -sessions>false</persistent>
    <default -lock-timeout>3600</default>
    <xdbcore -logfile-path/>
    <xdbcore -log-level>0</xdbcore>
    <resource -view-cache-size>1048576</resource>
    <protocolconfig>
      <common>
        <extension -mappings>
          <mime -mappings>
          ...
         </mime>
        </extension>
      </common>
      </protocolconfig>
      
      </sysconfig>
      </xdbconfig>

The FTP settings are shown here:


<ftpconfig>
  <ftp -port>2100</ftp>
  <ftp -listener>local_listener</ftp>
  <ftp -protocol>tcp</ftp>
  <logfile -path/>
  <log -level>0</log>
  <session -timeout>6000</session>
  <buffer -size>8192</buffer>
</ftpconfig>

Some of the HTTP settings are shown here:


<httpconfig>
  <http -port>8080</http>
  <http -listener>local_listener</http>
  <http -protocol>tcp</http>
  <max -http-headers>64</max>
  <max -header-size>16384</max>
  <max -request-body>2000000000</max>
  <session -timeout>6000</session>
  <server -name>XDB HTTP Server</server>
</httpconfig>

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
    <code>--ftp port setting</code>
    select updatexml(
    dbms_xdb.cfg_get(),'/xdbconfig/sysconfig/protocolconfig/ftpconfig/ftp-port/text()',6010) into newconfig from dual;
    dbms_xdb.cfg_update(newconfig);
    <code>--http port setting</code>
    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

Share.

About Author

Marco Gralike, working for AMIS Services BV as a Principal Oracle Database Consultant in the Netherlands, has experience as a DBA since 1994 (Oracle 6). Marco is also eager and skillful in other fields, like Operating System Administration and Application Servers, mainly to find working, performing solutions. Marco has been specializing in Oracle XMLDB, since 2003, focusing on his old love, database administration and performance. He is an Oracle XMLDB enthusiast ever since. He is also a dedicated contributor of the Oracle User Group community, helping people with their steep XMLDB learning curve. To this purpose, Marco also devoted his personal blog site to XMLDB and other Oracle issues. Marco is a member of the OakTable network and an Oracle ACE Director (specialization Oracle XMLDB).

5 Comments

  1. Mark Drake on

    Good Review…. Marco could you give us some more info on how you are using the protocols

  2. Mark Drake on

    Nice Article… Interested in find out more about what you are using the protocol servers for…

    10gR2 will have methods on DBMS_XDB (SetHTTPPort, setFTPPort) which will make it easier to update the Port settings

  3. Good review for this post by Pete Finnigan:
    03/04/2005: “Amis Blog has an interesting entry on multiple listeners”

    I just came across the Amin Blogs post “Registering non-default XMLDB HTTP/WebDAV and FTP ports on a non-default Oracle Listener port” on orablogs. This post by Marco Gralike talks in details about setting up two listeners on a server that is pretty busy. He talks about having two different version listeners running on the same machine. Marco gives some technical details and examples of how to setup and start two listeners. I find this a good example as people ask me from time to time about setting up two listeners for one database with the intention that one of those listeners is specifically to run extproc from. This is so that even if the listener is compromised via extproc that the server is in less danger from hackers as the account they would have captured should have no server privileges or access.

    Marco starts his short article with some discussion of creating and setting up two listeners and shows some examples. He works through the set up and shows how to start both and how to check that they are running. He then talks in detail about registering the database with the correct listener. Then Marco talks about the use of the LOCAL_LISTENER parameter in the init.ora in 10g so that the 10g database will register itself with the correct listener. This is an interesting discussion that goes on to talk about the XMLDB daemons. Marco then talks about registering the FTP and WebDAV and HTTP on different ports showing examples and details of how to do this including alerting the ports.