OCM_Session1_2_Server-side Network Configuration

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)

Example 7-1 shows a listener.ora file for a listener named LISTENER, which is the default name of the listener.

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 ~]$ hostname
ocm1.localdomain
[oracle@ocm1 ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/10.2.0/db_1

[root@ocm1 ~]#   su - oracle
[oracle@ocm1 ~]$   cd $ORACLE_HOME/network/admin
[oracle@ocm1 admin]$ ll
total 8
drwxr-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 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening 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                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                18-MAR-2014 12:05:33
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/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening 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 sysdba
Connected.
SQL> 
SQL> show parameter local

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string
log_archive_local_first              boolean     TRUE

参考联机文档:
Reference ==> LOCAL_LISTENER参数

LOCAL_LISTENER

PropertyDescription
Parameter type String
Syntax LOCAL_LISTENER = network_name
Default value (ADDRESS = (PROTOCOL=TCP)(HOST=hostname)(PORT=1521)) where hostname is the network name of the local host.
Modifiable ALTER SYSTEM
Basic No

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 specified in 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                     lsnr2
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                18-MAR-2014 12:31:26
Uptime                    0 days 0 hr. 29 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
Listening 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                     lsnr2
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                18-MAR-2014 13:02:09
Uptime                    0 days 0 hr. 0 min. 49 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ocm1.localdomain)(PORT=1526)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1)))
The listener supports no services
The 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                     lsnr2
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                18-MAR-2014 13:02:09
Uptime                    0 days 0 hr. 2 min. 11 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/product/10.2.0/db_1/network/log/lsnr2.log
Listening 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.
之前两个监听都已经启动。
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值