码迷,mamicode.com
首页 > 数据库 > 详细

oracle监听

时间:2017-06-27 01:05:43      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:names   service   文件   off   工具   glob   时间   work   使用   

监听:
  为客户端提供连接到服务器端的数据库的接口

 

一、使用netmgr工具配置监听:

(其他配置监听方式:

   1 netca ,比较简单

   2    直接修改配置文件

 [oracle@oracle admin]$ netmgr 

技术分享

 

动态监听:

(数据库的pmon进程会自动注册到监听里面来,不过可能需要点时间(必需是默认监听listener))

(非默认监听的动态监听需要手工让数据库注册到监听:alter system set local_listener=‘(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.111)(PORT=1522))‘)

 

技术分享

 

静态监听:(需要绑定数据库)

技术分享

 

 

启动监听:

 [oracle@oracle admin]$ lsnrctl start

#默认启动的监听是listener  , 如果启动监听L1 则: lsnrctl start L1

Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 08-JUN-2017 17:33:52
Uptime 0 days 0 hr. 0 min. 10 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
Services Summary...
Service "fsdb" has 1 instance(s).                                                  # service name 在连接监听时需要用到
Instance "fsdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

 

 通过监听使用命令连接服务器:

   sqlplus system/123456@192.168.100.111:1521/fsdb

 

二、通过配置文件的方式连接服务:

创建tns配置文件:

技术分享

 

 下一步选择协议:省略

 技术分享

 

技术分享

 

 连接服务器:

   [oracle@oracle admin]$ sqlplus system/123456@f1     #f1上面配置tns时第一步设置的

 

 三、通过修改配置文件手工配置监听:

  通过图形化配置监听和tns实质上就是修改配置文件:

    $ORACLE_HOME/network/admin/ 目录下的文件 listener.ora (监听配置文件)  tnsnames.ora(tns配置文件)

 

配置文件例子:

 

监听多个实例的例子:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = RROD4)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD4)
)
(SID_DESC =
(GLOBAL_DBNAME = EMREP)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = EMREP)
)
)

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edsir1p8.us.oracle.com)(PORT = 1521))
)

ADR_BASE_LISTENER = /u01/app/oracle

 

监听不同端口的例子:


L1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edsir1p8.us.oracle.com)(PORT = 1522))
)

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD4)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD4)
)
)


ADR_BASE_L1 = /u01/app/oracle

LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = edsir1p8.us.oracle.com)(PORT = 1521))
)

ADR_BASE_LISTENER = /u01/app/oracle

SID_LIST_L1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = PROD4-1522)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = PROD4)
)
)


tns配置文件:

P4 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.190.104.28)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = PROD4.us.oracle.com)
)
)

 

oracle监听

标签:names   service   文件   off   工具   glob   时间   work   使用   

原文地址:http://www.cnblogs.com/fanxuanhui/p/7082953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!