阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Oracle之单实例监听修改端口

222次阅读
没有评论

共计 4574 个字符,预计需要花费 12 分钟才能阅读完成。

Oracle 单一主机多个实例多个监听器配置要点 

1. 一台服务器主机, 有多个实例, 如: TSDB/ORCL; 又需要配置多个监听器
2. 需要指定不同的 LISTENER 端口 
3.pmon 只会动态注册 port 等于 1521 的监听器, 其它端口则 pmon 不能动态注册 listener, 要想让 pmon 动态注册 listener, 需要设置 local_listener 参数

[oracle@12c01 admin]$ cat listener.ora

ANDYCDB =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ANDYCDB_TEST =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1522))
    )
  )

[oracle@12c01 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /home/oracle/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ANDYCDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = andycdb)
    )
  )

LISTENER_ANDYCDB =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1521))

PDB01 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdb01)
    )
  )

LISTENER_PDB01 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1521)

LISTENER_TEST = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1522)) 
)

#################
lsnrctl 操作:
LSNRCTL>  set current_listener ANDYCDB_TEST
Current Listener is ANDYCDB_TEST

LSNRCTL> start
Starting /home/oracle/app/oracle/product/12.2.0/dbhome_1/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 12.2.0.1.0 – Production
System parameter file is /home/oracle/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/12c01/andycdb_test/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c01)(PORT=1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=12c01)(PORT=1522)))
STATUS of the LISTENER
————————
Alias                    ANDYCDB_TEST
Version                  TNSLSNR for Linux: Version 12.2.0.1.0 – Production
Start Date                10-APR-2018 21:59:17
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level              off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File  /home/oracle/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File        /home/oracle/app/oracle/diag/tnslsnr/12c01/andycdb_test/alert/log.xml
Listening Endpoints Summary…
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c01)(PORT=1522)))
The listener supports no services

The command completed successfully

 

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=12c01)(PORT=1522)))
STATUS of the LISTENER
————————
Alias                    ANDYCDB_TEST
Version                  TNSLSNR for Linux: Version 12.2.0.1.0 – Production
Start Date                10-APR-2018 21:59:17
Uptime                    0 days 0 hr. 1 min. 26 sec
Trace Level              off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File  /home/oracle/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File        /home/oracle/app/oracle/diag/tnslsnr/12c01/andycdb_test/alert/log.xml
Listening Endpoints Summary…
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c01)(PORT=1522)))
The listener supports no services
The command completed successfully

— 设置一个监听端口
SQL> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1522))’;
System altered.

[oracle@12c01 admin]$ lsnrctl status andycdb_test

LSNRCTL for Linux: Version 12.2.0.1.0 – Production on 10-APR-2018 22:38:32

Copyright (c) 1991, 2016, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=12c01)(PORT=1522)))
STATUS of the LISTENER
————————
Alias                    ANDYCDB_TEST
Version                  TNSLSNR for Linux: Version 12.2.0.1.0 – Production
Start Date                10-APR-2018 21:59:17
Uptime                    0 days 0 hr. 39 min. 16 sec
Trace Level              off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File  /home/oracle/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
Listener Log File        /home/oracle/app/oracle/diag/tnslsnr/12c01/andycdb_test/alert/log.xml
Listening Endpoints Summary…
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c01)(PORT=1522)))
Services Summary…
Service “4f44590eb7b74390e0531018db0a1976” has 1 instance(s).
  Instance “andycdb”, status READY, has 1 handler(s) for this service…
Service “andycdb” has 1 instance(s).
  Instance “andycdb”, status READY, has 1 handler(s) for this service…
Service “andycdbXDB” has 1 instance(s).
  Instance “andycdb”, status READY, has 1 handler(s) for this service…
Service “pdb01” has 1 instance(s).
  Instance “andycdb”, status READY, has 1 handler(s) for this service…
The command completed successfully

— 设置多个监听端口
SQL> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST = 12c01)(PORT = 1522)),(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c01)(PORT=1521)))’;
System altered.

更多 Oracle 相关信息见 Oracle 专题页面 https://www.linuxidc.com/topicnews.aspx?tid=12

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计4574字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中