2010-08-03 13 views
1

ISQL-SE 4.10.DD6(DOS 6.22):SE: '使用bcheck -y' 異常

我的應用程序有以下SQL腳本(代碼複查),其中我的用戶EXEC在工作日結束時REORG交易表:

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 

所以B檢查後,現在其大小.IDX增加至122561個字節,這聽起來是正確的大小,所以我又回到了「執行「,重複以前的測試,沒有遇到任何問題。出於好奇,我再次運行了bcheck,它重複了我運行的第一個bcheck的相同結果!就像第一個bcheck從未修復過表一樣!任何人都知道爲什麼bcheck再次修復了應該已經是「修復「?它可能與羣集索引有關嗎?

回答

0

所以爲了規避上面提到的問題,我沒有創建聚簇索引,而是創建了非聚簇索引。現在當我檢查它們時,所有的表都可以正常工作,但是我需要聚簇索引!是在isql> query-language> run或者作爲一個sql腳本的所有數據文件中運行bcheck的好主意sysmenuitems menuscript選項,而SE引擎正在運行並且目錄文件已打開?..之前,我在卸載引擎時從操作系統提示符運行了所有.DAT文件(包括系統目錄)的bcheck。

0

幾年前我和Informix一起工作過,但最近沒有。你有沒有試過bcheck當你只有一個索引? This discussion和另一個here讓我覺得bcheck一次修復了一個(損壞的?)索引。我希望這有幫助。