Product:
Search Type:

Dumping an 'expand' database takes several hours. Although, the DB size is about several megabytes, the resulting SQL dump file size is several hundreds megabytes.

Article ID: 1006 
Last Review: May,18 2006
APPLIES TO:
  • Expand 1.x

RESOLUTION


Plesk Expand tracks the history of all operations and saves it in its DB. 
The responsible tables are "tm_task" and "tm_action". These tables can
grow a lot.

Actually, it is not mandatory to dump "tm_action" table content and it is
not mandatory to dump "tm_task" table content where the "period" field is not
zero.

Here is a sample shell script to be used instead of the mysqldump utility to dump 'expand' DB:

#!/bin/bash

# -----------------------------------------------------------------
# don't forget to set right mysql user/password!
# -----------------------------------------------------------------
MYSQL_ADMIN_USER="admin" ## use you real user name instead
MYSQL_ADMIN_PASSWORD="setup" ## use you real password instead

LOGIN_DATA="-u$MYSQL_ADMIN_USER -p$MYSQL_ADMIN_PASSWORD"

MYSQLDUMP="mysqldump $LOGIN_DATA"
EXPAND_DB="expand"

for table in `mysql $LOGIN_DATA expand -Bs -e 'show tables'`; do
case $table in
tm_task) $MYSQLDUMP '--where=period>0' $EXPAND_DB
"$table";;
tm_action) $MYSQLDUMP --no-data $EXPAND_DB "$table";;
*) $MYSQLDUMP $EXPAND_DB "$table";;
esac
done


Using this script the dumping process will take about several minutes.


IMPORTANT NOTE:

Unlike Plesk which uses MyISAM tables, Plesk Expand uses InnoDB tables to
keep referential integrity of database. When mysqldump produces a dump
file, tables can be listed there not in the order which they were originally
created. So, some tables can refer to tables which are not created yet.
It means that restoring process would fail due to referential integrity
restrictions.

To avoid this it is recommended to use this trick:
add command
SET FOREIGN_KEY_CHECKS=0;
to the very beginning of the SQL dump file. It would disable referential
integrity checks while you do restoring.

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
*Please type the code you can see.
* - required fields