Moving data from a shared tablespace to a file-per-table tablespace in a MySQL or MariaDB DBMS

Expand all | Collapse all

For a MySQL and MariaDB DBMS, you can store data in the following ways:

Using a shared tablespace increases the risk of tablespace fragmentation. Since it is not possible to perform a SHRINK operation, a file in a shared tablespace may take up about 90% of the disk space. This negatively affects the disk subsystem performance. Thus, it is useful to opt for a file-per-table tablespace.

This article describes how to move data from a shared tablespace to a file-per-table tablespace. If the MySQL or MariaDB DBMSs are also used by other applications, you have to move the databases of these applications to the file-per-table tablespace.

We recommend performing this procedure only if you are using MySQL or MariaDB DBMSs for Administration Server.
Moving data from a shared tablespace to a file-per-table tablespace may increase the load on the disk subsystem.

Prerequisites

Before you start, make sure that:

The required disk space is 150% of the current total databases size (current size of the ibdata1 file).

Process

To move data from a shared tablespace to a file-per-table tablespace:

  1. Stop the Kaspersky Security Center Administration Server service and other applications using the instance of the DBMS for which you want to perform this procedure.
  2. Depending on the DBMS version, log in to your DBMS as a superuser, and then in any convenient application, run the fix_tablespace.sql script.

    You can view the fix_tablespace.sql scripts by clicking these links:

    View the script for MySQL 5.7 and MariaDB 10.1+

    View the script for MySQL 8.0+

    You must not stop the script execution.
    If no DBMS errors occurred, but you terminated the script execution, either run the script again or stop performing the steps of this procedure, restart the DBMS service, and restore the Administration Server data from the backup.

  3. In the [mysqld] section of the my.cnf file, set the innodb_file_per_table parameter to 1.
  4. Restart the MySQL or MariaDB service.
  5. Start the Kaspersky Security Center Administration Server service.

The data is moved from a shared tablespace to a file-per-table tablespace.

Page top