Changing the Listener Port Number for Database Connection Requests

Previous
Previous
Next
Next

If you change the listener port number for database connection requests, you must ensure that all future database connection requests use the new port number. This means that connection requests such as those discussed in "Connecting Remotely with SQL Command Line" must explicitly include the port number.

For example, if you change the port number for database connection requests to 1522, subsequent SQL Command Line (SQL*Plus) connect statements must be similar to the following (assuming a connection from Oracle Database Express Edition Client):

connect system/mypassword@myhost.mydomain.com:1522

Example: Changing Listener Port Number for Database Connection Requests

Assume that your Oracle Database XE host computer is named myhost.mydomain.com and that you want to install a new software package on this computer that requires TCP port number 1521. Assume also that the port number for that software package cannot be configured, and that you must therefore resolve the port number conflict by reconfiguring Oracle Database XE. You decide to change the listener port number for database connection requests to 1522.

To change the listener port number for database connection requests to 1522:

  1. Stop the listener.

    See "Stopping and Starting the Listener" for instructions.

  2. Open the file listener.ora with a text editor.

    Table: Location of the listener.ora File shows the location of this file on each platform.

    Location of the listener.ora File

    Platform Location

    Linux

    /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/

    Windows

    c:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\


  3. Locate the following section of the file:

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
          (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1521))
        )
      )
    
    

    Note that the line indicated in bold may or may not be present in the file.

  4. Change the text (PORT = 1521) to (PORT = 1522).

  5. Save the modified listener.ora file.

  6. Start the listener.

    See "Stopping and Starting the Listener" for instructions.

  7. Start SQL Command Line and connect to the database as user SYSTEM.

    See "Connecting Locally with SQL Command Line" for instructions. You must supply the SYSTEM password. You set this password upon installation (Windows) or configuration (Linux) of Oracle Database XE.

  8. Enter the following two commands:

    ALTER SYSTEM SET LOCAL_LISTENER = "(ADDRESS=(PROTOCOL=TCP)(HOST=myhost.mydomain.com)(PORT=1522))";
    
    ALTER SYSTEM REGISTER;
    
    
  9. Exit SQL Command Line and run the lsnrctl status command to verify the port number change.

    The new port number should be displayed in the Listening Endpoints Summary section of the status report, and the report should include the following lines:

    Service "XE" has 1 instance(s).  Instance "XE", status READY, has 1 handler(s) for this service...