Plesk ERROR: PleskMainDBException

Written by Mike on January 17, 2009 – 2:08 pm -

While accessing plesk control panel, somtime we get following Error

ERROR: PleskMainDBException
MySQL query failed: Table 'psa.APSApplicationItems' doesn't exist

0: /usr/local/psa/admin/plib/common_func.php3:218
        db_query(string 'SHOW CREATE TABLE `APSApplicationItems`')
1: /usr/local/psa/admin/plib/SQLParser.php:27
        SQLParser->handleDatabase()
2: /usr/local/psa/admin/plib/MySQL5FixBinaryColumns.php:36
        MySQL5FixBinaryColumns::run()
3: /usr/local/psa/admin/auto_prepend/auth.php3:90

SOLUTION:

The Main reason of this problem is corrupted Plesk Database. We can check that using following command

[root@server ~]#  mysqlcheck -uadmin -p`cat /etc/psa/.psa.shadow ` psa
psa.APSApplicationItems
error    : Table 'psa.APSApplicationItems' doesn't exist
psa.APSClientApplicationItems
error    : Table 'psa.APSClientApplicationItems' doesn't exist
psa.APSLicenseTypes
error    : Table 'psa.APSLicenseTypes' doesn't exist
psa.APSLicenses
error    : Table 'psa.APSLicenses' doesn't exist

To resolve the issue, please do the following:

- remove corrupted tables from plesk database
- restore them from plesk database distributive

you can do above using following Steps

1.  Backup undamaged Tables

mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -NB -e'show tables' > ../tables
for i in `cat ../tables`
 do
  mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` psa $i > $i.sql
 done

2. Remove Plesk database from /var/lib/mysql/ manually.

3. Restore the latest valid daily dump which can be found in /var/lib/psa/dumps/ directory.

4. Finally Restore the backup which we have taken on step 1.

for i in `cat ../tables`
 do echo $i
  mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa < $i.sql
 done

NOTE: Fix for this problem is completely depends upon the error you are getting. So, be careful before trying this fix.


Tags: ,
Posted in Plesk For Linux, VPS hosting, Windows VPS | 1 Comment »
RSS

  • Subscribe Me

  • Tag Cloud

  • Archives