Принудительное восстановление InnoDB: различия между версиями

Материал из Wiki МИАЦ ВО
Перейти к навигации Перейти к поиску
(Новая: Статья взята [http://dev.mysql.com/doc/refman/4.1/en/forcing-recovery.html Forcing InnoDB Recovery] If there is database page corruption, you may want to dump your tables fro...)
 
 
(не показано 18 промежуточных версий 3 участников)
Строка 1: Строка 1:
 
Статья взята [http://dev.mysql.com/doc/refman/4.1/en/forcing-recovery.html Forcing InnoDB Recovery]
 
Статья взята [http://dev.mysql.com/doc/refman/4.1/en/forcing-recovery.html Forcing InnoDB Recovery]
 +
*Попробовал сделать перевод, но что то плохо у меня это получается (плохой их меня переводчик), так что оставил оригинальный текст, если кто то поможет с переводом - буду очень рад.<br>
 +
==Редактируем my.ini (my.cfg)==
 +
В блок [mysqld] вставляем строку с innodb_force_recovery.
 +
<pre>[mysqld]
 +
innodb_force_recovery=1</pre>
 +
Описание значений этого параметра дано ниже.
  
If there is database page corruption, you may want to dump your tables from the database with SELECT INTO OUTFILE. Usually, most of the data obtained in this way is intact. Even so, the corruption may cause SELECT * FROM tbl_name statements or InnoDB background operations to crash or assert, or even to cause InnoDB roll-forward recovery to crash. Starting from MySQL 3.23.44, there is an InnoDB variable that you can use to force the InnoDB storage engine to start up, and you can also prevent background operations from running, so that you are able to dump your tables. For example, you can add the following line to the [mysqld] section of your option file before restarting the server:
+
===1 SRV_FORCE_IGNORE_CORRUPT (Игнорировать повреждения)===
<pre>[mysqld]
+
 
innodb_force_recovery = 4</pre>
+
Позволяет запустить сервер, даже если обнаружаться повреждения базы. Пытаясь сделать '''SELECT * FROM tbl_name''', что бы перескочить через поврежденные индексные записи и страницы, что помогает сделать дамп таблиц.
  
Before MySQL 4.0, use this syntax instead:
+
Let the server run even if it detects a corrupt page. Try to make '''SELECT * FROM tbl_name''' jump over corrupt index records and pages, which helps in dumping tables.
<pre>[mysqld]
 
set-variable = innodb_force_recovery=4</pre>
 
  
The allowable non-zero values for '''innodb_force_recovery''' follow. A larger number includes all precautions of smaller numbers. If you are able to dump your tables with an option value of at most 4, then you are relatively safe that only some data on corrupt individual pages is lost. A value of 6 is more drastic because database pages are left in an obsolete state, which in turn may introduce more corruption into B-trees and other database structures.
+
===2 SRV_FORCE_NO_BACKGROUND (Запретить теневые процессы)===
  
'''1 (SRV_FORCE_IGNORE_CORRUPT)'''
 
  
Let the server run even if it detects a corrupt page. Try to make '''SELECT * FROM tbl_name''' jump over corrupt index records and pages, which helps in dumping tables.  
+
Предотвращает запуск основного подпроцесса. Если сбой произошел во время процесса восстановления, это значение параметра предотвратит это.
  
'''2 (SRV_FORCE_NO_BACKGROUND)'''
+
Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.
  
Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.
+
===3 (SRV_FORCE_NO_TRX_UNDO)===
  
'''3 (SRV_FORCE_NO_TRX_UNDO)'''
+
Не запускать процесс отката транзакций после восстановления
  
 
Do not run transaction rollbacks after recovery.  
 
Do not run transaction rollbacks after recovery.  
  
'''4 (SRV_FORCE_NO_IBUF_MERGE)'''
+
===4 (SRV_FORCE_NO_IBUF_MERGE)===
 +
 
 +
Запретить также выполнение insert buffer merge операций. Если они приведут к разрушению, то не делайте их. Не выполняйте подсчет статистики таблиц.
  
 
Prevent also insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.  
 
Prevent also insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.  
  
'''5 (SRV_FORCE_NO_UNDO_LOG_SCAN)'''
+
===5 (SRV_FORCE_NO_UNDO_LOG_SCAN)===
 +
Не смотреть на логи восстановления, при старте базы данных: '''InnoDB''' считает даже незавершенные до выключения транзакции как завершенные.
  
Do not look at undo logs when starting the database: '''InnoDB''' treats even incomplete transactions as committed.  
+
Do not look at undo logs when starting the database: '''InnoDB''' treats even incomplete transactions as committed.
  
'''6 (SRV_FORCE_NO_LOG_REDO)'''
+
===6 (SRV_FORCE_NO_LOG_REDO)===
  
 
Do not do the log roll-forward in connection with recovery.  
 
Do not do the log roll-forward in connection with recovery.  
Строка 37: Строка 43:
 
Starting from MySQL 3.23.53 and 4.0.4, you can '''SELECT''' from tables to dump them, or '''DROP''' or '''CREATE''' a table even if forced recovery is used. If you know that a certain table is causing a crash in rollback, you can drop it. You can use this also to stop a runaway rollback caused by a failing mass import or '''ALTER TABLE'''. You can kill the '''mysqld''' process and '''set innodb_force_recovery''' to '''3''' to bring the database up without the rollback, then '''DROP''' the table that is causing the runaway rollback.  
 
Starting from MySQL 3.23.53 and 4.0.4, you can '''SELECT''' from tables to dump them, or '''DROP''' or '''CREATE''' a table even if forced recovery is used. If you know that a certain table is causing a crash in rollback, you can drop it. You can use this also to stop a runaway rollback caused by a failing mass import or '''ALTER TABLE'''. You can kill the '''mysqld''' process and '''set innodb_force_recovery''' to '''3''' to bring the database up without the rollback, then '''DROP''' the table that is causing the runaway rollback.  
  
''The database must not otherwise be used with any non-zero value of '''innodb_force_recovery'''''. As a safety measure, InnoDB prevents users from performing '''INSERT, UPDATE''', or '''DELETE''' operations when '''innodb_force_recovery''' is greater than 0.
+
''В обычных условиях база данных не должна использоваться при параметре '''innodb_force_recovery''', отличном от нуля''. Как защитная мера, InnoDB не дает пользователям выполнять команды '''INSERT, UPDATE''', или '''DELETE''', когда '''innodb_force_recovery''' больше 0.
 +
 
 +
''The database must not otherwise be used with any non-zero value of '''innodb_force_recovery'''''. As a safety measure, InnoDB prevents users from performing '''INSERT, UPDATE''', or '''DELETE''' operations when '''innodb_force_recovery''' is greater than 0.

Текущая версия на 08:52, 20 октября 2016

Статья взята Forcing InnoDB Recovery

  • Попробовал сделать перевод, но что то плохо у меня это получается (плохой их меня переводчик), так что оставил оригинальный текст, если кто то поможет с переводом - буду очень рад.

Редактируем my.ini (my.cfg)

В блок [mysqld] вставляем строку с innodb_force_recovery.

[mysqld]
innodb_force_recovery=1

Описание значений этого параметра дано ниже.

1 SRV_FORCE_IGNORE_CORRUPT (Игнорировать повреждения)

Позволяет запустить сервер, даже если обнаружаться повреждения базы. Пытаясь сделать SELECT * FROM tbl_name, что бы перескочить через поврежденные индексные записи и страницы, что помогает сделать дамп таблиц.

Let the server run even if it detects a corrupt page. Try to make SELECT * FROM tbl_name jump over corrupt index records and pages, which helps in dumping tables.

2 SRV_FORCE_NO_BACKGROUND (Запретить теневые процессы)

Предотвращает запуск основного подпроцесса. Если сбой произошел во время процесса восстановления, это значение параметра предотвратит это.

Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.

3 (SRV_FORCE_NO_TRX_UNDO)

Не запускать процесс отката транзакций после восстановления

Do not run transaction rollbacks after recovery.

4 (SRV_FORCE_NO_IBUF_MERGE)

Запретить также выполнение insert buffer merge операций. Если они приведут к разрушению, то не делайте их. Не выполняйте подсчет статистики таблиц.

Prevent also insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.

5 (SRV_FORCE_NO_UNDO_LOG_SCAN)

Не смотреть на логи восстановления, при старте базы данных: InnoDB считает даже незавершенные до выключения транзакции как завершенные.

Do not look at undo logs when starting the database: InnoDB treats even incomplete transactions as committed.

6 (SRV_FORCE_NO_LOG_REDO)

Do not do the log roll-forward in connection with recovery.

Starting from MySQL 3.23.53 and 4.0.4, you can SELECT from tables to dump them, or DROP or CREATE a table even if forced recovery is used. If you know that a certain table is causing a crash in rollback, you can drop it. You can use this also to stop a runaway rollback caused by a failing mass import or ALTER TABLE. You can kill the mysqld process and set innodb_force_recovery to 3 to bring the database up without the rollback, then DROP the table that is causing the runaway rollback.

В обычных условиях база данных не должна использоваться при параметре innodb_force_recovery, отличном от нуля. Как защитная мера, InnoDB не дает пользователям выполнять команды INSERT, UPDATE, или DELETE, когда innodb_force_recovery больше 0.

The database must not otherwise be used with any non-zero value of innodb_force_recovery. As a safety measure, InnoDB prevents users from performing INSERT, UPDATE, or DELETE operations when innodb_force_recovery is greater than 0.