ブログ - (1号機) mysqldump: Got error: 145: Table './WEBDB/WEBDB__session' is marked as crashed and should be repaired when using LOCK TABLES
(1号機) mysqldump: Got error: 145: Table './WEBDB/WEBDB__session' is marked as crashed and should be repaired when using LOCK TABLES
- ブロガー :
- ujpblog 2025/2/4 13:37
crontabで定期実行しているMySQLのバックアップが失敗している.失敗というかダンプファイルが肥大化しでディスクフルになった...
手動で実行してみたら,こんなエラーだった.
これはWebアクセスのセッションテーブルが壊れている模様.DDoS攻撃を受けた結果,被害が出たと推察.
まずは壊れたテーブルを確認.
haven't closed the table properly(適切に閉じてない).delete-link-chainが壊れているとのこと.
delete-link-chainはMyISAMで,削除されたレコードを管理する仕組みで,これが壊れているということになる.
リペアを実行して再度チェックして修復できたことを確認.
手動で実行してみたら,こんなエラーだった.
sh-3.2# DBbackup.sh
mysqldump: Got error: 145: Table './WEBDB/WEBDB__session' is marked as crashed and should be repaired when using LOCK TABLES
sh-3.2#
これはWebアクセスのセッションテーブルが壊れている模様.DDoS攻撃を受けた結果,被害が出たと推察.
まずは壊れたテーブルを確認.
mysql> check table WEBDB__session;🆑
+------------------------+-------+----------+-------------------------------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+------------------------+-------+----------+-------------------------------------------------------------------------------------------+
| WEBDB.WEBDB__session | check | warning | Table is marked as crashed |
| WEBDB.WEBDB__session | check | warning | 13 clients are using or haven't closed the table properly |
| WEBDB.WEBDB__session | check | warning | Size of indexfile is: 913408 Should be: 659456 |
| WEBDB.WEBDB__session | check | error | Invalid key block position: 270216091030151533 key block size: 1024 file_length: 659456 |
| WEBDB.WEBDB__session | check | error | key delete-link-chain corrupted |
| WEBDB.WEBDB__session | check | error | Corrupt |
+------------------------+-------+----------+-------------------------------------------------------------------------------------------+
6 rows in set (2.97 sec)
mysql>
delete-link-chainはMyISAMで,削除されたレコードを管理する仕組みで,これが壊れているということになる.
リペアを実行して再度チェックして修復できたことを確認.
mysql> repair table WEBDB__session;🆑
+------------------------+--------+----------+------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+------------------------+--------+----------+------------------------------------------+
| WEBDB.WEBDB__session | repair | warning | Number of rows changed from 1800 to 1797 |
| WEBDB.WEBDB__session | repair | status | OK |
+------------------------+--------+----------+------------------------------------------+
2 rows in set (0.29 sec)
mysql>
mysql> check table WEBDB__session;🆑
+------------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+------------------------+-------+----------+----------+
| WEBDB.WEBDB__session | check | status | OK |
+------------------------+-------+----------+----------+
1 row in set (0.01 sec)
mysql>