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

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
anand123
Posts: 17
Joined: Thu 30 Jan 2014 08:58

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

Post by anand123 » Tue 10 Oct 2017 05:26

This error occurs when we use fluent api, works fine with edmx.

complete details posted in https://stackoverflow.com/questions/465 ... 3#46593443

DevArt suggested to use ry setting config.CodeFirstOptions.TruncateLongDefaultNames=true. but this doesn't help.

below one of the table scripts causing this error.

Code: Select all

 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
It is very critical issue, has to be fixed very soon. please advise.

regards,
Anand

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Tue 10 Oct 2017 15:08

You are using Code-First Approach (the database structure is generated in runtime), aren't you?

There are two alternative ways to solve the issue:

1) upgrade to 9.4.280 or higher to get a fix
https://www.devart.com/dotconnect/oracl ... story.html
9.4.280 25-May-17
The support of EF Core models with string columns, which are defined without length limit and participate in PKs, FKs, indices, is improved

2) add a length size to your mapping so that the total length of all columns participating in PK would not exceed the 6398 limit

anand123
Posts: 17
Joined: Thu 30 Jan 2014 08:58

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

Post by anand123 » Tue 10 Oct 2017 16:47

Thanks for your reply.

actually we are not using code first.

Database already exists. we just use fluent api for configuration and mapping.

actually it works for administrator db account.

2) add a length size to your mapping so that the total length of all columns participating in PK would not exceed the 6398 limit
Please advise where need to configure this, any example.? because this is one of the tables cause this issue, assume there are more other tables as well.


regards,
anand

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Wed 11 Oct 2017 16:00

anand123 wrote:Please advise where need to configure this, any example
Here is an example of fluent mapping in the OnModelCreating method:

Code: Select all

      builder.Entity<YourEntityName>()
        .Property(p => p.YourPropertyName)
        .HasMaxLength(YourValue);

Post Reply