ORA-01450:超出最大密钥长度(6398)(Devart.Data.Oracle.OracleException)

时间:2017-10-05 18:21:14

标签: oracle entity-framework-6 devart

使用entityframework fluent api的第一个dataaccess方法,oracle数据库中的Dev Art低于错误。

实际的表格设计:

enter image description here

此查询失败。

  CREATE TABLE DADeskSettings ( 
  UserID NVARCHAR2(2000) NOT NULL,
  Password NVARCHAR2(2000) NOT NULL,
  DADeskURL NVARCHAR2(2000) NOT NULL,
  WebURL NVARCHAR2(2000) NOT NULL,
  IsDADeskSettings NUMBER(1) NOT NULL,
  DAType VARCHAR2(4 CHAR) NOT NULL,
  UPDATEDADESK NUMBER(1) NOT NULL,
  isshortseavoy NUMBER(1) NULL,
  CreatedBy VARCHAR2(8 CHAR) NULL,
  UpdatedBy VARCHAR2(8 CHAR) NULL,
  CONSTRAINT PK_DADeskSettings PRIMARY KEY (UserID, Password, DADeskURL, WebURL, IsDADeskSettings, DAType)
)

ORA-01450: maximum key length (6398) exceeded

但它适用于entityframework edmx model + devArt。有什么建议吗?

var dummy2 = ContextFactory.Db.GetQuery<OPRPortCall>().Select(x=>x.AccountCode).FirstOrDefault(); //this is one of the line.


    *** Client Application Says ***

- ORA-01450: maximum key length (6398) exceeded  (Devart.Data.Oracle.OracleException)

- The type initializer for 'Server.ManagerService.Registers.LookupVmSvc' threw an exception.  (System.TypeInitializationException)

- Exception has been thrown by the target of an invocation.  (System.Reflection.TargetInvocationException)



Stacktrace 
*** Client Application Says ***

   at Devart.Data.Oracle.bh.d(Int32 A_0)
   at Devart.Data.Oracle.de.a(Int32 A_0, z A_1)
   at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
   at Devart.Common.Entity.ej.a(DbConnection A_0, Nullable`1 A_1, b3 A_2)
   at Devart.Common.Entity.ej.a(DbConnection A_0, Nullable`1 A_1)
   at Devart.Data.Oracle.Entity.OracleEntityProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection)
   at System.Data.Entity.Internal.DatabaseOperations.Create(ObjectContext objectContext)
   at System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func`3 createMigrator, ObjectContext objectContext)
   at System.Data.Entity.Database.Create(DatabaseExistenceState existenceState)
   at System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
   at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
   at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
   at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.AsNoTracking()
   at System.Data.Entity.Infrastructure.DbQuery`1.AsNoTracking()
   at Server.Manager.DataAccess.VMEntities.GetQuery[T](Boolean tracking)

2 个答案:

答案 0 :(得分:1)

  1. 请启用dbMonitor工具并指定无法执行的确切SQL语句:https://www.devart.com/dotconnect/oracle/docs/?dbmonitor.html

  2. 尝试设置config.CodeFirstOptions.TruncateLongDefaultNames = true。这有帮助吗? https://www.devart.com/dotconnect/oracle/docs/?CodeFirstOptions.html

答案 1 :(得分:1)

  • 您似乎使用版本9.2,10或11的oracle db with block 大小8k。使用较小的键索引。你可能会减少初始大小 index,当您重新创建有问题的表的索引时(调用 your_table )。
  • 或者,创建一个具有非标准,更大块大小的表空间 在该表空间上创建相应的索引,就像在 例如:
SQL> create tablespace TS_DATA_16 datafile '+DATA' size 100M blocksize 16k;
SQL> alter user your_schema quota unlimited on TS_DATA_16;
SQL> drop table your_table;
SQL> create table your_table
     (
      ...
     )
      tablespace TS_DATA_16;
相关问题