oracle如何实现网络配置-创新互联
这篇文章主要介绍oracle如何实现网络配置,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
为巴马等地区用户提供了全套网页设计制作服务,及巴马网站建设行业解决方案。主营业务为成都网站制作、成都网站设计、巴马网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
网络配置的方法:
1、tnsname客户端--A 直接修改文件
B 通过客户端工具“网络配置助手”--win端直接打开调用Linux端,netca命令调出配置工具
2、监听器配置--服务器端
客户端配置监听服务室没有任何意义的,因为客户端没有oracle server
监听器配置文件:/u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
[oracle@oracle3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1521))
)
)
服务器端配置一个监听器
[oracle@oracle3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1522))
)
) --新的监听器,监听器监听是1522端口
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1521))
)
)
------------------------------------------------------------------------------------
一个数据库实例被多个监听器监听案例
[oracle@oracle3 admin]$ lsnrctl status --默认打开的是LISTENER
[oracle@oracle3 admin]$ lsnrctl status LISTENER1 --打开的是第二个监听器
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-JUN-2014 14:28:42
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle3)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 06-JUN-2014 14:26:15
Uptime 0 days 0 hr. 2 min. 26 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1522)))
The listener supports no services
The command completed successfully
将ORCL注册到第二个监听器:
修改监听器配置文件:
LISTENER1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1522))
)
)
SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME=ORCL)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
)
)
通过监听器2访问:创建一个1522端口的连接串访问。
LISTENER1(1522) LISTENER(1521)
| |
---------------------------
|
ORCL
|
Oracle软件
并发访问:一个群组通过1521访问,一个群组通过1522访问.
-------------------------------------------------------------------------------------
一个监听器监听多个端口案例
方法1:服务器端用netmgr工具添加端口
[oracle@oracle3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1527))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1528))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1529))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1530))
)
)
SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = ORCL)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1523))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1524))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1525))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1526))
)
)
方法2:直接改这个配置文件
另外两个监听器都需要配置SID_LIST_串,监听器配置文件最终:
[oracle@oracle3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1527))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1528))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1529))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1530))
)
)
SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = ORCL)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1523))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1524))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1525))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1526))
)
)
架构图:
LISTENER1(1522、1527~1530) LISTENER(1521、1523~1526)
| |
----------------------------------------------
|
ORCL
|
Oracle软件
尝试通过不同的监听器不同的端口访问oracle server
[oracle@oracle3 admin]$ lsnrctl status LISTENER
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-JUN-2014 14:54:41
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 06-JUN-2014 14:48:35
Uptime 0 days 0 hr. 6 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1523)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1524)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1525)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1526)))
Services Summary...
Service "ORCL" has 2 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCLXDB" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCL_XPT" has 1 instance(s).
Instance "ORCL", status READY, 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@oracle3 admin]$ lsnrctl status LISTENER1
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-JUN-2014 14:54:47
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle3)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 06-JUN-2014 14:49:08
Uptime 0 days 0 hr. 5 min. 39 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1527)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1528)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1529)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1530)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", 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
------------------------------------------------------------------------------------
静态注册--监听参数是手工添加的,启动监听后强制将ORCL注册到监听器。由于是强制的,只能确认监听器是正确的,但是
数据库不一定访问通,所以状态为UNKNOW。但是能否访问不是和这个状态有关系的。
动态注册--根据监听配置文件中的配置,由oracle的后台进程pmon将ORCL注册到监听器,而且是一定能访问通的,因为 PMON进程会测试。但是PMON不是时时刻刻都去注册的,有时间间隔,所以先启动数据库再启动监听不一定
马上监到, 有时间的延迟,因为pmon的工作是有时间间隔的。一旦监听到,状态为ready,即一定能访问通。
[oracle@oracle3 admin]$ ps -ef|grep ora_pmon
oracle 9190 1 0 11:07 ? 00:00:00 ora_pmon_ORCL
Oracle默认监听的注册方法是动态注册,即往默认的监听器LISTENER上注册,listener.ora文件中不需要SID_LIST_LISTENER即可。但是静态注册必须要SID_LIST_LISTENER串和LISTENER串。
LISTENER1 = --LISTENER1静态注册
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1527))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1528))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1529))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1530))
)
)
SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = ORCL)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
)
)
LISTENER = --LISTENER动态注册
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1523))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1524))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1525))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1526))
)
)
可以改变默认的注册监听器:即将默认的监听器由LISTENER改为LISTENER1(LISTENER1改为动态的,LISTENER改为静态的),需要做以下几步:
step1:在oracle server的tnsname.ora文件中配置一个连接串:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.3.3)(PORT = 1522)) --1522对应的监听器是非默认的LISTENER1
)
)
step2:修改oracle参数:
SQL> alter system set local_listener=ORCL;
系统已更改。 --这样oracle默认往1522对应的监听器上做动态注册。
step3:修改listener.ora文件
[oracle@oracle3 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER1 = --LISTENER1变为动态注册
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1527))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1528))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1529))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1530))
)
)
SID_LIST_LISTENER = --LISTENER变为静态注册
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = ORCL)
(ORACLE_HOME = /u01/oracle/product/10.2.0/db_1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1523))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1524))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1525))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle3)(PORT = 1526))
)
)
step4:动态注册不能马上生效,要等pmon进程,有延迟,但是可以强制马上
SQL> alter system register; --不等pmon,强制注册
系统已更改。
step5:确认
[oracle@oracle3 admin]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-JUN-2014 16:05:49
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 06-JUN-2014 15:46:21
Uptime 0 days 0 hr. 19 min. 28 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1523)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1524)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1525)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1526)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service... --LISTENER为静态注册
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@oracle3 admin]$ lsnrctl status LISTENER1
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 06-JUN-2014 16:06:24
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle3)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias LISTENER1
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 06-JUN-2014 15:46:28
Uptime 0 days 0 hr. 19 min. 56 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/oracle/product/10.2.0/db_1/network/log/listener1.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1527)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1528)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1529)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle3)(PORT=1530)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service... --LISTENER1为动态注册
Service "ORCLXDB" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
Service "ORCL_XPT" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
The command completed successfully
注意:
1、一个实例只能有一个动态注册监听器,可以有多个静态注册的监听器。
2、动态注册监听器在某些时候是不可用的,pmon休息的时候,此时需要加一个静态注册监听,这样保证数据库可以时时刻刻对外访问。
3、多个监听器可以均衡访问的负载
4、到底用默认还是非默认的监听器做动态注册,取决于local_listener参数,默认是NULL,表示默认LISTENER是动态注册的,如果有值,根据值找到动态注册的监听器。
以上是“oracle如何实现网络配置”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联行业资讯频道!
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站栏目:oracle如何实现网络配置-创新互联
标题URL:http://myzitong.com/article/cogcos.html