Jumat, 05 April 2019

how to change listener ports on Oracle

This tutorial explains how to change listener ports on Oracle

  1. Stop the Oracle listener using the following command:

  2. [oracle@trialsd admin]$ lsnrctl stop

    LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 05-APR-2019 09:56:07

    Copyright (c) 1991, 2014, Oracle.  All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.31)(PORT=1521)))
    The command completed successfully


  3. Change the port number in the Oracle listener.ora file. For example, from the default port 1521 to 1522.

  4. [oracle@trialsd admin]$ cd /oracle/product/12.1.0/db_1/network/admin
    [oracle@trialsd admin]$ more listener.ora
    # listener.ora Network Configuration File: /oracle/product/12.1.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.31)(PORT = 1521))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
      )

    Use your favorite editor to change port in listener.ora change like this I use vi to edit

    [oracle@trialsd admin]$ vi listener.ora

    [oracle@trialsd admin]$ more listener.ora
    # listener.ora Network Configuration File: /oracle/product/12.1.0/db_1/network/admin/listener.ora
    # Generated by Oracle configuration tools.

    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.31)(PORT = 1522))
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
      )


  5. Change the port number in the tnsnames.ora like file listener.ora

  6. [oracle@trialsd admin]$ more tnsnames.ora
    # tnsnames.ora Network Configuration File: /oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.

    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.31)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )

    Use your favorite editor to change port in tnsnames.ora change like this I use vi to edit

    [oracle@trialsd admin]$ vi tnsnames.ora
    [oracle@trialsd admin]$
    [oracle@trialsd admin]$ more tnsnames.ora
    # tnsnames.ora Network Configuration File: /oracle/product/12.1.0/db_1/network/admin/tnsnames.ora
    # Generated by Oracle configuration tools.

    ORCL =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.31)(PORT = 1522))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = orcl)
        )
      )


  7. Restart the Oracle listener using the following command:

  8. [oracle@trialsd admin]$ lsnrctl start

    LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 05-APR-2019 10:41:52

    Copyright (c) 1991, 2014, Oracle.  All rights reserved.

    Starting /oracle/product/12.1.0/db_1/bin/tnslsnr: please wait...

    TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    System parameter file is /oracle/product/12.1.0/db_1/network/admin/listener.ora
    Log messages written to /oracle/diag/tnslsnr/trialsd/listener/alert/log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.31)(PORT=1522)))
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.31)(PORT=1522)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    Start Date                05-APR-2019 10:41:52
    Uptime                    0 days 0 hr. 0 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /oracle/product/12.1.0/db_1/network/admin/listener.ora
    Listener Log File         /oracle/diag/tnslsnr/trialsd/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.31)(PORT=1522)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
    The listener supports no services
    The command completed successfully


  9. Change the port to which the database is listening:

  10. [oracle@trialsd admin]$ sqlplus / as sysdba

    SQL*Plus: Release 12.1.0.2.0 Production on Fri Apr 5 10:45:57 2019

    Copyright (c) 1982, 2014, Oracle.  All rights reserved.


    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

    SQL> alter system set LOCAL_LISTENER="(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1522))";

    System altered.

    SQL> alter system register;

    System altered.


  11. Check the listener status using the following command:

  12. [oracle@trialsd admin]$ lsnrctl status

    LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 05-APR-2019 11:08:47

    Copyright (c) 1991, 2014, Oracle.  All rights reserved.

    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.31)(PORT=1522)))
    STATUS of the LISTENER
    ------------------------
    Alias                     LISTENER
    Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
    Start Date                05-APR-2019 11:04:46
    Uptime                    0 days 0 hr. 4 min. 0 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /oracle/product/12.1.0/db_1/network/admin/listener.ora
    Listener Log File         /oracle/diag/tnslsnr/trialsd/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.10.31)(PORT=1522)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=192.168.10.31)(PORT=5500))(Security=(my_wallet_directory=/oracle/admin/orcl/xdb_wallet))(Presentation=HTTP)(Session=RAW))
    Services Summary...
    Service "orcl" has 1 instance(s).
      Instance "orcl", status READY, has 1 handler(s) for this service...
    Service "orcl" has 1 instance(s).
      Instance "orcl", status READY, 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


Tidak ada komentar: