ODP.NET + Unexpected traffic on port 6200 (Oracle Notification Services) - oracle

We've got a client using our product, which includes a windows service built using .NET 4+, Entity Framework, and ODP.NET. For some reason in one particular installation, but not any other, the windows service appears to be generating traffic on 6200. Oracle Documentation indicates this is the port Oracle Notification Services uses. This is unexpected because our product does not utilize ONS. I've found other Oracle Documentation that indicates that RAC / Fast Failover also uses ONS, but we've confirmed with the client that they do not use RAC in any environments, and we are not using the RAC options in the connection string. We are also not (to our knowledge) using Database Change Notifications or doing any cache/verification of cached data, which it sounds like also leverages ONS.
Can anyone help explain why we would be generating port 6200 traffic, and more importantly, how to get it to stop? Thanks!
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings [Redacted] />
<appSettings [Redacted] />
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</providers>
<contexts>
<context type="[Redacted]" disableDatabaseInitialization="true" />
</contexts>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" />
</runtime>
</configuration>

We've narrowed the culprit down to one or more of 3 Oracle / ODP.NET specific Connection String settings:
ENLIST, HA EVENTS, and/or LOAD BALANCING
Oracle's documentation on Fast Application Notification tipped us off to these settings which we had not been aware of. This lead us to Oracle's documentation on all of their Feature Connection String Attributes.
Enlist - Default "true" - Serviced components automatically enlist in
distributed transactions.
HA Events - Default "false" - Enables ODP.NET connection pool to
proactively remove connections from the pool when a RAC service,
service member, or node goes down.
Load Balancing - Default "false" - Enables ODP.NET connection pool to
balance work requests across RAC instances based on the load balancing
advisory and service goal.
We set all 3 to explicitly be false, and the port 6200 connections ended.
ENLIST=false; HA EVENTS=false; LOAD BALANCING=false;
If the defaults are to be believed then Enlist was the culprit, but client's availability did not allow for discrete testing to confirm. We've come across other various documentation linking all 3 of these pieces of functionality to Oracle Notification Services & port 6200.

It may depend on the installed Oracle client version. In 12.1.0.2 auto-configuration of ONS feature was released. It may have something like ONS auto-discovery at the beginning of establishing a DB connection which produces this traffic.

Related

Upgrading to .Net 6 User Secrets

We currently use .Net Framework 4.8 but are upgrading Windows console apps to .Net 6.0. In 4.8, we would use Microsoft.Configuration.ConfigurationBuilders.UserSecrets to help manage keys in our app.config that we wanted to keep secret(production level keys mainly).
Our app.config would look like the following:
<configSections>
<section name="configBuilders" type="System.Configuration.ConfigurationBuildersSection, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxx" restartOnExternalChanges="false" requirePermission="false" />
</configSections>
<configBuilders>
<builders>
<add name="Secrets" userSecretsId="production" type="Microsoft.Configuration.ConfigurationBuilders.UserSecretsConfigBuilder, Microsoft.Configuration.ConfigurationBuilders.UserSecrets, Version=1.0.0.0, Culture=neutral" />
</builders>
</configBuilders>
<appSettings configBuilders="Secrets">
<add key="Sample" value="SECRET"
</appSettings>
Our Production secrets.xml:
<root>
<secrets ver="1.0">
<secret name="Sample" value="production" />
</secrets>
</root>
Anytime we would reference the key Sample, it would look at the key in app.config notice that the value was SECRET. Then it would go to AppData\Microsoft\UserSecrets\{userSecretId}\secrets.xml to replace SECRET with the value in secrets.xml
Is there a similar way to do this in .Net 6.0? I know the config files are changing to JSON but I would like to support this pattern while I upgrade. I also know that Microsoft.Configuration.ConfigurationBuilders.UserSecrets hasn't been released in a couple of years.
I appreciate any help.

ORA-00932: inconsistent datatypes: expected - got CLOB for different schemas

I'm using Oracle.ManagedDataAccess to query different schemas/users in an ASP.NET Web Application. As soon as a statement is executed for certain schemas I get an ORA-00932 CLOB error even though the statement has nothing to do with a CLOB. The statements work fine in Visual Studio but fail on an actual IIS. Can someone point me in the right direction for this?
The solution was a mission section in the web.config.
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL))) " />
</dataSources>
</version>
</oracle.manageddataaccess.client>

No Entity Framework provider found for the ADO.NET provider with invariant name 'Oracle.ManagedDataAccess.Client' . How to solve this error?

Summary: How to solve this error when generating database from model with Entity Framework and Oracle?
Details:
I tried researching and I realize there are similar questions here (like this one: No Entity Framework provider found for the ADO.NET provider with invariant name 'MySql.Data.MySqlClient' - WCF ) but my case seems to be different.
I'm new to Entity Framework and I'm making a custom destination component for a SQL Server Integration Services (SSIS), an ETL tool. I am using a previously developed destination component as a template that used LINQ to SQL and was aimed at SQL Server. I decided to switch to Entity Framework since my component is for Oracle.
After various attempts installing and uninstalling, I managed to use ODAC and ODT for Visual Studio (I'm using VS 2017 community) according to this: https://community.oracle.com/message/14535771#14535771
When I tried to create an edmx file from my DB, I followed http://download.oracle.com/oll/obe/EntityFrameworkOBE/EntityFrameworkOBE.htm#t8 , although it seems to use an older version. My wizard process looked like this:
Model from DB. I'm not sure what's the real difference between Designer and Code First...
Choose EF version. Although I did install the latest version of EF using NuGet, I get this message. I previously couldn't even generate the edmx because of an EF version error until I followed the instructions in the first link of this message.
After successfully generating the edmx model, after editing it, I tried to
"Generate Database From Model...", but then I get this error.
I'm pretty sure I registered to GAC when installing ODAC, though I'm not sure how to verify that. That might also be a problem since the ODAC installation wizard tells me to not do that when using NuGet, although I have to if I want to use ODT for Visual Studio properly AFAIK.
As I said, I'm new to EF, so I'm not sure how my App.config should look like, but currently it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.ManagedDataAccess.Client" description="Oracle Data Provider for .NET, Managed Driver" type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
</system.data>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<publisherPolicy apply="no" />
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="4.121.0.0 - 4.65535.65535.65535" newVersion="4.122.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<oracle.manageddataaccess.client>
<version number="*">
<dataSources>
<dataSource alias="SampleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xe))) " />
</dataSources>
</version>
</oracle.manageddataaccess.client>
<connectionStrings>
<add name="GerenciadorExpurgoEF" connectionString="metadata=res://*/Models.GerenciadorExpurgoEF.csdl|res://*/Models.GerenciadorExpurgoEF.ssdl|res://*/Models.GerenciadorExpurgoEF.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="DATA SOURCE=PurgeDB;PASSWORD=TESTUSR;PERSIST SECURITY INFO=True;USER ID=TESTUSR"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
What worked for me was copying the App.config from my .NET Framework EF project into my .NET Core MVC project.
That, and as many other people have suggested on other questions, EF and the Oracle EF provider need to be installed in both projects (or at least referenced).

ADO.NET EF - can't connect to my DB (using Visual Studio 2010)

So I'm struggling with this problem for more than 4 hours and I don't know where to look at any more. I follow this tutorial for absolute beginners in ADO.NET Entity Framework - [See The tutorial][1] [1]: http://msdn.microsoft.com/en-us/data/jj193542
I'm using Microsoft SQL Server 2012 and I'm using this App.Config file for my project :
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="Data Source=sqlserver2012; Integrated Security=True; MultipleActiveResultSets=True" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
</configuration>
But I keep getting errors and when I use this code the error is : **An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string.**
I'm totally new to ADO.NET Entity Framework but as I see it the problem maybe is in defaultConnectionFactory configuration. But anyways I can't find out how to keep on and how to solve this problem.
if you in fact have SQL Server instance named sqlserver2012 on your localhost zour connectionString should look like this
<parameter value="Data Source=localhost\sqlserver2012; Integrated Security=True; MultipleActiveResultSets=True" />
Cheers,
T.

ADO.NET EF - can't establish DB connection using VS2010

I'm following this tutorial : http://msdn.microsoft.com/en-us/data/jj193542 for Code First basics using ADO.NET EF. The problem is that when executing the code the DataBase is not created automatically and I think that this is because the configurations in my app.config but it's my first day with real code and I can't figure out how to adjust my config file so I can connect to my server and use a created DataBase if neccessary or let the program from the tutorial create new database as expected from what is written.
This is my App.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<!-- <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory> -->
<connectionStrings>
<add name="BloggingContext"
providerName="System.Data.SqlClient"
connectionString="server=milka-pc\sqlserver2012;Database=Panorama;user id=MyID;password=MyPass;port=3333;Integrated Security=True;"/>
</connectionStrings>
<!--<contexts>
<context type=" Blogging.BloggingContext, MyAssembly">
<databaseInitializer type="Blogging.MyCustomBlogInitializer, MyAssembly" />
</context>
</contexts>-->
</entityFramework>
</configuration>
As you can see some parts are commented as I tried a various things to make it work.
This is how y server explorer looks like while I'm trying to connect:
Also since I have zero experience with ViasualStudioXXXX and connecting to DataBases this is what I see and how I select my server:
There in milka-pc\sqlserver2012 I have a DB named Panorama which I can use or better follow the tutorial step by step and leave the program to create my new DB. For now I can't neither of these two. And to connect to milka-pc\sqlserver2012 I need to provied UserName and Password which I did in App.config. I say this just to know that these fields are not blank
If you are sure that milka-pc\sqlserver2012 is in fact working on port 3333 as you suggested
change your connectionstring to this:
<add name="BloggingContext"
providerName="System.Data.SqlClient"
connectionString="server=milka-pc\sqlserver2012,3333;Database=Panorama;user id=MyID;password=MyPass;Integrated Security=True;"/>
Just to make sure try that connection string in you SQL management studio with provided credentials.
If that doesnt work consult your sql server configuration manager, specifically under SQL server Network configuration make sure that your instance has enabled TCP/IP pipe with appropriate port enabled.
Cheers.

Resources