SQL0575N; SQLSTATE 51024; DB2 database View marked inoperative in NCIM
Cannot access DB2 database VIEW called NCIM.INTERFACES although
the DB2 database TABLE called NCIM.INTERFACE is accessible.
db2 => select * from ncim.interfaces
SQL0575N View or materialized query table "NCIM.INTERFACES" cannot be used because it has been marked inoperative. SQLSTATE=51024
DB2 NCIM database
Diagnosing the problem
Check to see if OTHER database views are inoperative as well ...
Use the SQL command below.
[db2inst1@redhat4 ~]$ db2 "select viewschema,viewname,valid from syscat.views where viewschema like 'NC%' and valid <> 'Y'"
If the database column valid = "Y", the view is OPERATIVE, but if the
database column valid is "X" or "N" or any other value, the database
view is INOPERATIVE.
The following command will tell us WHO has ACCESS / PRIVILEGES for
the NCIM.INTERFACES database VIEW, as an example.
[db2inst1@redhat4 ~]$ db2 "select definer from syscat.views where viewschema='NCIM' and viewname='INTERFACES'"
Try accessing the SAME database view as the definer userid reported from
the command above to see if the INOPERATIVE error still occurs for the
definer as well ..
Resolving the problem
The following statement is extracted from DB2 documentation:
"When a CREATE VIEW statement is executed that creates a VIEW with the
same schema name and view name as an existing inoperative view, the new
view replaces the inoperative view. ..Since all privileges held on a view are
revoked when a view becomes inoperative, the definer of the view must
grant these privileges again after recreating the inoperative view."
So, CREATE the VIEW again from the commands located in the database
creation script and then GRANT privileges to the VIEW as appropriate.
This should restore the VIEW to OPERATIVE.