如何刪除IQ資料庫中損壞的表

2021-08-31 22:03:26 字數 1399 閱讀 3888

**

由於某種原因,iq資料庫中的表出現損壞不能訪問,並且可能使用drop table語句也不能把它刪除。對於這樣的表,當我們訪問它時iq會報如下錯誤:

asa error -1009039: main bufman: incorrect page header read; buffer= page=.

-- (s_buf.cxx 1140)

msg: 21, level: 14, state: 0 line: 0

當發生這樣的問題,我們打算刪除損壞的表時該如何操作呢?下面介紹一下具體的方法和步驟(適用於iq 12.6和iq 12.7):

(1) 重啟伺服器

start_asiq -n bad_db_server -x 'tcpip' -gm 1 -gd dba bad_db.db

在這個命令列中,-gm 1僅僅允許乙個使用者做連線,-gd只允許dba訪問。當強制刪除物件時,必須禁止其他使用者連線。

說明:bad_db_server即出現損壞的iq server,其名稱為.cfg檔案中-n引數指定的引擎名

bad_db.db即出現損壞iq資料庫的catalog db名稱

(2) 開啟臨時選項force_drop為on:

set temporary option force_drop = 'on'

(3) 刪除所有不一致物件

使用drop table損壞的表。在重新啟動伺服器之前不要執行任何其他的ddl或者dml命令。

(4) 重新啟動伺服器

可以用-iqdroplks選項重新啟動伺服器,以恢復洩露的空間並把分配對映圖(allocation map)修改到正確狀態。

start_asiq -n bad_db_server -x 'tcpip' -iqdroplks bad_db bad_db.db

您需要指定兩次資料庫名稱,前者是-iqdroplks選項使用的,後者指定您要啟動的資料庫。

(5) 執行sp_iqcheckdb

sp_iqcheckdb 'allocation database'。

這個步驟用計算出來的分配對映圖重新設定資料庫分配對映表。

如果上面的儲存過程執行沒有錯誤出現,它將顯示「freelist updated」資訊,表明已經完成洩露空(leaked space)間的恢復

(6) 發出乙個checkpoint

即執行checkpoint語句

(7) 使用通用方式停止伺服器

(8) 使用正常方式啟動伺服器,啟動後即可進行正常操作。

我的解決方法:

(2) 開啟臨時選項force_drop為on:

set temporary option force_drop = 'on'

然後把錶重建 ,記得資料如果能恢復照樣恢復,不行的話就重建了

資料庫表損壞的修復

用命令列訪問出現 開始時使用myisamchk r o home test test user.myi進行修復,出現錯誤 myisamchk error myisam sort buffer size is too small。df發現是mysql temp目錄太小,此錶太大。更改my.cnf檔案修...

資料庫表損壞的修復

load dbd mysql st execute failed table test test user is marked as crashed and last automatic?repair failed at usr local share perl 5.10.0 rose db obj...

資料庫中刪除表的操作

truncate table truncate是sql中的乙個刪除資料表內容的語句,用法是 truncate table table name truncate table 表名 速度快,而且效率高,因為 truncate table 在功能上與不帶 where 子句的 delete 語句相同 二者...