Identifier is too long - Oracle 12.2 Compatible to 12.1

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Susanna
Posts: 5
Joined: Fri 03 Aug 2018 08:42

Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by Susanna » Mon 24 Sep 2018 13:24

Dear DevArt Team,

I'm getting an exception ORA-00972: identifier is too long on Oracle 12.2 BUT compatible to 12.1. DevArt 9.6.540.
The generated queries by EF 6 have more than 30 characters assuming that the Oracle version is 12.2 but actually it doesn't have the features of 12.2 since compatible with 12.1.

Could you please investigate this?
Thanks in advance.

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

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by Shalex » Fri 28 Sep 2018 17:40

1. Try setting this option in your code before the context usage (or in a static context constructor):

Code: Select all

    var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
    config.CodeFirstOptions.TruncateLongDefaultNames = true;
2. If this doesn't help:
a) specify the database object (table, column, index, foreign key, etc) which name exceeds the 128 bytes limit for identifiers in Oracle 12.2
b) the name itself that fails to be created

JIC: enable dbMonitor to trace the SQL statements sent to Oracle Server

vfel
Posts: 2
Joined: Fri 29 Nov 2019 13:57

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by vfel » Fri 29 Nov 2019 15:29

Dear DevArt Team,

I come Back to this topic because I think we have the same Problem with a Orcale 19c DB.
When we connect to an Oracle 11g or 12c R1 DB tables are created as expected and Index and Foreign Key Names longer than 30 bytes are replaced with short names.
When connecting to a 19c DB set compatible to 12c R1 the default names are used exceeding the 30 bytes causing the ORA-00972.
I thing the components expect the name to be limited to 128 bytes because it is a 19c and do not consider the compatible setting.
The TruncateLongDefaultNames setting did not help in my tests. I was able to work around the problem by editing the created migrations. I assume that is what you recommended as option 2. But I'm not really happy with this solution because we wold have to do this with every coming migration.

Is there an other way to get the names shortened in newer Oracle DBs?
Thanks in advance for your help.

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

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by Shalex » Sat 30 Nov 2019 11:09

@vfel

The bug with using config.CodeFirstOptions.TruncateLongDefaultNames in EF Core is fixed in v9.4.280. We recommend using the newest build v9.9.887.

If this doesn't help, please specify:
1) the version of your Entity Framework (e.g.: EF Core 3)
2) the version of your dotConnect for Oracle (e.g.: 9.9.887)

vfel
Posts: 2
Joined: Fri 29 Nov 2019 13:57

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by vfel » Mon 02 Dec 2019 10:39

Hi Shalex,

thanks for the quick reply.
we use dotConnect for Oracle in version 9.9.887 and EF Core 2.2.6 (our project is .Net Framework therefore we cannot update to EF Core 3.x).
The problem still seems to be present in this combination.
Let me know if I can provide any other information to localize this problem.

Veit

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

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by Shalex » Fri 06 Dec 2019 11:23

Thank you for your report. We will investigate the issue with config.CodeFirstOptions.TruncateLongDefaultNames in EF Core 2.2 and notify you about the result.

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

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by Shalex » Wed 18 Dec 2019 21:21

vfel wrote:
Fri 29 Nov 2019 15:29
When we connect to an Oracle 11g or 12c R1 DB tables are created as expected and Index and Foreign Key Names longer than 30 bytes are replaced with short names.
When connecting to a 19c DB set compatible to 12c R1 the default names are used exceeding the 30 bytes causing the ORA-00972.
I thing the components expect the name to be limited to 128 bytes because it is a 19c and do not consider the compatible setting.
The TruncateLongDefaultNames setting did not help in my tests.
The new config.CodeFirstOptions.TruncateAllLongNames option (default value is False) is added to use EF Core 2/EF Core 3 implementation for truncating long names of columns and PK/FK/IX/UX. We will notify you when the new build is available for download.

With the new build, you should set the following options in a static constructor of your context:

Code: Select all

    var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
    config.Workarounds.ProviderManifestToken = "Oracle, 11.2";
    config.CodeFirstOptions.TruncateAllLongNames = true;

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

Re: Identifier is too long - Oracle 12.2 Compatible to 12.1

Post by Shalex » Tue 24 Dec 2019 18:00

dotConnect for Oracle 9.10 is released: viewtopic.php?f=1&t=39716.

Post Reply