Oracle如何创建非1521端口监听

57次阅读
没有评论

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

丸趣 TV 小编给大家分享一下 Oracle 如何创建非 1521 端口监听,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

现有的监听文件配置

点击 (此处) 折叠或打开

[oracle@test-db admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

 (DESCRIPTION_LIST =

 (DESCRIPTION =

 (ADDRESS = (PROTOCOL = TCP)(HOST = test-db)(PORT = 1521))

 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

 )

 )

ADR_BASE_LISTENER = /u01/app/oracle

SID_LIST_LISTENER =

 (SID_LIST =

 (SID_DESC =

 (GLOBAL_DBNAME=orcl)

 (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

 (SID_NAME = orcl)

 )

 )

目前的监听状态

点击 (此处) 折叠或打开

[oracle@test-db admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 04-APR-2018 00:09:29

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test-db)(PORT=1521)))

STATUS of the LISTENER

————————

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                03-APR-2018 23:30:31

Uptime                    0 days 0 hr. 38 min. 57 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/test-db/listener/alert/log.xml

Listening Endpoints Summary…

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1521)))

 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary…

Service orcl has 1 instance(s).

 Instance orcl , status UNKNOWN, has 1 handler(s) for this service…

Service orclXDB has 1 instance(s).

 Instance orcl , status READY, has 1 handler(s) for this service…

Service primary_orcl has 1 instance(s).

 Instance orcl , status READY, has 1 handler(s) for this service…

The command completed successfully

———————————- 分隔线 —————————————–

在 listener.ora 文件中添加 1522 端口的监听,添加后的文件内容如下

点击 (此处) 折叠或打开

[oracle@test-db admin]$ cat listener.ora

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

 (DESCRIPTION_LIST =

 (DESCRIPTION =

 (ADDRESS = (PROTOCOL = TCP)(HOST = test-db)(PORT = 1521))

 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

 )

 )

ADR_BASE_LISTENER = /u01/app/oracle

SID_LIST_LISTENER =

 (SID_LIST =

 (SID_DESC =

 (GLOBAL_DBNAME=orcl)

 (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

 (SID_NAME = orcl)

 )

 )

#1522

MY_LISTENER =

 (DESCRIPTION_LIST =

 (DESCRIPTION =

 (ADDRESS = (PROTOCOL = TCP)(HOST = test-db)(PORT = 1522))

 (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))

 )

 )

#用于在 1522 端口注册服务

SID_LIST_MY_LISTENER =

 (SID_LIST =

 (SID_DESC =

 (GLOBAL_DBNAME=orcl)

 (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)

 (SID_NAME = orcl)

 )

 )

启动 1522 端口监听

点击 (此处) 折叠或打开

[oracle@test-db admin]$ lsnrctl start my_listener

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 04-APR-2018 00:16:18

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

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 11.2.0.3.0 – Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/test-db/my_listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1522)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test-db)(PORT=1522)))

STATUS of the LISTENER

————————

Alias my_listener

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                04-APR-2018 00:16:18

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/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/test-db/my_listener/alert/log.xml

Listening Endpoints Summary…

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1522)))

 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

Services Summary…

Service orcl has 1 instance(s).

 Instance orcl , status UNKNOWN, has 1 handler(s) for this service…

The command completed successfully

使用 PLSQL Developer 工具测试可以正常连接。

———————– 分割线 —————————-
在 1522 端口注册服务器还有一种方法,就是使用 tnsnames.ora 文件
在去掉了 listener.ora 中有关 SID_LIST_MY_LISTENER 静态注册的代码后,重启 my_listener 监听发现没有任何服务注册

点击 (此处) 折叠或打开

[oracle@test-db admin]$ lsnrctl start my_listener

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 04-APR-2018 00:18:08

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

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 11.2.0.3.0 – Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/test-db/my_listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1522)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test-db)(PORT=1522)))

STATUS of the LISTENER

————————

Alias my_listener

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                04-APR-2018 00:18:08

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/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/test-db/my_listener/alert/log.xml

Listening Endpoints Summary…

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1522)))

 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

The listener supports no services

The command completed successfully

在 tnsnames.ora 文件中添加如下代码

点击 (此处) 折叠或打开

my_orcl =

 (DESCRIPTION =

 (ADDRESS = (PROTOCOL = TCP)(HOST = test-db)(PORT = 1522))

 (ADDRESS = (PROTOCOL = TCP)(HOST = test-db)(PORT = 1521))

 (CONNECT_DATA =

 (SERVER = DEDICATED)

 (SERVICE_NAME = orcl)

 )

 )

注:如果不添加 (ADDRESS = (PROTOCOL = TCP)(HOST = test-db)(PORT = 1521)) 这段的话,那么在默认 1521 端口中将不会有服务注册

登录数据库设置 local_listener 参数

点击 (此处) 折叠或打开

alter system set local_listener= my_orcl scope=both;

使用命令分别检查监听状态

点击 (此处) 折叠或打开

[oracle@test-db admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 04-APR-2018 00:32:38

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test-db)(PORT=1521)))

STATUS of the LISTENER

————————

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                03-APR-2018 23:30:31

Uptime                    0 days 1 hr. 2 min. 6 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/test-db/listener/alert/log.xml

Listening Endpoints Summary…

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1521)))

 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary…

Service orcl has 1 instance(s).

 Instance orcl , status UNKNOWN, has 1 handler(s) for this service…

Service orclXDB has 1 instance(s).

 Instance orcl , status READY, has 1 handler(s) for this service…

Service primary_orcl has 1 instance(s).

 Instance orcl , status READY, has 1 handler(s) for this service…

The command completed successfully

[oracle@test-db admin]$ lsnrctl status my_listener

LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 04-APR-2018 00:32:45

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=test-db)(PORT=1522)))

STATUS of the LISTENER

————————

Alias my_listener

Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production

Start Date                04-APR-2018 00:18:08

Uptime                    0 days 0 hr. 14 min. 37 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/test-db/my_listener/alert/log.xml

Listening Endpoints Summary…

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test-db)(PORT=1522)))

 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))

Services Summary…

Service orclXDB has 1 instance(s).

 Instance orcl , status READY, has 1 handler(s) for this service…

Service primary_orcl has 1 instance(s).

 Instance orcl , status READY, has 1 handler(s) for this service…

The command completed successfully

使用 PLSQL Developer 工具测试可以正常连接。

以上是“Oracle 如何创建非 1521 端口监听”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注丸趣 TV 行业资讯频道!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-24发表,共计8164字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)