以下描述的两种Load 操作后的堆表的状态是在归档模式下使用Copy选项情况下模拟出来的,也是Load 操作后常见的两种状态。
在进行跨库迁移时(见代码1),如果日志已满或者操作被中断,该表都将被置为Load Pending状态。
代码1:
Load from test1.del of del insert into test1 COPY YES TO /dev/null |
可以通过以下两个命令获取其状态:
命令1
Load query table test1 |
命令2
select load_status from sysibmadm.admintabinfo where (tabschema,tabname)=('SCOTT','TEST1') |
在代码1的执行过程中强行中断,该表就会被置为加载挂起(Load Pending)状态。出现这种问题常用的解决方法有两种,一种是中断(terminate)该操作,另一种是重新开始(restart)该操作。演示使用的是第一种方法:
Load from /dev/null of null terminate into test1 |
可以用以上两种方法验证。
2. Set Integrity Pending
Load操作并不会检查目标完整性约束条件,因此,对于凡是含有完整性约束条件的目标表,Load操作执行后都会将此表的状态置为Set Integrity Pending,此时,对该表的增、删、改操作都将被限制,但是,如果Load操作指定了Allow Read Access ,可以对该表进行查询操作。
有两种方式可以获取此状态:
为了测试,我们为测试表test1增加约束条件:
alter table test1 add constraint max_salary check (salary>10000) |
测试之前,我们先要观察该表是否处于正常(normal)状态。同样有两种方法可以检查其状态。
方法一:Load Query
Load Query table test1 |
方法二:查询syscat.tables
select status from syscat.tables where (tabschema,tabname)=('SCOTT','TEST1') |
然后,向该表LOAD数据。
Load from /dev/null of del insert into test1 |
通过使用load query 可以发现该表处于set integrity pending状态。
可以通过如下命令将此表置为Normal状态:
set integrity for test1 immediate checked |
总结:
Load操作后,被操作表的状态除了以上两种,还有Load in Process,Not Load Restartable,Read Access Only,Unavailable,Normal 五种,除了Normal和Read Access Only外,其他三种不常见,因此不做重点分析。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25935119/viewspace-734102/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25935119/viewspace-734102/