国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

InnoDB 中文參考手冊 --- 15 故障檢測與修復

2024-07-21 02:08:54
字體:
來源:轉載
供稿:網友
中國最大的web開發資源網站及技術社區,
innodb 中文參考手冊 --- 犬犬(心帆)翻譯 15 故障檢測與修復 一個普遍的規則就是當一個操作挫敗或你懷疑是一個 bug,你必須查看 mysql 服務程序 mysqld 的錯誤日志(error log),通常命名為 'hostname'.err,或 windows 下的 mysql.err。 當進行故障檢測并修復時,在命令提示符下運行 mysql 服務程序 mysqld 是一個較好的方式,不要通過 safe_mysqld 的包裝(wrapper)或以 windows 服務啟動。你可以看到 mysqld 在命令提示符窗口上的顯示,而可以更好地把握什么將要發生。在 windows 下,你必須以 --console 選項運行 mysqld-max 來使輸出直接顯示在 ms-dos 提示符窗口上。 如果問題與性能有關(performance-related),或你的服務看起來將要掛起,你可以使用 innodb_monitor 來顯示 innodb 內部狀態的相關信息。如果問題是由于鎖定引起,使用 innodb_lock_monitor。如果問題是在建表時或其它的數據字典操作,使用 innodb_table_monitor 顯示 innodb 內部數據字典的內容。 如果你懷疑表已損壞,在表上運行 check table 。15.1 發現并修復數據字典錯誤的操作
一個特殊的有關表的問題就是 mysql 在它自己的數據目錄下的 .frm 文件中保存它自己的數據字典信息,然而 innodb 將它自己的信息保存在數據文件中 innodb 自己的數據字典中。如果你在外部移走了 .frm 文件,或在 mysql < 3.23.44 的版本中使用了 drop database ,或在數據字典操作時服務器崩潰了,那么 .frm 文件可能會因與 innodb 內部的數據字典 out-of-sync 而結束。

與數據字典 out-of-sync 的一個故障現象就是 create table 語句的調用失敗。那么你必須查看錯誤日志。如果錯誤述說為表在 innodb 內部數據字典中已存在,那么一定在 innodb 的數據文件中存在一個孤表(orphaned table),沒有相對應的 .frm 文件。
innodb: error: table test/parent already exists in innodb internal innodb: data dictionary. have you deleted the .frm file innodb: and not used drop table? have you used drop database innodb: for innodb tables in mysql version <= 3.23.43? innodb: see the restrictions section of the innodb manual. innodb: you can drop the orphaned table inside innodb by innodb: creating an innodb table with the same name in another innodb: database and moving the .frm file to the current database. innodb: then mysql thinks the table exists, and drop table will innodb: succeed.
你可以跟從上面錯誤日志中的提示移除(drop)孤表(orphaned table)。
 

另一個與數據字典 out-of-sync 的故障現象就是 mysql 提示不能打開一個文件 yourtablename.innodb 的錯誤。
error 1016: can't open file: 'child2.innodb'. (errno: 1)
在錯誤日志中可以發現:
innodb: cannot find table test/child2 from the internal data dictionary innodb: of innodb though the .frm file for the table exists. maybe you innodb: have deleted and recreated innodb data files but have forgotten innodb: to delete the corresponding .frm files of innodb tables?
意思就是有一個孤的(orphaned) .frm 文件,在 innodb 中沒有相應的表與之對應。可以通過手工刪除 .frm 文件來移除它。
 

如果在一個 alter table 操作時 mysql 崩潰了,你可能會因在 innodb 表空間在存在一個孤的臨時表而告終。通過 innodb_table_monitor ,你可以發現一個名為 #sql... 的表,但是 mysql 不允許訪問任何一個如此命名的表,你將不能轉儲(dump)或移除(drop)它。解決辦法就是使用從 3.23.48 開始 innodb 支持的一個特殊的機制。

如果在表空間內存在一個孤表(orphaned table) #sql... ,那么調用
create table `rsql..._recover_innodb_tmp_table`(...) type = innodb;

使表定義與臨時表相似,你可以使 innodb 將孤表重命名為 `rsql..._recover_innodb_tmp_table`。那么你就可以轉儲或移除重命名后的表了。 表名中的反引號是必須的,因為臨時表命名中包含字符 '-'。

 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南京市| 乃东县| 阜新市| 大新县| 株洲县| 大姚县| 嘉祥县| 旌德县| 金门县| 嫩江县| 澄城县| 琼中| 和平县| 海阳市| 随州市| 汉中市| 曲沃县| 灯塔市| 昆明市| 深圳市| 晋江市| 安庆市| 灵寿县| 深泽县| 丰城市| 白水县| 兴和县| 玉田县| 新野县| 中方县| 印江| 东港市| 汕尾市| 尤溪县| 佳木斯市| 双城市| 兴仁县| 肇源县| 佛山市| 灵川县| 灵川县|