Page 1 of 1

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

Posted: Tue 10 Oct 2017 05:26
by anand123
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

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

Posted: Tue 10 Oct 2017 15:08
by Shalex
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

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

Posted: Tue 10 Oct 2017 16:47
by anand123
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

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

Posted: Wed 11 Oct 2017 16:00
by Shalex
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);