实体框架 - Oracle DB:间歇性地抛出“ORA-12516,TNS:侦听器无法找到具有匹配协议栈的可用处理程序”

时间:2017-05-08 17:53:37

标签: c# oracle entity-framework

有时,EF会抛出此错误。

异常堆栈跟踪

   in OracleInternal.ConnectionPool.PoolManager3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   in OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   in OracleInternal.ConnectionPool.OracleConnectionDispenser3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
   in Oracle.ManagedDataAccess.Client.OracleConnection.Open()
   in System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Openb__36(DbConnection t, DbConnectionInterceptionContext c)
   in System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)
   in System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
   in System.Data.Entity.Core.EntityClient.EntityConnection.<Openb__2()
   in System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
   in System.Data.Entity.Core.EntityClient.EntityConnection.Open()

内部异常堆栈跟踪

   in OracleInternal.ConnectionPool.PoolManager3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   in OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
   in OracleInternal.ConnectionPool.OracleConnectionDispenser3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
   in Oracle.ManagedDataAccess.Client.OracleConnection.Open()
   in System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
   in System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action2 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)
   in System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
   in System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
   in System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
   in System.Data.Entity.Core.EntityClient.EntityConnection.Open()

是数据库问题还是实体框架问题?我该如何解决?

1 个答案:

答案 0 :(得分:1)

当打开的Oracle连接数超过允许的最大连接数时,抛出ORA-12516。

如果您的申请发生:

  1. 确保正确关闭连接。
  2. 如果您确实拥有需要大量已打开连接的高负载应用程序,请在Oracle配置中增加此允许的最大值(As you have 2 entries in Back stack, you can check back stack count on Back Pressed method. FragmentManager mFragmentManager = getSupportFragmentManager(); int count= mFragmentManager.getBackStackEntryCount(); if(count==1){ // do your work } )。
  3. 查看此thread了解详细信息。