[20190306]Disabled EZCONNECT.txt

lfree發表於2019-03-08

[20190306]Disabled EZCONNECT.txt



--//連結裡面提到:


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部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2637861/,如需轉載,請註明出處,否則將追究法律責任。

相關文章