深入探讨Oracle网络服务解析(1)(2)
- C:Documents and Settings ew>sqlplus system/lijie123@linuxoracle
- SQL*Plus: Release 10.2.0.1.0 - Production on 星期三 9月 19 18:37:51 2007
- Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
- Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
- With the Partitioning, OLAP and Oracle Data Mining options
- JServer Release 9.2.0.4.0 - Production
SQL>
成功!!!
第四种:Oracle Easy Connect
只在oracle 10g以上版本使用
Oracel Easy Connect Naming
使用oracle easy connect naming必须满足以下要求
1、oracle net services 10g必须安装在客户端
2、客户端及服务器端必须支持TCP/IP,并启用
3、不允许高级连接描述符特性,如:连接池、外部过程调用
配置oracle easy connect naming
在sqlnet.ora增加下面这行:
- NAMES.DIRECTORY_PATH=(EZCONNECT,TNSNAMES) #注意增加了EZCONNECT
oracle easy connect naming方法示例
eg:
- connect scott/tiger@hostname:port/servicesname
- connect scott/tiger@//hostname/servicesname
解释:
语法构件 描述
// 任选:通过URL连接时使用
hostname 必选: 主机名或IP
port 任选:端口号
servicesname 必选:oracle网络服务的名称
第五种:本地命名法
本地命名方法也被称为tnsnames.ora方法
可用Oracle net manager配置本地命名方法(当然也可以用OEM)
打开Oracle net manager,在Local选项中选择Service Naming进行添加,添加好的tnsnames.ora内容如下:
- eg:
- TEST =
- (DESCRIPTION =
- (ADDRESS_LIST =
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.61)(PORT = 1521))
- )
- (CONNECT_DATA =
- (SERVICE_NAME = dg1)
- )
- )
- TEST为网络服务名,SERVICE_NAME为oracle的服务名
以上就探讨了些Oracle网络服务一般常用的解析方法,要想了解的更多相关问题的解决方案,请留意51cto.com站上的相关论坛。