设为首页 收藏本站
查看: 1049|回复: 0

[经验分享] OCM_Session1_2_Server-side Network Configuration

[复制链接]

尚未签到

发表于 2015-11-9 12:31:51 | 显示全部楼层 |阅读模式
2. Server-side Network Configuration 2.1 Create a listener using the default listener name.   2.1.1 The TCP/IP protocol will be used for all connections. Use the machine name(not the IP address) for host.   2.1.2 This listener will listen on the default port.  2.1.3 Databases: PROD and EMREP(created later) will be serviced by this listener. 2.2 Add a second listener , named LSNR2,which will listen on port 1526.Configure this listener to support only automatic instance registrations.  2.2.1 Set up the PROD instance to automatically register with the LSNR2. 2.3 Start both listeners.
参考联机文档:Net Services Reference ==> 7 Listener Parameters (listener.ora)http://docs.oracle.com/cd/B19306_01/network.102/b14213/listener.htm#sthref769
  Example 7-1 shows a listener.ora file for a listener named LISTENER, which is the default name of thelistener.
Example 7-1 Example listener.ora File
LISTENER=  (DESCRIPTION=    (ADDRESS_LIST=      (ADDRESS=(PROTOCOL=tcp)(HOST=sale-server)(PORT=1521))      (ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))SID_LIST_LISTENER=  (SID_LIST=    (SID_DESC=      (GLOBAL_DBNAME=sales.us.acme.com)      (ORACLE_HOME=/oracle10g)      (SID_NAME=sales))    (SID_DESC=      (SID_NAME=plsextproc)      (ORACLE_HOME=/oracle10g)      (PROGRAM=extproc)))
2.1 Create a listener using the default listener name. 创建一个监听,使用缺省的监听名字  2.1.1 The TCP/IP protocol will be used for all connections. Use the machine name(not the IP address) for host.          使用TCP/IP协议,使用机器名称,不使用IP地址  2.1.2 This listener will listen on the default port.缺省端口1521  2.1.3 Databases: PROD and EMREP(created later) will be serviced by this listener.

  • 修改如下:


  • 1.创建一个监听,使用缺省的监听名字LISTENER,使用TCP/IP协议,使用机器名称(不使用IP地址),缺省端口1521.两个数据库PROD和EMREP
[oracle@ocm1 ~]$ hostnameocm1.localdomain[oracle@ocm1 ~]$ echo $ORACLE_HOME/u01/app/oracle/product/10.2.0/db_1
[iyunv@ocm1 ~]# su - oracle[oracle@ocm1 ~]$ cd $ORACLE_HOME/network/admin[oracle@ocm1 admin]$ lltotal 8drwxr-x--- 2 oracle oinstall 4096 Mar 16 19:17 samples-rw-r----- 1 oracle oinstall  172 Dec 26  2003 shrept.lst
[oracle@ocm1 admin]$ vi listener.ora LISTENER=  (DESCRIPTION=    (ADDRESS_LIST=      (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))      (ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))SID_LIST_LISTENER=  (SID_LIST=    (SID_DESC=      (GLOBAL_DBNAME=PROD)      (ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)      (SID_NAME=PROD))    (SID_DESC=      (GLOBAL_DBNAME=EMREP)      (ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)      (SID_NAME=EMREP))    (SID_DESC=      (SID_NAME=plsextproc)      (ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)      (PROGRAM=extproc)))~"listener.ora" 19L, 557C written                                                                                       [oracle@ocm1 admin]$

  • 2.启动刚创建的缺省监听
[oracle@ocm1 admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 12:05:33
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionSystem parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraLog messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.logListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))STATUS of the LISTENER------------------------Alias                     LISTENERVersion                   TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date                18-MAR-2014 12:05:33Uptime                    0 days 0 hr. 0 min. 0 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.logListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))Services Summary...Service "EMREP" has 1 instance(s).  Instance "EMREP", status UNKNOWN, has 1 handler(s) for this service...Service "PROD" has 1 instance(s).  Instance "PROD", status UNKNOWN, has 1 handler(s) for this service...Service "plsextproc" has 1 instance(s).  Instance "plsextproc", status UNKNOWN, has 1 handler(s) for this service...The command completed successfully[oracle@ocm1 admin]$

2.2 Add a second listener , named LSNR2,which will listen on port 1526.Configure this listener to support only automatic instance registrations.          再配置一个监听,名字叫LSNR2,端口是1526,只支持动态监听。



  • 3.追加内容,监听名称为LSNR2,端口为1526,并启动监听LSNR2
这里动态监听即为在listener名称下面没有SID_LIST_LISTENER,注意下面的端口和KEY(与上面的LISTENER的KEY不同)。[oracle@ocm1 admin]$ vi listener.ora LISTENER=  (DESCRIPTION=    (ADDRESS_LIST=      (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1521))      (ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))SID_LIST_LISTENER=  (SID_LIST=    (SID_DESC=      (GLOBAL_DBNAME=PROD)      (ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)      (SID_NAME=PROD))    (SID_DESC=      (GLOBAL_DBNAME=EMREP)      (ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)      (SID_NAME=EMREP))    (SID_DESC=      (SID_NAME=plsextproc)      (ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1)      (PROGRAM=extproc)))
LSNR2=  (DESCRIPTION=    (ADDRESS_LIST=      (ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526))      (ADDRESS=(PROTOCOL=ipc)(KEY=extproc1))))~~~~"listener.ora" 25L, 712C written         
      2.2.1 Set up the PROD instance to automatically register with the LSNR2.          将PROD实例自动注册到LSNR2。


  • 4.将PROD实例动态注册到LSNR2中。
这里即是修改local_listener的参数。SQL> conn /as sysdbaConnected.SQL> SQL> show parameter local
NAME                                 TYPE        VALUE------------------------------------ ----------- ------------------------------local_listener                       stringlog_archive_local_first              boolean     TRUE
参考联机文档:Reference ==> LOCAL_LISTENER参数http://docs.oracle.com/cd/B19306_01/server.102/b14237/initparams095.htm#i1128493
LOCAL_LISTENER
PropertyDescriptionParameter typeStringSyntaxLOCAL_LISTENER = network_nameDefault value(ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1521)) where hostname is the network name of the local host.ModifiableALTER SYSTEMBasicNo
  LOCAL_LISTENER specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that are running on the same machine as this instance). The address or address list is specifiedin the TNSNAMES.ORA file or other address repository as configured for your system.
  

  
  SQL> alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=ocm1.localdomain)(PORT=1526))';
  System altered.
  SQL> show parameter local
  

  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- ------------------------------
  local_listener                       string      (ADDRESS = (PROTOCOL=TCP)(HOST
  =ocm1.localdomain)(PORT=1526))
  log_archive_local_first              boolean     TRUE
  SQL>
  

  • 5.启动LSNR2监听
  
  
  
  
[oracle@ocm1 ~]$ lsnrctl status lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:01:03
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))STATUS of the LISTENER------------------------Alias                     lsnr2Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date                18-MAR-2014 12:31:26Uptime                    0 days 0 hr. 29 min. 36 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.logListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))Services Summary...Service "PROD" has 1 instance(s).  Instance "PROD", status READY, has 1 handler(s) for this service...Service "PROD_XPT" has 1 instance(s).  Instance "PROD", status READY, has 1 handler(s) for this service...The command completed successfully[oracle@ocm1 ~]$

  • 6.如果此时查不到PROD,则需要在SQL中再注册一下:
[oracle@ocm1 ~]$ lsnrctl status lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:02:58
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))STATUS of the LISTENER------------------------Alias                     lsnr2Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date                18-MAR-2014 13:02:09Uptime                    0 days 0 hr. 0 min. 49 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.logListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))The listener supports no servicesThe command completed successfully
则在SQL中再注册一下:
SQL> alter system register;
System altered.
再来查看状态:
[oracle@ocm1 ~]$ lsnrctl status lsnr2
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-MAR-2014 13:04:20
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))STATUS of the LISTENER------------------------Alias                     lsnr2Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - ProductionStart Date                18-MAR-2014 13:02:09Uptime                    0 days 0 hr. 2 min. 11 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.oraListener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.logListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))Services Summary...Service "PROD" has 1 instance(s).  Instance "PROD", status READY, has 1 handler(s) for this service...Service "PROD_XPT" has 1 instance(s).  Instance "PROD", status READY, has 1 handler(s) for this service...The command completed successfully[oracle@ocm1 ~]$

2.3 Start both listeners.之前两个监听都已经启动。
         版权声明:本文为博主原创文章,未经博主允许不得转载。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-137022-1-1.html 上篇帖子: OCM_Session7_10_安装clusterware 下篇帖子: OCM_Session6_3_Manage Instance Memory Structures
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表