1

This is a rather specific problem.

I'm doing some work in a Java project that uses a database access framework, originally designed to work with Oracle DB 9i.

To work on this project I needed an Oracle DB on my Mac, running OSX Mountain Lion, and the only apparent solution was to run it in a VM. Therefore I downloaded the OTN Developer Day VM from here which comes complete with an Oracle DB 12c instance.

After jumping through various hoops, I have gotten my Eclipse/Tomcat/Servlets setup to talk to the 12c database with the jdbc7 driver, which I downloaded from the Oracle site. Everything works as expected, and as a note, Oracle SQL Developer connects to it just fine.

Here's the connection string I'm using: jdbc:oracle:thin:@localhost:1521/pdb1 I can log on as local users I have created within the default pluggable DB, or by using the connection string jdbc:oracle:thin:@localhost:1521:orcl I can log on as any of the common users that are set up.


Now, the trick is when I want to use the Java DB access framework, designed for use with a 9i DB. I get the error: ORA-28040: No matching authentication protocol.

Based on what I could find, such as this Oracle thread, my 12c database is not configured to allow 9i-style authentication (due to security holes in 9i). So to fix this, I need to set my DB to allow this by going to this file:

/u01/app/oracle/product/12.1.0/dbhome_1/network/admin/sqlnet.ora

And adding the line:

SQLNET.ALLOWED_LOGON_VERSION=(9)

(Note that I have also tried (8), as well as (12,11,10,9,8,7) and other such oddities, and I still experience the following. I've also seen SQLNET_ALLOWED..., the underscore instead of the period, but I think that's for older Oracle DB versions.)

When I do this, and reboot the VM, I can no longer connect to the DB. When I attempt to connect to pdb1 I get:

An error was encountered performing the requested operation:

IO Error: The Network Adapter could not establish the connection

Vendor code 17002

And when I attempt to connect to orcl I get:

An error was encountered performing the requested operation:

Listener refused the connection with the following error:
ORA-12528, TNS:listener: all appropriate instances are blocking new connections 

Vendor code 12528

When I go into the terminal in the VM and check the status of the service with lsnrctl (something I found with a bit of Googling) this happens:

Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> 

Unfortunately, I am quite the lightweight on Oracle DB and DB administration in general; I would prefer to simply code stuff and have the DB just work, but I do need to get this DB access framework to work, and I only have a copy of Oracle 12c, not 9i, so I'm in a bind.

4

2 に答える 2

2

うわー、単純に、うわー。

まず、sqlnet.oraファイルを調整したらDBにアクセスできなくなったのは、ざっくり推測すると、そのファイルに入れている設定が不正で、DBがまったく起動しなかったためです。

次に、ここでの基本的な問題は、次のメッセージを見たことです。

https://community.oracle.com/message/10155459#10155459

そして、構文が次のとおりであると仮定します。

SQLNET.ALLOWED_LOGON_VERSION=(8)

また、括弧内にカンマで区切って複数の数値を入れることができる可能性があります。.oraこの仮定は、Oracle DB や、ファイルに変数を設定する方法について何も知らない私から来ているにすぎません。場合によっては括弧が有効かどうかはわかりませんが、この場合は明らかにそうではありません。

かっこを削除すると、DB は通常どおり再起動します。

SQLNET.ALLOWED_LOGON_VERSION=8

上記の設定でDBを再起動すると、すべての接続が正常に機能します。ただし、私の 9i ベースの DB-access-library は依然として同じエラーを返します。

さらに検索すると、Oracle DB 11 についてここALLOWED_LOGON_VERSIONで説明され、 に関するほぼすべての投稿で言及されているが 12c で廃止され、andに置き換えられていることがわかります(後者については、こちらで詳しく説明しています)。ORA-28040: No matching authentication protocolALLOWED_LOGON_VERSION_CLIENTALLOWED_LOGON_VERSION_SERVER

これらの両方を 8 に設定すると問題が解決し、9i ベースのライブラリが 12c データベースに接続できるようになりました。わーい!

sqlnet.ora具体的には、ファイルに追加する行は次のとおりです。

SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
于 2014-03-02T05:31:23.330 に答える
0

Mac、Java 8、および Oracle 12c では、「sqlnet.ora」に次のエントリが必要です。

SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
于 2016-02-04T09:55:14.580 に答える