【EZCONNECT】 sqlnet.ora文件中EZCONNECT参数与Easy Connect Naming Method方法

简介: 如果对tnsnames.ora文件没有做充分的配置,也可以使用Oracle的Easy Connect Naming Method方法测试数据库是否可以访问。这里不对这种方法的原理和详细用法展开描述,这方面的信息可以通过以下Oracle连接获得。
如果对tnsnames.ora文件没有做充分的配置,也可以使用Oracle的Easy Connect Naming Method方法测试数据库是否可以访问。
这里不对这种方法的原理和详细用法展开描述,这方面的信息可以通过以下Oracle连接获得。
http://download.oracle.com/docs/cd/B19306_01/network.102/b14212/naming.htm#i498306
或直接访问下属文章进行参考。
Net Services Administrator's Guide - 2 Quick Start to Oracle Net Connections - Task 3: Configure the Client for Connection to a Database
Net Services Administrator's Guide - 8 Configuring Naming Methods - Using the Easy Connect Naming Method

简单列一下该方法的使用语法,供参考。
CONNECT username/password@host[:port][/service_name][/instance_name]
CONNECT username/password@[//]host[:port][/service_name]

本文想要强调指出的是,如果想要使用Easy Connect Naming Method方法测试数据库的连通性,需要在sqlnet.ora文件中增加“NAMES.DIRECTORY_PATH= (EZCONNECT)”信息,否则该功能将无法使用。

1.sqlnet.ora文件的位置
该文件与listener.ora和tnsnames.ora文件处于同一目录,具体目录为:$ORACLE_HOME/network/admin。

2.体验报错,以此为鉴
如果是Windows客户端没有配置相应的参数,会收到如下报错:
C:\Users\secooler>sqlplus sec/sec@10.17.193.211:1521/ora10g

SQL*Plus: Release 10.2.0.3.0 - Production on 星期一 8月 2 21:19:01 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-12154: TNS: 无法解析指定的连接标识符


请输入用户名:
ERROR:
ORA-12560: TNS: 协议适配器错误


请输入用户名:
ERROR:
ORA-12560: TNS: 协议适配器错误


SP2-0157: 在 3 次尝试之后无法连接到 ORACLE, 退出 SQL*Plus

C:\Users\secooler>

如Linux服务器端的sqlnet.ora文件没有设置相应的参数,将会收到如下错误:
sec@secdb /home/oracle$ sqlplus sec/sec@10.17.193.211:1521/ora10g

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Aug 2 21:21:34 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

两种错误内容是一样的,从错误提示上看,很难直接定位是由于sqlnet.ora文件配置问题导致的。这就需要我们对Easy Connect Naming Method的原理深入了解。

3.向sqlnet.ora文件中添加“EZCONNECT”信息,解决该问题
“EZCONNECT”这个单词很好理解,从发音上即可等同于“Easy Connect”。从此,该参数将不再陌生。
sec@secdb /home/oracle$ cat $ORACLE_HOME/network/admin/sqlnet.ora
# sqlnet.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)

在添加完参数后尝试连接,成功。
sec@secdb /oracle$ sqlplus sec/sec@10.17.193.211:1521/ora10g

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Aug 2 21:31:50 2010

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

sec@ora10g>

4.小结
Oracle提供了很多类似文中提到的Easy Connect Naming Method小技巧。建议在使用这些便捷方法之前充分了解工具使用的前提和约束,这样可以在提高效率的同时不至于带来太多的障碍。

Good luck.

secooler
10.08.02

-- The End --

目录
相关文章
|
1月前
|
SQL Oracle 关系型数据库
Oracle数据库启动时:ORA-00119: invalid specification for system parameter LOCAL_LISTENER;
Oracle数据库启动时:ORA-00119: invalid specification for system parameter LOCAL_LISTENER;
|
4月前
|
Java Spring
Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings.
Initialization failed for 'https://start.spring.io' Please check URL, network and proxy settings.
275 0
|
8月前
|
关系型数据库 MySQL 数据库
【报错】DVWA遇到Could not connect to the database service. Please check the config file. Database Error
【报错】DVWA遇到Could not connect to the database service. Please check the config file. Database Error
524 0
|
Java Spring
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
1993 1
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
|
SQL Oracle 关系型数据库
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection wit...
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection wit...
219 0
|
SQL Oracle 关系型数据库
Oracle数据库ORA-12516:“listener could not find available handler with matching protocol stack!“问题解决方法
Oracle数据库ORA-12516:“listener could not find available handler with matching protocol stack!“问题解决方法
526 0
Oracle数据库ORA-12516:“listener could not find available handler with matching protocol stack!“问题解决方法
|
SQL Oracle 关系型数据库
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor案例2
今天使用SQL Developer连接一台测试服务器数据库(ORACLE 11g)时,遇到了“ORA-12514, TNS:listener does not currently know of service requested in connect descriptor”错误,具体提示如下所示:...
5296 0
|
数据库
ORA-12520: TNS:listener could not find available handler for requested type of server
当你碰到ORA-12520错误时,如下所示: 英文错误提示: ORA-12520: TNS:listener could not find available handler for requested type of server 中文错误提示: ORA-12520: TNS: 监听程序无法为请求的服务器类型找到可用的处理程序 一般你应该从下面两个方面去检查出错原因并解决问题:   1:数据库是专用服务器,但是在tnsname.ora配置文件中设置的连接方式是shared,这种情况需要修改tnsname.ora配置文件,这种错误情况一般发生在第一次连接数据库服务器。
1324 0
|
Oracle 关系型数据库 数据库
Oracle中Error while performing database login with the XXXdriver; Listener refused the connection with the following error; ORA-12505,TNS:listener does
一次连接数据库怎么也连接不上,查了多方面资料,终于找到答案,总结 首先应该保证数据库的服务启动 在myeclipse的数据库视图中点 右键->new 弹出database driver的窗口, Driver template选择oracle(thin driver), Driver name 输入...
1101 0