成都网站建设设计

将想法与焦点和您一起共享

Oracle如何创建非1521端口监听-创新互联

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

专业从事成都网站设计、成都做网站,高端网站制作设计,小程序制作,网站推广的成都做网站的公司。优秀技术团队竭力真诚服务,采用H5页面制作+CSS3前端渲染技术,成都响应式网站建设,让网站在手机、平板、PC、微信下都能呈现。建站过程建立专项小组,与您实时在线互动,随时提供解决方案,畅聊想法和感受。



现有的监听文件配置

点击(此处)折叠或打开

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

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

  3. # Generated by Oracle configuration tools.

  4. LISTENER =

  5.   (DESCRIPTION_LIST =

  6.     (DESCRIPTION =

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

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

  9.     )

  10.   )

  11. ADR_BASE_LISTENER = /u01/app/oracle

  12. SID_LIST_LISTENER =

  13.   (SID_LIST =

  14.     (SID_DESC =

  15.       (GLOBAL_DBNAME=orcl)

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

  17.      (SID_NAME = orcl)

  18.     )

  19.   )


目前的监听状态

点击(此处)折叠或打开

  1. [oracle@test-db admin]$ lsnrctl status

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

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

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

  5. STATUS of the LISTENER

  6. ------------------------

  7. Alias LISTENER

  8. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

  10. Uptime                    0 days 0 hr. 38 min. 57 sec

  11. Trace Level               off

  12. Security                  ON: Local OS Authentication

  13. SNMP                      OFF

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

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

  16. Listening Endpoints Summary...

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

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

  19. Services Summary...

  20. Service "orcl" has 1 instance(s).

  21.   Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

  22. Service "orclXDB" has 1 instance(s).

  23.   Instance "orcl", status READY, has 1 handler(s) for this service...

  24. Service "primary_orcl" has 1 instance(s).

  25.   Instance "orcl", status READY, has 1 handler(s) for this service...

  26. The command completed successfully


----------------------------------分隔线-----------------------------------------

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

点击(此处)折叠或打开

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

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

  3. # Generated by Oracle configuration tools.

  4. LISTENER =

  5.   (DESCRIPTION_LIST =

  6.     (DESCRIPTION =

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

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

  9.     )

  10.   )

  11. ADR_BASE_LISTENER = /u01/app/oracle

  12. SID_LIST_LISTENER =

  13.   (SID_LIST =

  14.     (SID_DESC =

  15.       (GLOBAL_DBNAME=orcl)

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

  17.      (SID_NAME = orcl)

  18.     )

  19.   )

  20. #1522

  21. MY_LISTENER =

  22.   (DESCRIPTION_LIST =

  23.     (DESCRIPTION =

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

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

  26.     )

  27.   )

  28. #用于在1522端口注册服务

  29. SID_LIST_MY_LISTENER =

  30.   (SID_LIST =

  31.     (SID_DESC =

  32.       (GLOBAL_DBNAME=orcl)

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

  34.      (SID_NAME = orcl)

  35.     )

  36.   )


启动1522端口监听

点击(此处)折叠或打开

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

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

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

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

  5. TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

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

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

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

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

  11. STATUS of the LISTENER

  12. ------------------------

  13. Alias my_listener

  14. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

  16. Uptime                    0 days 0 hr. 0 min. 0 sec

  17. Trace Level               off

  18. Security                  ON: Local OS Authentication

  19. SNMP                      OFF

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

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

  22. Listening Endpoints Summary...

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

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

  25. Services Summary...

  26. Service "orcl" has 1 instance(s).

  27.   Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

  28. The command completed successfully


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

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

点击(此处)折叠或打开

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

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

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

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

  5. TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

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

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

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

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

  11. STATUS of the LISTENER

  12. ------------------------

  13. Alias my_listener

  14. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

  16. Uptime                    0 days 0 hr. 0 min. 0 sec

  17. Trace Level               off

  18. Security                  ON: Local OS Authentication

  19. SNMP                      OFF

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

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

  22. Listening Endpoints Summary...

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

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

  25. The listener supports no services

  26. The command completed successfully


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

点击(此处)折叠或打开

  1. my_orcl =

  2.   (DESCRIPTION =

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

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

  5.     (CONNECT_DATA =

  6.       (SERVER = DEDICATED)

  7.       (SERVICE_NAME = orcl)

  8.     )

  9.   )

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

登录数据库设置local_listener参数

点击(此处)折叠或打开

  1. alter system set local_listener='my_orcl' scope=both;


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

点击(此处)折叠或打开

  1. [oracle@test-db admin]$ lsnrctl status

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

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

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

  5. STATUS of the LISTENER

  6. ------------------------

  7. Alias LISTENER

  8. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

  10. Uptime                    0 days 1 hr. 2 min. 6 sec

  11. Trace Level               off

  12. Security                  ON: Local OS Authentication

  13. SNMP                      OFF

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

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

  16. Listening Endpoints Summary...

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

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

  19. Services Summary...

  20. Service "orcl" has 1 instance(s).

  21.   Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

  22. Service "orclXDB" has 1 instance(s).

  23.   Instance "orcl", status READY, has 1 handler(s) for this service...

  24. Service "primary_orcl" has 1 instance(s).

  25.   Instance "orcl", status READY, has 1 handler(s) for this service...

  26. The command completed successfully

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

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

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

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

  31. STATUS of the LISTENER

  32. ------------------------

  33. Alias my_listener

  34. Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production

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

  36. Uptime                    0 days 0 hr. 14 min. 37 sec

  37. Trace Level               off

  38. Security                  ON: Local OS Authentication

  39. SNMP                      OFF

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

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

  42. Listening Endpoints Summary...

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

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

  45. Services Summary...

  46. Service "orclXDB" has 1 instance(s).

  47.   Instance "orcl", status READY, has 1 handler(s) for this service...

  48. Service "primary_orcl" has 1 instance(s).

  49.   Instance "orcl", status READY, has 1 handler(s) for this service...

  50. The command completed successfully


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

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


网页名称:Oracle如何创建非1521端口监听-创新互联
当前网址:http://chengdu.cdxwcx.cn/article/ijiij.html