Sql SE:';b检查-y';异常
ISQL-SE 4.10.DD6(DOS 6.22): 我的应用程序具有以下SQL脚本(代码检查),我的用户在工作日结束时执行该脚本以重新设置事务表:Sql SE:';b检查-y';异常,sql,informix,Sql,Informix,ISQL-SE 4.10.DD6(DOS 6.22): 我的应用程序具有以下SQL脚本(代码检查),我的用户在工作日结束时执行该脚本以重新设置事务表: DATABASE dbfiles; UNLOAD TO "U:\UNL\ACTIVES.UNL" SELECT * FROM transaction WHERE trx_type IN ("E","I","C","P") ORDER BY trx_cust_fullname, trx_last_pymt;
DATABASE dbfiles;
UNLOAD TO "U:\UNL\ACTIVES.UNL"
SELECT * FROM transaction
WHERE trx_type IN ("E","I","C","P")
ORDER BY trx_cust_fullname,
trx_last_pymt;
UNLOAD TO "U:\UNL\INACTIVES.UNL"
SELECT * FROM transaction
WHERE trx_type IN ("F","R","T","X","V")
ORDER BY trx_cust_fullname,
trx_last_pymt DESC;
DROP TABLE transaction;
CREATE TABLE transaction
(
trx_store CHAR(2),
trx_cust_fullname CHAR(30),
trx_type CHAR(1),
trx_num SERIAL,
[...]
);
LOAD FROM "U:\UNL\ACTIVES.UNL" INSERT INTO transaction;
LOAD FROM "U:\UNL\INACTIVES.UNL" INSERT INTO transaction;
CREATE CLUSTER INDEX custn_idx ON transaction (trx_cust_fullname);
CREATE UNIQUE INDEX trxn_idx ON transaction (trx_num);
[3 more indexes...]
UPDATE STATISTICS FOR transaction;
运行此脚本后:TRANS103.DAT大小为882832字节,但
TRANS103.IDX的大小只有22089字节
虽然这个IDX文件大小在我看来不太好,但我用“执行”屏幕查询了事务表中的所有行,所有1083行都可以显示,更新了一些,添加了一些,删除了一些,没有问题,退出,再次返回,没有遇到任何问题!然后我运行了“bcheck-y TRANS103”,得到了以下结果:
S:\DBFILES.DBS> bcheck –y TRANS103
BCHECK C-ISAM B-tree Checker version 4.10.DD6
C-ISAM File: s:\dbfiles.dbs\trans103
Checking dictionary and file sizes.
Index file node size = 512
Current C-ISAM index file node size = 512
Checking data file records.
Checking indexes and key descriptions.
Index 1 = unique key
0 index node(s) used -- 1 index b-tree level(s) used
Index 2 = duplicates (2,30,0)
42 index node(s) used -- 3 index b-tree level(s) used
Index 3 = unique key (32,5,0)
29 index node(s) used -- 2 index b-tree level(s) used
Index 4 = duplicates (242,4,2)
37 index node(s) used -- 2 index b-tree level(s) used
Index 5 = duplicates (241,1,0)
36 index node(s) used -- 2 index b-tree level(s) used
Index 6 = duplicates (46,4,2)
38 index node(s) used -- 2 index b-tree level(s) used
Checking data record and index node free lists.
ERROR: 177 missing index node pointer(s)
Fix index node free list ? yes
Recreating index node free list.
Recreating index 6.
Recreating index 5.
Recreating index 4.
Recreating index 3.
Recreating index 2.
Recreating index 1.
184 index node(s) used, 177 free -- 1083 data record(s) used, 0 free
所以在bcheck之后,现在它的.IDX大小增加到了122561字节,这听起来是正确的大小,所以我回到了“执行”,重复了以前的测试,没有遇到任何问题。出于好奇,我再次运行了bcheck,它重复了我运行的第一次bcheck的相同结果!。。就像第一次检查没有修复表一样!。。有人知道为什么bcheck再次修复了本来应该“修复”的东西吗?。。这可能与集群索引有关吗 我几年前就与Informix合作过,但不是最近。当表上只有一个索引时,您是否尝试过对其进行检查?另一个让我觉得
bcheck
一次修复一个(坏的?)索引。我希望这会有所帮助。因此,为了避免上述问题,我没有创建聚集索引,而是创建了非聚集索引。现在,当我检查所有表时,它们看起来都正常,但我需要聚集索引!。。在SE引擎运行且目录文件打开时,从sql脚本中以isql>查询语言>运行或作为sysmenuitems menuscript选项对所有数据文件运行bcheck是一个好主意吗?。。之前,我在卸载引擎时从操作系统提示符对所有.DAT文件(包括系统目录)运行bcheck