Quantcast
Channel: OTRS Community Blog » OTRS Tips & Tricks
Viewing all articles
Browse latest Browse all 11

About OTRS, MySQL, MyISAM and InnoDB storage engines

$
0
0

The most popular database for use with OTRS is MySQL. This database comes with multiple different storage engines, the most prominent are MyISAM and the more modern InnoDB. That last storage engine is also faster and more reliable than MyISAM.

Recently we found some OTRS users running into issues because they had tables using different storage types in their database. This mostly happens because the friendly MySQL people changed the default storage engine from MyISAM to InnoDB with their version 5.5. So for instance, if you would upgrade your server from Ubuntu 10.04 to 12.04, MySQL would be upgraded from 5.1 to 5.5. This causes the default storage engine to change, but the upgrade would keep your existing tables in tact. Now when you want to create new table, for instance when you are upgrading OTRS or installing a module such as ITSM you can get an error message like this:

ERROR 1025 (HY000) at line 25: Error on rename of './otrs/#sql-143c_22' to
'./otrs/article_flag' (errno: 150)

To prevent this, we now have added a test to our database check script (and to the support module) that will notice this issue. We updated the upgrade instructions to let you run the check script before attempting the upgrade. Below is the output:

$ bin/otrs.CheckDB.pl
Trying to connect to database
DSN: DBI:mysql:database=otrs-demo;host=localhost;
DatabaseUser: root

Connected.
Your storage engine is InnoDB.
These tables use a different storage engine:

article
article_attachment
...
virtual_fs_preferences
web_upload_cache
xml_storage

 *** Please correct these problems! ***

In this case, in the output above, all tables had a different storage engine.Starting OTRS 3.2.2, we supply a script to upgrade your tables to InnoDB. Note that we only ‘upgrade’ from MyISAM to InnoDB, not the other way around. If your database is huge, you might want to schedule enough downtime for this operation. The only real way to know how much time this operation will take is to try it, so if you have a test environment, please try it there first. Of course you should also have a backup handy for just in case.

You can check for the database size in the support module, there you can also see the default storage engine and any tables that might have a different storage engine. See below:

Support Module checksAnd here is the procedure to change your database tables:

$ bin/otrs.MySQLInnoDBSwitch.pl
This will change the table type of your database tables to InnoDB.
Only run this if you know what you are doing, and if there is no load on the DB server.
This operation can take lots of time.
Please type "yes" to confirm.
yes
120 tables need to be converted.
Changing table article to engine InnoDB
Changing table article_attachment to engine InnoDB
Changing table article_flag to engine InnoDB
...
Done

Viewing all articles
Browse latest Browse all 11

Trending Articles