oracle——监听(三、监听配置)

时间:2022-05-18 22:23:07

一、引言


oracle配置实例监听真是太坑了,下面我是按照一个监听在一个IP一个端口上监听多个实例 的情况下配置的,如果不明白监听有哪几类情况请看上一篇博客,下面是我配置监听遇到的大坑小坑==

更新——————————————————————————————

之前总结有点问题,可能是由于之前修改文件后没有重启服务导致的==



二、配置


1、最初安装软件后安装监听完效果(如果你用navicat连接,不用sqlplus的话)


恭喜你,只用配置服务端的listener文件就可以了,不知道为什么有一次我得配置服务端的tnsnames,不过最终自动修复了,坑爹啊==

listener文件(特别注意listener中的address的host要填写本机的名字,填localhsot会报ORA-12514:监听程序当前无法识别连接描述符中请求的服务

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\xcy\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\xcy\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-QTQ8CUV)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)

ADR_BASE_LISTENER = C:\app\xcy


2、机子安装全局数据库orcl,sdi为orcl之后


listener文件,这个跟上面一样


tnsnames文件,不知道这里面为啥必须填这句话,正常的不填倒是没事儿==费解

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-QTQ8CUV)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)


3、机子安装全局数据库xcy.bj,SID:xcy之后


listener文件,这个跟上面一样

它自动给我在tnsnames文件中添加了点东东==


XCY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-QTQ8CUV)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xcy.bj)
)
)

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-QTQ8CUV)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)



三、navicat连接


网上都是这么说的

这是因为oci.dll版本不对。因为Navicat是通过Oracle客户端连接Oracle服务器的,Oracle的客户端分为两种,一种是标准版,一种是简洁版,即Oracle Install Client。而我们用Navicat时通常会在自己的安装路径下包含多个版本的OCI,如果使用Navicat连接Oracle服务器出现ORA-28547错误时,多数是因为Navicat本地的OCI版本与Oracle服务器服务器不符造成的。所以我们要做的就是下载OCI使之与我们所安装的Oracle服务器相符合。

可是用了客户端的oci一般没用,都是直接选的服务端的oci,全部搞定,一点问题没有==



四、客户端应用程序与sqlplus连接不同


arcmap、navicat等客户端连接不需要配置tnsnames文件夹,配置好oci即等即可,用的是basic连接方式;

sqlplus用的是tns连接方式,这时候要配置客户端tnsnames文件夹,如下:

ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.70.133)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORCLXCY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)



五、总结


  • oracle服务端安装过程中的listener与tnsnames文件;

  • navicat连接oracle;

  • 客户端应用程序与sqlplus区别;