anand
anand

Reputation: 307

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

First dataaccess method using entityframework fluent api , Dev Art in oracle database getting below error.

actual table design :

enter image description here

this query failing.

  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

but it works with entityframework edmx model + devArt. any suggestions?

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)

Upvotes: 0

Views: 3043

Answers (2)

Barbaros &#214;zhan
Barbaros &#214;zhan

Reputation: 65363

  • It seems you use an oracle db of version 9.2, 10 or 11 with block size 8k. Use smaller key index. You may diminish the initial size of index, when you recreate the indexes of your problematic table ( call your_table ).
  • Alternatively, create a tablespace with non-standard, bigger block size and create the corresponding index on that tablespace, like in the example :
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;

Upvotes: 1

Devart
Devart

Reputation: 122002

  1. Please enable the dbMonitor tool and specify the exact SQL statement which fails to execute: https://www.devart.com/dotconnect/oracle/docs/?dbmonitor.html.

  2. Try setting config.CodeFirstOptions.TruncateLongDefaultNames=true. Does this help? https://www.devart.com/dotconnect/oracle/docs/?CodeFirstOptions.html

Upvotes: 1

Related Questions