Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oracle - Zombie Table

I'm having this odd problem since yesterday. I've tried several options and I actually reinstalled ORACLE and the DB itself.

Here's the problem: I have this table that is somekind of zombie. Here are the symptoms:

SELECT TABLE_NAME FROM USER_TABLES WHERE TABLE_NAME='MYTABLE'

Returns a record, meaning that the table exists.

SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME = 'MYTABLE'

Returns all the columns of MYTABLE. So far so good, the table exists.

SELECT * FROM MYTABLE

Returns ORA-00942: table or view does not exist. At this point I'm quite confused: the table seems to exist on the USERTABLES but I cannot SELECT over it?

CREATE TABLE MYTABLE (Foo NUMBER) TABLESPACE MYTABLESPACE

Returns: ORA-00604: error occurred at recursive SQL level 1 ORA-00001: unique constraint (SYS.I_OBJ2) violated

I do not understand this error. But the best is yet to come.

SELECT * FROM MYTABLE

Surprisingly, the above query (an exact copy of the 3rd query) returns several records now! Moreover, I noticed that the column Foo is not present: the table I now see is my initial table that had other columns.

DROP TABLE MYTABLE

I now try to drop the table and I get the following errors:

ORA-00604: error occurred at recursive SQL level 1 ORA-00942: table or view does not exist ORA-06512: at line 19

SELECT * FROM MYTABLE

More confused than ever, I try the above query and, surprise surprise, the table no longer exists.

I don't undestand this: the table is on USERTABLES but I cannot SELECT over it, however, if I create a new table with the same name, I get an error but now I can SELECT over the previous version of that table with several records.

Any thoughts ? I really need your help :(

EDIT - I checked now: I'm unable to drop ANY table. This might just be a new symptom.

Solution

The problem was that MDSYS.SDO_GEOR_SYSDATA_TABLE table was missing and a drop event trigger was trying to access it, generating the error. The solution was restoring that table.

like image 836
jpaires Avatar asked Nov 05 '22 03:11

jpaires


1 Answers

If have privileges, try this query:

SELECT *
  FROM dba_objects
 WHERE object_name = 'MYTABLE';

And see what objects exist with that name. It might point you in the right direction.

like image 118
DCookie Avatar answered Nov 07 '22 22:11

DCookie