Questition:
3. Server-sid Network Configuration
3.1 Create a listener using the default listener name.
3.2 The TCP/IP protocol will be used for all connectionps,Use the machine name (not the IP address) for host.
3.3 This listener will listen on the default port
3.4 Databases will be serviced by this listener.
3.5 Add a second listener,named LSNR2,which will listen on port 1526.
3.6 Set up the PROD1 instance to automatically register with the LSNR2.
3.7 Start both listeners.
Reference: Net Services Reference->7 Oracle Net Listener Parameters (listener.ora)
问题:
3.服务器端网络配置
3.1使用默认侦听器名称创建侦听器。
3.2 TCP / IP协议将用于所有连接,使用机器名称(而不是IP地址)作为主机。
3.3此侦听器将侦听默认端口
3.4数据库将由此侦听器提供服务。
3.5添加一个名为LSNR2的侦听器,它将侦听端口1526。
3.6设置PROD1实例,自动向LSNR2注册。
3.7启动两个监听器。
参考:Net Services Reference-> 7 Oracle Net Listener参数(listener.ora)
3.1-3.4 创建默认的监听使用监听名listener,端口号为1521,数据库可以注册到本监听
[oracle@rookie admin]$ cd $ORACLE_HOME/network/admin/
[oracle@rookie admin]$ cat listener.ora
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD3)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=PROD3)))
3.5 创建一个监听名字为LSNR2,端口号为1526,需要在原有的listener.ora文件中追加内容:
需要修改监听名,端口号,和key值
[oracle@rookie admin]$ cat listener.ora
LISTENER=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1521))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc))))
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=PROD3)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME=PROD3)))
LSNR2=
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526))
(ADDRESS=(PROTOCOL=ipc)(KEY=extproc1))))
3.6 需要将PROD1动态注册到LSNR2上:
参考:Reference –> LOCAL_LISTENER参数
SQL> show parameter listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
listener_networks string
local_listener string LISTENER_PROD1
remote_listener string
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526))';
System altered.
3.7 启动两个监听
--启动默认监听
[oracle@rookie admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JUL-2017 12:07:22
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/11.2.0/db_1/diag/tnslsnr/rookie/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JUL-2017 12:07:22
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/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/db_1/diag/tnslsnr/rookie/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=extproc)))
Services Summary...
Service "PROD3" has 1 instance(s).
Instance "PROD3", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
--启动lsnr2
[oracle@rookie admin]$ lsnrctl start LSNR2
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JUL-2017 12:07:26
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/rookie/lsnr2/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526))
STATUS of the LISTENER
------------------------
Alias LSNR2
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JUL-2017 12:07:26
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/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/rookie/lsnr2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526)))
The listener supports no services
The command completed successfully
--查看PROD1是否注册到LSNR2上
[oracle@rookie admin]$ lsnrctl status LSNR2
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JUL-2017 12:08:46
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526))
STATUS of the LISTENER
------------------------
Alias LSNR2
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JUL-2017 12:07:26
Uptime 0 days 0 hr. 1 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/rookie/lsnr2/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rookie)(PORT=1526)))
Services Summary...
Service "PROD1.oracle.com" has 1 instance(s).
Instance "PROD1", status READY, has 1 handler(s) for this service...
Service "PROD1XDB.oracle.com" has 1 instance(s).
Instance "PROD1", status READY, has 1 handler(s) for this service...
The command completed successfully