We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a while, we're seeing this error:
ORA-00942: table or view does not exist
Is there a way to find out which table/view(s) ORACLE is talking about ?
I know that I can add extra levels of logging in hibernate which will show all the SQL that it executes on ORACLE and then run that SQL to figure out which TABLE/VIEW is missing or missing permission. But given that it is in TESTING/STAGING, that will slow down performance.
Is there a simple way to narrow down on the Table/View Name ?
UPDATE :
Just so you know, I don't have control over the Oracle DB Server Environment.
I enabled Hibernate tracing/logging and found a VALID SQL. I even put Wireshark(which is a TCP packet filter) to see what hibernate actually sends and that was a valid SQL. So, why would Oracle complain about it once in a while and NOT always.
Please check of the tablespace name is correct if you are facing this issue while importing DB.
I don't think there is a magic bullet here. It may be a missing table, or a misspelled table name in the query. It may be a privilege issue. You can't really tell without executing the query
I suggest you go ahead and instrument your code in such a way that you can turn it on and off. Run it, extract the query, and ship it off to your DBA to resolve.
Take a look into the DBA_AUDIT_EXISTS table, when auditing is turned on for Oracle. I believe that Oracle can provide very detailed auditing which you can simply toggle on and off when you like via DB commands, although I dont remember what they are off the top of my head.
See: http://docs.oracle.com/cd/B19306_01/network.102/b14266/cfgaudit.htm
for some idea (which I just quickly googled for)
You should check the account, which whether has the permit to access the target table.
This is what I do, appologies to whoever this originally came from, I know I took it from some website, but can't remember where right now.
In preproduction, I have this
Any time servererror is thrown, its caught and logged to a table, I can then check that table to find the offending queries, and refund them as needed to see the missing table (when you run the query in sqlplus, it will tell you the table)
Note, yes, there is issues with this, eg, what if caught_errors is dropped, or raises an error itself, you could get recursive loop, hence why this only exists in preproduction.