ITPub博客

首页 > 数据库 > Oracle > [20190306]Disabled EZCONNECT.txt

[20190306]Disabled EZCONNECT.txt

原创 Oracle 作者:lfree 时间:2019-03-08 09:07:06 1 删除 编辑

[20190306]Disabled EZCONNECT.txt


https://connor-mcdonald.com/2019/03/06/disabled-ezconnect/


--//链接里面提到:


NAMES.DIRECTORY_PATH= (TNSNAMES)


In such a scenario, you need to explicitly allow for EZCONNECT method to allow the connection to work.


NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)


--//在以上的情况下,必须显示的加入EZCONNECT.但是

If you have never touched your sqlnet.ora, it probably looks like this:


NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)


but there is no need to panic. Those default values allow EZCONNECT as well.


--//测试看看:


1.环境:

SCOTT@book> @ ver1

PORT_STRING                    VERSION        BANNER

------------------------------ -------------- --------------------------------------------------------------------------------

x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production


2.测试:

--//我客户端机器安装有12cR2(windows 64bit).

--//修改sqlnet.ora如下:

NAMES.DIRECTORY_PATH= (TNSNAMES)


--//测试EZCONNECT:

R:\>sqlplus -l scott/book@192.168.100.78:1521/book

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 8 09:03:06 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

ERROR:

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

SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus


--//如果修改sqlnet.ora如下:

NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)


R:\>sqlplus -l scott/book@192.168.100.78:1521/book

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 8 09:03:46 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SCOTT@192.168.100.78:1521/book>

--//成功连上!!


3.如果修改如下:

--//修改sqlnet.ora如下:

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)


R:\>sqlplus -l scott/book@192.168.100.78:1521/book

SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 8 09:05:59 2019

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options


4.我测试各种情况:

NAMES.DIRECTORY_PATH= (TNSNAMES)           =>失败

NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES)   =>失败

NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME) =>成功

NAMES.DIRECTORY_PATH= (HOSTNAME)           =>成功


--//视乎只要存在HOSTNAME,EZCONNECT就可以通过.有时候想想oracle设计太奇怪了.


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2637861/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969886