使用db2 load from时导致DB的tablespace置成backup pending状态 我在往表里面更新或者插入新的数据有报错,有报SQL0290N这个错误,Table space access is not allowed. SQLSTATE=55039 但是这个时候可以往里面load数据,我的命令是这样写的 $db2 load from /worktmp/temp.del of del replace into SCHEMA.TABLENAME 于是搜了很多东西,有人告诉我使用下面命令看看State的值是什么 $db2 list tablespaces show detail Tablespace ID = 4 Name = TBS4K Type = Database managed space Contents = Any data State = 0x0020 Detailed explanation: Backup pending Total pages = 8388608 Useable pages = 8388096 Used pages = 340864 Free pages = 8047232 High water mark (pages) = 340864 Page size (bytes) = 4096 Extent size (pages) = 128 Prefetch size (pages) = 384 Number of containers = 4 Minimum recovery time = 2008-10-14-05.51.17.000000 Tablespace ID = 5 Name = TBS4KM Type = Database managed space Contents = Any data State = 0x0000 Detailed explanation: Normal Total pages = 8388608 Useable pages = 8388096 Used pages = 4224 Free pages = 8383872 High water mark (pages) = 4224 Page size (bytes) = 4096 Extent size (pages) = 128 Prefetch size (pages) = 384 Number of containers = 4 Minimum recovery time = 2008-10-23-07.30.01.000000 于是再搜,看看tablespace backup pending是怎么回事!便找到下面这个,
1. 已知载入的输入文件 staff_data.del 具有以下内容: 11,"Melnyk",20,"Sales",10,70000,15000: update db cfg for sample using logretain recovery; backup db sample; connect to sample; load from staff_data.del of del messages load.msg insert into staff copy no; update staff set salary = 69000 where id = 11;
2.update db cfg for sample using logretain recovery; connect to sample; 上面提到“在使用该表空间之前,必须备份该表空间(或者是整个数据库)” 于是我先把整个数据库备份了一下,再查看tablespace状态时,都是Normal的,再次更新或者往表里面插入数据时一切正常。 这个时候我想起我下的db2 load的命令,以往都是在最后面加了NONRECOVERABLE这个参数,这次没有,问题肯定在这里。