I've been chasing this issue for a while now with no success. Whenever my app starts there's a chance that the first query hitting the database will cause an ORA-00933. This always happens at the very first query hitting the database. I've traced the command text with TraceLevel, the following command is issued:
SELECT 1 AS "C1", "Extent1"."SOME_FIELD"
FROM "SOME"."TABLE" "Extent1"
WHERE ("Extent1"."SOME_FIELD" IS NOT NULL)
WHERE (ROWNUM <= (1) )
which is obviously malformed. My linq query does not contain any FirstOrDefault() or similar calls, it's a simple db.Table.Where(...) query. The last WHERE clause should not be there at all. What really puzzles me is this behavior is non-deterministic. The very same application with the very same binaries and configuration in the very same environment sometimes produces the correct query sometimes not. This always happens at app startup, it is consistent for the lifetime of the app (which is usually restarted every morning due to the inactivity timeout). If the malfunction occurs an app pool restart usually does not but a full IIS restart (without OS restart) usually does fix the issue even if only temporarily. The app runs in its own private app pool so despite having multiple ODAC versions on the system I have verified that only the specific provider gets loaded into the app process (either Oracle.Managed or the unmanaged Instant Client). Sometimes there's no error for days, sometimes I have to take action every morning, and I haven't been able to find a reliable repro. I'm having the same issue with both the managed and the unmanaged provider. Do you have any advice on how to proceed from here?