Search code examples
databaseentity-framework-6database-migrationodp.net

Devart to ODP.NET -> ORA-08177: can't serialize access for this transaction


I am a beginner in everything related to connectors, db, etc.

My company has a Devart connector for the database and we are trying to upgrade using ODP.NET.

When I change everything and try to restart the migrations I get this error.

ORA-08177: can't serialize access for this transaction.

I installed these version for ODP.NET ODP Versions Here my oracle db version Oracle DB version

Then I read the readme and updated the web.config, my context and my base controller. When I delete all my migrations, create the first one, and try to update the database (first i delete all tables and views from the db), I get this error

ORA-08177: can't serialize access for this transaction.

I tried to change the TRANSACTION ISOLATION LEVEL to READ COMMITTED (because i read that may be the problem) and nothing.

I tried to downgrade the ODP.NET Version (for the same reason) and nothing.

I will try to share the code but is from my company so i have to be careful.

My web.config

<connectionStrings>
        <add name="DBContext" connectionString="User Id=aaaa;Password=1234;Data Source=OracleDataSource" providerName="Oracle.ManagedDataAccess.Client" />
    </connectionStrings>

<oracle.manageddataaccess.client>
        <version number="*">
            <dataSources>
                <!-- Customize these connection alias settings to connect to Oracle DB -->
                <dataSource alias="OracleDataSource" descriptor="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.68.202)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=XE))) " />
            </dataSources>
        </version>
    </oracle.manageddataaccess.client>

<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.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
        </DbProviderFactories>

<dependentAssembly>
                <publisherPolicy apply="no" />
                <assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
            </dependentAssembly>
        </assemblyBinding>

    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="v13.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.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
        </providers>
    </entityFramework>

My DBContext

namespace UFV.DBContext
{
    public class UFVDBContext : DbContext
    {

        static UFVDBContext()
        {
            Database.SetInitializer<UFVDBContext>(new MigrateDatabaseToLatestVersion<UFVDBContext, Configuration>());
        }
//my entities...

base.OnModelCreating ( modelBuilder );
            modelBuilder.HasDefaultSchema("MyScheme");
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention> ();

And in my base controller i only change the library from Devart to Oracle

I'm sorry if my English isn't the best or I haven't shared enough information, I'll clarify any questions you may have.


Solution

  • Ok, my problem was solved. The ODP version of the connector was incompatible. I had to downgrade to version 12.2.11 ODP.