Articles in this section

Unable to remove a database in Plesk: This resource is used by installed web application

Plesk for Windows Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Symptoms

  • Unable to remove a database in Plesk:

    1. The option Remove Database is grayed out at Plesk > Domains > example.com > Databases.
    2. The check-box next to the database name is grayed out and the database name contains This resource is used by the installed site application at  Tools & Settings > Database Server > Databases.
  • There is no application installed at Domains > example.com > Applications.

  • Unable to change a domain for the database in Plesk > Domains > example.com > Databases, there is no option to change the domain/subdomain that is related to a database.

Cause

Database inconsistency.

Resolution

  1. Connect to the Plesk server via SSH (Linux) / RDP (Windows Server).

  2. Create a backup of the Plesk database:

    • on Linux, run the command:

      # plesk db dump psa > /root/psa_backup.sql

    • on Windows Server, start a command prompt as an Administrator and run the command:

      C:\> plesk db dump psa > C:\psa_backup.sql

  3. Connect to the Plesk database:

    MYSQL_LIN: plesk db

  4. Find ID of the subscription to which the affected domain belongs:

    MYSQL_LIN: mysql> select id from domains where name='example.com';
    +----+
    | id |
    +----+
    | 23 |
    +----+

  5. Find the connection ID between an application and a database using ID from the step 4:

    MYSQL_LIN: mysql> SELECT data_bases.name,apsResources.pleskId FROM `data_bases` INNER JOIN `DatabaseServers` ON data_bases.db_server_id = DatabaseServers.id LEFT JOIN `apsResources` ON apsResources.pleskId = data_bases.id AND apsResources.pleskType="db" WHERE (dom_id = 23);
    +------------+---------+
    | name       | pleskId |
    +------------+---------+
    | example_db |      17 |
    +------------+---------+

  6. Delete a connection record using pleskId from the step 5:

    MYSQL_LIN: mysql> DELETE FROM apsResources WHERE pleskType="db" AND pleskId=17;

  7. Remove the database Domains > example.com > Databases.

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.