|
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]$
[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。
这里即是修改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>
[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.之前两个监听都已经启动。
版权声明:本文为博主原创文章,未经博主允许不得转载。 |
|