Oracle 动态监听和静态监听非1521端口配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/moscot_wu/article/details/87878204

硬核配置方法,

动态监听配置默认的1521不做演示

动态注册非1521端口,需要配置三个地方listener.ora、tnsname.ora、local_listener.

listener.ora配置

LISTENER =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1600))
    (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER_LISTENER))
 )

tnsnames.ora 配置

LISTENER_PROD = (ADDRESS = (PROTOCOL = IPC)(KEY = REGISTER_LISTENER))

local_listener配置

SQL> show parameter local

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      listener_PROD
[oracle@host01 admin]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 22-FEB-2019 06:45:29

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

Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1600))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                21-FEB-2019 08:03:21
Uptime                    0 days 22 hr. 42 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/db/12.1.0.2/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/host01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1600)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=REGISTER_LISTENER)))
Services Summary...
Service "PROD" has 1 instance(s).
  Instance "PROD", status READY, has 1 handler(s) for this service...
The command completed successfully

静态监听配置

listener.ora配置

LSNR =
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1700))
 )
)

SID_LIST_LSNR =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = PROD1)
      (ORACLE_HOME = /u01/app/oracle/db/12.1.0.2)
      (SID_NAME = PROD)
    )
  )

客户端tnsnames.ora配置,注意service_name 此时配置的是global_name

P2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1700))
    )
    (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PROD1)
    )
  )
[oracle@host01 admin]$ lsnrctl start lsnr

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 22-FEB-2019 06:54:36

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

Starting /u01/app/oracle/db/12.1.0.2/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /u01/app/oracle/db/12.1.0.2/network/admin/listener.ora
Log messages written to /u01/app/diag/tnslsnr/host01/lsnr/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1700)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1700)))
STATUS of the LISTENER
------------------------
Alias                     lsnr
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                22-FEB-2019 06:54:36
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/db/12.1.0.2/network/admin/listener.ora
Listener Log File         /u01/app/diag/tnslsnr/localhost/lsnr/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1700)))
Services Summary...
Service "PROD1" has 1 instance(s).
  Instance "PROD", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

猜你喜欢

转载自blog.csdn.net/moscot_wu/article/details/87878204
今日推荐