Пример:
Смотрим текущий используемый движок для таблиц базы db2
root@django:~# mysql -u root -p -e 'select table_schema, table_name, engine from information_schema.tables where table_schema = "db2";'
+--------------+----------------------------+--------+
| table_schema | table_name | engine |
+--------------+----------------------------+--------+
| db2 | auth_group | MyISAM |
| db2 | auth_group_permissions | MyISAM |
| db2 | auth_message | MyISAM |
| db2 | auth_permission | MyISAM |
| db2 | auth_user | MyISAM |
| db2 | auth_user_groups | MyISAM |
| db2 | auth_user_user_permissions | MyISAM |
| db2 | django_admin_log | MyISAM |
| db2 | django_content_type | MyISAM |
| db2 | django_session | MyISAM |
| db2 | django_site | MyISAM |
+--------------+----------------------------+--------+
Переводим на InnoDB
root@django:~# mysql --skip-column-names -u root -ppassword -e 'select concat("alter table ",table_schema,".",table_name," engine=innodb;") from information_schema.tables where table_schema="db2"' | mysql -u root -p
Проверяем результат
root@django:~# mysql -u root -p -e 'select table_schema, table_name, engine from information_schema.tables where table_schema = "db2";'
+--------------+----------------------------+--------+
| table_schema | table_name | engine |
+--------------+----------------------------+--------+
| db2 | auth_group | InnoDB |
| db2 | auth_group_permissions | InnoDB |
| db2 | auth_message | InnoDB |
| db2 | auth_permission | InnoDB |
| db2 | auth_user | InnoDB |
| db2 | auth_user_groups | InnoDB |
| db2 | auth_user_user_permissions | InnoDB |
| db2 | django_admin_log | InnoDB |
| db2 | django_content_type | InnoDB |
| db2 | django_session | InnoDB |
| db2 | django_site | InnoDB |
+--------------+----------------------------+--------+
Соответственно поправив SQL запрос можно будет переключиться и в обратную сторону, т.е. с InnoDB на MyISAM
Смотрим текущий используемый движок для таблиц базы db2
root@django:~# mysql -u root -p -e 'select table_schema, table_name, engine from information_schema.tables where table_schema = "db2";'
+--------------+----------------------------+--------+
| table_schema | table_name | engine |
+--------------+----------------------------+--------+
| db2 | auth_group | MyISAM |
| db2 | auth_group_permissions | MyISAM |
| db2 | auth_message | MyISAM |
| db2 | auth_permission | MyISAM |
| db2 | auth_user | MyISAM |
| db2 | auth_user_groups | MyISAM |
| db2 | auth_user_user_permissions | MyISAM |
| db2 | django_admin_log | MyISAM |
| db2 | django_content_type | MyISAM |
| db2 | django_session | MyISAM |
| db2 | django_site | MyISAM |
+--------------+----------------------------+--------+
Переводим на InnoDB
root@django:~# mysql --skip-column-names -u root -ppassword -e 'select concat("alter table ",table_schema,".",table_name," engine=innodb;") from information_schema.tables where table_schema="db2"' | mysql -u root -p
Проверяем результат
root@django:~# mysql -u root -p -e 'select table_schema, table_name, engine from information_schema.tables where table_schema = "db2";'
+--------------+----------------------------+--------+
| table_schema | table_name | engine |
+--------------+----------------------------+--------+
| db2 | auth_group | InnoDB |
| db2 | auth_group_permissions | InnoDB |
| db2 | auth_message | InnoDB |
| db2 | auth_permission | InnoDB |
| db2 | auth_user | InnoDB |
| db2 | auth_user_groups | InnoDB |
| db2 | auth_user_user_permissions | InnoDB |
| db2 | django_admin_log | InnoDB |
| db2 | django_content_type | InnoDB |
| db2 | django_session | InnoDB |
| db2 | django_site | InnoDB |
+--------------+----------------------------+--------+
Соответственно поправив SQL запрос можно будет переключиться и в обратную сторону, т.е. с InnoDB на MyISAM
Комментариев нет:
Отправить комментарий