Plesk Database Inconsistency Checker (Beta)

Refers to:

  • Plesk 11.0 for Windows
  • Plesk 11.0 for Linux
  • Plesk 12.5 for Windows
  • Plesk 10.x and below for Linux
  • Plesk 10.x and below for Windows

Created:

2016-11-16 13:04:46 UTC

Modified:

2016-12-21 19:54:23 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Plesk Database Inconsistency Checker (Beta)

Important: This script is developed for Plesk 11.0.9 and below. Do not use this script in higher versions.

Plesk 12.5

Starting from Plesk 12.5 you can use self-repair tool to find database inconsistencies. More information can be found in
Plesk Release Notes for Linux
Plesk Release Notes for Windows

Details

The Plesk Database Inconsistency Checker script is designed to detect inconsistencies in the PSA and APSC databases of Plesk.
The script is intended to be run on a server with Plesk 9.5.4/10.4.4/11.0.9 for Linux or Windows with a MySQL database engine.

The script is currently in the Beta stage and may produce a number of false positives, especially on older Plesk versions. If the script detects a problem, it does not necessarily indicate that the inconsistency affects anything or needs to be fixed.
At the moment, the script does not offer methods for solving detected problems, and does not sort them by how critical they are.

Note that we also have a Plesk Database Schema Checker for checking the integrity of the Plesk system database.

Usage

Linux :

# /usr/local/psa/bin/sw-engine-pleskrun check_db_integrity-beta.php

Windows :

"%plesk_bin%\\php.exe" -dauto_prepend_file="" check_db_integrity-beta.php

Examples of output and its description

  1. List of records in [psa.hosting.sys_user_id] that miss a matching record in [psa.sys_users.id]
    11, 33

This means that the hosting table has records with sys_user_id that do not have corresponding records in the sys_users table with sys_users.id = hosting.sys_user_id :

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -e 'select psa.sys_users.id from psa.sys_users where psa.sys_users.id in (11,33)'

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -e 'select psa.hosting.sys_user_id from psa.hosting where psa.hosting.sys_user_id in (11,33)'
+-------------+
| sys_user_id |
+-------------+
| 11 |
| 33 |
+-------------+

It should be as follows:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -e 'select psa.sys_users.id from psa.sys_users where psa.sys_users.id in (11,33)'
+----+
| id |
+----+
| 11 |
| 33 |
+----+

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -e 'select psa.hosting.sys_user_id from psa.hosting where psa.hosting.sys_user_id in (11,33)'
+-------------+
| sys_user_id |
+-------------+
| 11 |
| 33 |
+-------------+
  1. List of records in [psa.domains.id WHERE htype='vrt_hst'] that miss a matching record in [psa.hosting.dom_id]
    41

    This means the same as the first item discussed, but with an additional filter:

    MYSQL_PWD= cat /etc/psa/.psa.shadow mysql -u admin -e 'select psa.domains.id from psa.domains where psa.domains.id in (41) and htype="vrt_hst"'

    +----+| id |+----+| 41 |+----+3. List of records in [psa.mail.account_id] that exceed N in 1:N (N=1) relation to [psa.accounts.id]
    49 [count in table psa.accounts:1; count in table psa.mail:2]

This indicates that there are multiple identical entries for the psa.mail.account_id field in the psa.mail table, when this entry should be unique:

# MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin -e 'select psa.mail.account_id from psa.mail where psa.mail.account_id=49'
+------------+
| account_id |
+------------+
| 49 |
| 49 |
+------------+
  1. List of records in [psa.domains.dns_zone_id] should not have a matching record in [psa.domainaliases.dns_zone_id]
    70

    This indicates that the psa.domains table has the same dns_zone_id as the psa.domainaliases table, when it should not.
Have more questions? Submit a request
Please sign in to leave a comment.