您好,登錄后才能下訂單哦!
db2 "SELECT substr(TABNAME,1,30) as TAB_NAME, STATUS, ACCESS_MODE, substr(CONST_CHECKED,1,1) as FK_CHECKED,
substr(CONST_CHECKED,2,1) as CC_CHECKED
FROM SYSCAT.TABLES WHERE STATUS = 'C'"
如果回顯中有結(jié)果,說明有表沒有完成完整性檢查。通常是因為有LOAD操作造成的。
這個時候用一個小工具就可以完成自動的檢查:
setIdentify.sh
db2 connect to $1
db2 -tx +w "with gen(tabname, seq) as( select rtrim(tabschema) || '.' || rtrim(tabname)
as tabname, row_number() over (partition by status) as seq
from syscat.tables
WHERE status='C' ),r(a, seq1) as (select CAST(tabname as VARCHAR(3900)), seq
from gen where seq=1 union all select r.a || ','|| rtrim(gen.tabname), gen.seq
from gen , r where (r.seq1+1)=gen.seq ), r1 as (select a, seq1 from r)
select 'SET INTEGRITY FOR ' || a || ' IMMEDIATE CHECKED;' from r1
where seq1=(select max(seq1) from r1)" > db2FixCheckPending.sql
db2 -tvf db2FixCheckPending.sql
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。