Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle.ManagedDataAccess OracleInternal.NotificationServices.ONSException

We use the 'Oracle.ManagedDataAccess' ODP.NET driver for database access to Oracle.

When connecting to the database with the connection string:

Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=10.40.40.38)(Port=1521)))(CONNECT_DATA=(SERVICE_NAME=D3T))); User Id=test; Password=test'

Internal error message:

OracleInternal.NotificationServices.ONSException**: ONS: No node lists have been configured' after opening the connection.

code:

string connect = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=10.40.40.38)(Port=1521)))(CONNECT_DATA=(SERVICE_NAME=D3T))); User Id=test; Password=test";
OracleConnection connection = new OracleConnection(connect);
connection.Open();

The connection to the database is working fine. But what is internally wrong with the configuration?

like image 757
J. Deing Avatar asked Jan 09 '18 14:01

J. Deing


Video Answer


4 Answers

Thanks to Jacob Peterson.

But if you are unable to find the mentioned setting in C# code then configure your config as below. "Add settings if the block is already there"

<oracle.manageddataaccess.client>
    <version number="*">
      <settings>
        <setting name="LoadBalancing" value="false" />
        <setting name="HAEvents" value="false" />
      </settings>      
    </version>   
  </oracle.manageddataaccess.client>
like image 30
sandeepdhankar10 Avatar answered Nov 01 '22 10:11

sandeepdhankar10


I found this link helpful: https://www.databaseusers.com/article/6046913/ONS%3A+No+node+lists+were+configured

Basically, you need to configure ONS, or disable LoadBalancing and HAEvents like so:

Oracle.ManagedDataAccess.Client.OracleConfiguration.LoadBalancing = false;
Oracle.ManagedDataAccess.Client.OracleConfiguration.HAEvents = false;
like image 133
Jacob Peterson Avatar answered Nov 01 '22 09:11

Jacob Peterson


We configure the OracleConnection with a single connection string (without any xml).
Setting those two parameters is possible using the following names, the other parts are for example and not relevant for this problem.

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=mydbhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=myservicename)));load balancing=false;ha events=false;Min Pool Size=1;Incr Pool Size=1;user id=mydbuser

like image 27
WarpEnterprises Avatar answered Nov 01 '22 09:11

WarpEnterprises


I am using ODP.NET Managed Client for years and never saw those OSN exceptions until recent updates when migrating to .NET Core and using Oracle.ManagedDataAccess and Oracle.ManagedDataAccess.Core Nuget packages.

Thanks to Jacob Peterson and other members who suggested to either ignore or disable the both properties "LOAD BALANCING=False;HA Events=False". Each one generates 3 exceptions if enabled on opening connection.

I assume that the new releases suppose that those features are enabled regardless if the server and/or connection string were prepared for that.

So, I suggest to ignore them or append disabled values to the connection string.

like image 22
Marwan J. Al Khatib Avatar answered Nov 01 '22 11:11

Marwan J. Al Khatib