I am receiving an ORA-00942: table or view does not exist error when EF attempts to create the database using a code first model. The problem is due to the fact that tables are being created in multiple schemas with foreign key references between tables in different schemas. A "GRANT REFERENCES" ddl command must be executed for each table which needs to be accessed by another schema. I tried using the GRANTS property for the CreateDatabase() behavior, however it appears that command works for user level privileges, not object level privileges or I am using the property improperly.
Thanks.
ORA-00942 Table Does Not Exist Multiple Schemas Code First
ORA-00942 Table Does Not Exist Multiple Schemas Code First
Last edited by yensid21 on Thu 22 Sep 2011 12:28, edited 2 times in total.
Have you turned on the DeleteDatabaseBehaviour.Schema mode?
http://www.devart.com/blogs/dotconnect/ ... eBehaviour
http://www.devart.com/blogs/dotconnect/ ... eBehaviour
Yes, I did turn on the DeleteDatabaseBehaviour.Schema mode and I am running into the same problem. Using the dbMonitor tool, I found this is the command that failed:
I tried adding the constraint by hand using Toad and I received an ORA-00942: table or view does not exist error.
However, after I execute the command:
I can add the constraint.
This is the same behaviour that is happening when Entity Framework attempts to create the database from within code. The A$LEGAL_ENTITIES.SMTS table cannot add the constraint against the A$PHOTOGRAPHS.PHOTOGRAPHS table until the GRANT REFERENCES command is executed due to the fact that the tables are in different schemas. When I put all the tables into the same schema, then I don't have any problems dropping and re-creating the database.
Code: Select all
ALTER TABLE "A$LEGAL_ENTITIES".SMTS
ADD CONSTRAINT "FK_SMT_Photo" FOREIGN KEY (PHOTO_ID) REFERENCES "A$PHOTOGRAPHS".PHOTOGRAPHS (ID)
However, after I execute the command:
Code: Select all
GRANT REFERENCES ON A$PHOTOGRAPHS.PHOTOGRAPHS TO A$LEGAL_ENTITIES;
This is the same behaviour that is happening when Entity Framework attempts to create the database from within code. The A$LEGAL_ENTITIES.SMTS table cannot add the constraint against the A$PHOTOGRAPHS.PHOTOGRAPHS table until the GRANT REFERENCES command is executed due to the fact that the tables are in different schemas. When I put all the tables into the same schema, then I don't have any problems dropping and re-creating the database.
New build of dotConnect for Oracle 6.50.237 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=22379 .
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=22379 .