静态vs静态监听以及多端口注册

2021-08-05 00:00:00 数据库 专区 生产 监听 注册

配置多端口的动态注册
1 修改监听配置文件
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

lsnr =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1)(PORT = 1522))
)
)

2 设置local_listener参数,数据库启动后动态向两个监听主动注册
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1522))(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))';

System altered.

3 启动监听

lsnrctl start listener
lsnrct start lsnr

4 查看监听状态
racle@rac1 admin]$ lsnrctl status listener

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 05-AUG-2021 16:42:56

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 05-AUG-2021 16:34:45
Uptime 0 days 0 hr. 8 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/base/19.3/network/admin/listener.ora
Listener Log File /oracle/base/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "prod" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
Service "prodXDB" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
The command completed successfully

[oracle@rac1 admin]$ lsnrctl status lsnr

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 05-AUG-2021 16:43:15

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias lsnr
Version TNSLSNR for Linux: Version 19.0.0.0.0 - Production
Start Date 05-AUG-2021 16:32:48
Uptime 0 days 0 hr. 10 min. 27 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/base/19.3/network/admin/listener.ora
Listener Log File /oracle/base/diag/tnslsnr/rac1/lsnr/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac1)(PORT=1522)))
Services Summary...
Service "prod" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
Service "prodXDB" has 1 instance(s).
Instance "prod", status READY, has 1 handler(s) for this service...
The command completed successfully
目前两个监听都已经知道prod数据库的存在。

5 连接测试
1521端口:
[oracle@rac1 admin]$ sqlplus mv/oracle@rac1:1521/prod

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Aug 5 16:44:28 2021
Version 19.3.0.0.0

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

Last Successful login time: Thu Aug 05 2021 16:40:01 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

1522端口:
Version 19.3.0.0.0
[oracle@rac1 admin]$ sqlplus mv/oracle@rac1:1522/prod

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Aug 5 16:44:34 2021
Version 19.3.0.0.0

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

Last Successful login time: Thu Aug 05 2021 16:44:28 +08:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

6 配置静态注册,在搭建dg环境,远程启动数据库等特殊需要时使用,静态注册就是将数据库信息直接写入listener.ora的配置文件。

SID_LIST_lsnr=
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME =prod)
(ORACLE_HOME = /oracle/base/19.3)
(SID_NAME = prod)
)






相关文章