DB2 SQL1477N问题

时间:2023-03-09 19:44:47
DB2 SQL1477N问题

ERROR [55019] [IBM][DB2/NT] SQL1477N  For table "DB_YHJX.YHJX_FHDKFHZ" an object "521" in table space "3" cannot be accessed.  SQLSTATE=55019
SQL1477N  对于表 "<表名>",不能访问表空间 "<表空间标识>" 中的对象 "<对象标识>"。
说明:
试图访问一个表,而该表的其中一个对象是不可访问的。由于下列原因之一,该表可能不可访问:
1.当回滚工作单元时,该表激活了 NOT LOGGED INITIALLY。
2.该表是一个已创建的分区临时表或者已声明的分区临时表,由于已声明此临时表或者已将它实例化,因此一个或多个数据库分区失败。
3.ROLLFORWARD 在此表上遇到了 NOT LOGGED INITIALLY 激活,或者遇到了NONRECOVERABLE 装入。
不允许访问此表,因为不能保证其完整性。
是不是你的存储过程里 有将表清空的语句类似于
ALTER TABLE  表名 ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE

I got a call from a lication team yesterday
that many tables are "can not be acceed" all of sudden.

SQL1477N  Table "RI_ A_T1" ca ot be acceed.  SQLSTATE=55019
SQL1477N  Table "RI_ L_T2" ca ot be acceed.  SQLSTATE=55019
SQL1477N  Table "RI_ T_T3" ca ot be acceed.  SQLSTATE=55019
SQL1477N  Table "RI_PTC_T4" ca ot be acceed.  SQLSTATE=55019

After talking to the developer, he coded some tables with "not logged initially" hope to get better performance,
somehow a job did not complete succe fully and caused many tables in-co istent state.

It mea  that whenever you i ue ALTER TABLE ... ACTIVATE NOT LOGGED INITIALLY then everything between that and the next commit is not logged.
If you encounter a rollback/failure, as you recover the table is marked inacce ible and you ca ot recover it.
Your only option is "DROP" and then "CREATE"  those in question tables again.

Holly smoke! I understand now why those IBM guys brag db2 is so superior than Oracle --
(UDB software lab is in Toronto, got lucky talk to those db2 developers/managers face to face). 
Fortunately, db2 dba is only my secondary job.  How do you guys feel?  Look at those Oracle forums so red and hot.

总结:NOT LOGGED INITIALLY慎用,中途失败将导致表要被删除重建。