Submit a ticketCall us

Looking to compare latest NPM features with previous versions of NPM?
The NPM new feature summary offers a comparison of new features and improvements offered with this release.

 

 

 

 

Home > Success Center > Storage Manager (STM) > Run myisamchk to resolve crashed MariaDB tables

Run myisamchk to resolve crashed MariaDB tables

Created by Interspire Import, last modified by MindTouch on Jun 23, 2016

Views: 2 Votes: 1 Revisions: 13

Overview

This article provides information on myisamchk and MariaDB tables.

 

What does a myisamchck do?

It will check, compress and repair MariaDB tables.

Note: Storage Manager versions 5.6 and later use MariaDB. For earlier versions, MYSQL is used.

For versions prior to v5.6, substitute MySQL for MariaDB.

 

When to run a myisamchk?

If the following error appears in the web console or logs:

java.sql.SQLException: Table " is marked as crashed and last (automatic?) repair failed.

A myisamchk can be run to fix the crashed tables.

Note: You can find your MariaDB log at the Storage Manager Server \mariadb\data\ location. The file is named machine name.err.

Environment

STM versions 5.6 or later

Cause

A common cause of crashed tables in MariaDB can be an antivirus/intrusion detection or a backup software. If the tables are locked at the same time when Storage Manager is trying to write to them, this can cause corruption of the tables.

To prevent this from happening, you need to add exceptions to these tools so they do not access the  \mariadb folder and subfolders.

 

For more information, you may refer to https://mariadb.com/kb/en/mariadb/myisamchk/.

Resolution

Run myisamchk to fix crashed tables on Windows

  1. Open the services menu and click the Stop button to stop the MariaDB service
  2. Open a command prompt and navigate to \mariadb\data\storage.
  3. Run the following command: for %i in (*.MYI) do ..\.\bin\myisamchk ==defaults-file=..\.\my.cnf -c -r -a -f -v %i

    Option

        Description

    -c

        Check tables for errors

    -r

        Recover, this option can fix most issues except unique keys that are not unique

    -a

        Analyze distribution of keys

    -f

        Force override of old temporary files

    -v

        Verbose, this option prints information to the screen

  4. Let the myisamchk complete.
  5. Start the MariaDB and SolarWinds Storage Manager services.

 

Run myisamchk to fix crashed tables on Linux

  1. Stop the MariaDB service.
  2. Run the following command: /usr/bin/storage_manager_server_stop.
  3. Go to /mariadb/bin.
  4. Run the following command: ./myisamchk --defaults-file=../my.cnf -c -r -a -f -v ../data/storage/*.MYI.
  5. Let myisamchk complete.
  6. Start the SolarWinds Storage Manager /usr/bin/storage_manager_server start.

 

Repair individual tables

Sometimes, myisamchk fails to fix all the corrupted tables. When this happens, users can perform the following procedure to repair individual tables.

Note: It is strongly recommended to create a backup of the crashed table(s) before starting with the below steps. Under some circumstances, the following steps may cause data loss to the corrupted tables. Possible causes include but are not limited to file system errors.

  1. Make sure that the database services are running.
  2. Open a command prompt and navigate to the \mariadb\bin directory.
  3. Run the following command: mysql -u -p storage.
    The MariaDB username and password can be found in the \Storage_Manager_Server/webapps/ROOT/bin/server.properties file.
  4. Execute the command Repair table.

For more information regarding table repairs, refer to the following link:

http://dev.mysql.com/doc/refman/5.0/...air-table.html

 

 

Last modified
03:47, 23 Jun 2016

Tags

Classifications

Public