0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Oracle Entity FrameworkでシノニムからSELECTするとき、「すでに使用されているオブジェクト名です」エラーの暫定対処法

Posted at

はじめに

動作環境

  • ASP.NET(VB) MVC
  • Oracle.ManagedDataAccess.EntityFramework 12.2.20190115

発生したエラー

context.シノニム.ToList()したとき、下記エラー発生

ORA-00955: すでに使用されているオブジェクト名です。

対処法

スキーマが所有しているテーブルを合わせてDbContext内に宣言したところシノニムからSELECTが実行できるようになった。

調査内容

ToList()する前にどのようなSQLが実行されているか確認したところ下記のようなものが確認された。

select count(*) from all_tables where (owner='[owner名]' and table_name='[シノニム名]')

SELECTの結果は0件。

ownerが所有しているテーブルもDbContextで宣言したときどのように変化するか確認したところ下記のようなSQLが実行された。

select count(*) from all_tables where (owner='[owner名]' and table_name='[ownerが所有しているテーブル名]') or (owner='[owner名]' and table_name='[シノニム名]')

またSELECTの結果は「ownerが所有しているテーブル名」の分がカウントされ1件となった。

all_synonymsを事前チェックしない理由については調査する時間が取れなかった。

参考サイト

--【ASP.NET(MVC)】ODP.NET Entityデータモデルからのテーブル作成・操作について
--Oracleで実行されたSQLの履歴を確認する
--サポートされないEntity Frameworkの機能

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?