數據庫中必須有一些其他對象,如觸發器或視圖,它們引用了已刪除的表。當DB2被引用時,DB2會嘗試重新驗證該對象。如果您追蹤持久性框架生成的確切SQL語句,您可能會更好地瞭解發生了什麼。
如果由於某種原因,你不能要求你的DB2,找出有問題的對象,你可以試試這個查詢查找其他對象仍取決於缺少的表:
with t(s,n) as (values ('YOURSCHEMA','YOURTABLE'))
select 'control' as object_type,
dschema as schema,
dname as name,
case dtype when 'y' then 'row permission' when '2' then 'column mask' else 'unknown' end as depend_type
from syscat.controldep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'datatype' as object_type,
typeschema as schema,
typename as name,
case when typemodulename is not null then 'in module '|| typemodulename else '' end as depend_type
from syscat.datatypedep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'index' as object_type,
indschema as schema,
indname as name,
'' as depend_type
from syscat.indexdep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'package' as object_type,
pkgschema as schema,
pkgname as name,
'' as depend_type
from syscat.packagedep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'routine' as object_type,
routineschema as schema,
specificname as name,
case when routinemodulename is not null then 'in module '|| routinemodulename else '' end as depend_type
from syscat.routinedep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'table-ish' as object_type,
tabschema as schema,
tabname as name,
case dtype when 'S' then 'MQT'
when 'T' then 'staging table'
when 'V' then 'view'
when '7' then 'synopsis table'
else dtype end as depend_type
from syscat.tabdep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'trigger' as object_type,
trigschema as schema,
trigname as name,
'' as depend_type
from syscat.trigdep join t on btype = 'T' and (bschema,bname) = (s,n)
union all
select 'global var' as object_type,
varschema as schema,
varname as name,
case when varmodulename is not null then 'in module '|| varmodulename else '' end as depend_type
from syscat.variabledep join t on btype = 'T' and (bschema,bname) = (s,n)