代码之家  ›  专栏  ›  技术社区  ›  Joe R.

SE:'bcheck-y'异常

  •  1
  • Joe R.  · 技术社区  · 14 年前

    我的应用程序有以下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;
    
    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.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字节,这听起来是正确的大小,所以我回到“Perform”,重复以前的测试,没有遇到任何问题。出于好奇,我再次对它运行bcheck,它重复了与我运行的第一次bcheck相同的结果!。。就像第一次检查没能把桌子修好一样!。。有人知道为什么bcheck再次修复了本该“修复”的东西吗?。。这和聚类索引有关吗?

    2 回复  |  直到 14 年前
        1
  •  0
  •   vpit3833    14 年前

    我几年前就和Informix合作过,但最近没有。你试过了吗 bcheck 当你只有一个索引的时候? This discussion here B检查

        2
  •  0
  •   Joe R.    14 年前

    为了避免上述问题,我没有创建聚集索引,而是创建了非聚集索引。现在,当我检查所有表时,它们看起来都正常,但我需要聚集索引!。。在isql中对sql脚本中的所有数据文件运行bcheck>查询语言>在SE引擎运行且目录文件打开时,以sysmenuitems menuscript选项运行或?。。以前,我在卸载引擎时从操作系统提示符对所有.DAT文件(包括系统目录)运行bcheck。