Articles in this section

Backup in Plesk is created with warning: Unable to back up database. Error: Unable to find row with id in data_bases table.

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • Full server backup in Plesk is created with the following warning:

    PLESK_WARN: Warning: Application "WordPress"
    Unable to back up database #25. Error: Unable to find row with id in data_bases table.

  • The following fragment can be found in /var/log/plesk/PMM/backup-<timestamp>/backup.log:

    CONFIG_TEXT: [2022-03-02 16:38:52.252|22889] DEBUG [panel] Finish: Domain: example.com
    [2022-03-02 16:38:52.269|22889] DEBUG [panel] Start: Application: WordPress
    ...
    [2022-03-02 16:38:52.300|22889] DEBUG [panel] Requested existing resource, ID: ebf59913-084f-4321-b816-279307946427

Cause

Database inconsistency. An application has been removed from a subscription, but records related to this application were left over in the apsc and/or psa database.

MYSQL_LIN: select * from apsResources where pleskId=25;
+----+--------------------------------------+------------+---------+
| id | registryId | pleskType | pleskId |
+----+--------------------------------------+------------+---------+
| 11 | ebf59913-084f-4321-b816-279307946427 | db | 25 |
| 12 | ebf59913-084f-4321-b816-279307946427 | db-user | 25 |

MYSQL_LIN: MariaDB [apsc]> select aps_registry_object.uid from aps_registry_object join aps_application on aps_application.registry_object_id=aps_registry_object.id where aps_application.id=(select aps_resource.app_id from aps_resource join aps_resource_adjacency_list on aps_resource.id=aps_resource_adjacency_list.dependent_resource_id where aps_resource_adjacency_list.base_resource_id=(select aps_resource_adjacency_list.base_resource_id from aps_resource_adjacency_list join aps_resource on aps_resource.id=aps_resource_adjacency_list.base_resource_id join aps_registry_object on aps_resource.registry_object_id=aps_registry_object.id where aps_registry_object.uid='ebf59913-084f-4321-b816-279307946427'));
+--------------------------------------+
| uid |
+--------------------------------------+
| 7c05f8de-a84a-44f9-b616-2efca1143908 |
+--------------------------------------+
1 row in set (0.003 sec)

MYSQL_LIN: MariaDB [psa]> select * from apsResources where registryId='7c05f8de-a84a-44f9-b616-2efca1143908';
Empty set (0.001 sec)

Note: there can be empty output in the query above or some records with this registryId may be present in the psa database.

Resolution

  1. Connect to the server via SSH.

  2. Execute the command below to fix inconsistencies:

    # plesk repair db

Manual solution
  1. Connect to the server via SSH.

  2. Back up the apsc and psa databases:

    # plesk db dump apsc > apsc_backup.$(date +%F_%R).sql

    # plesk db dump psa > psa_backup.$(date +%F_%R).sql

  3. Access plesk db:

    # plesk db

  4. Switch to the apsc database:

    # use apsc;

  5. Check the lines that should be removed:

    MYSQL_LIN: MariaDB [apsc]> select * from aps_registry_object where uid='ebf59913-084f-4321-b816-279307946427';
    +----+--------------------------------------+--------------+---------------------+---------+
    | id | uid | type | creation_time | enabled |
    +----+--------------------------------------+--------------+---------------------+---------+
    | **63 **| ebf59913-084f-4321-b816-279307946427 | aps.resource | 2018-05-02 23:22:15 | y |
    +----+--------------------------------------+--------------+---------------------+---------+
    1 row in set (0.001 sec)

    MariaDB [apsc]> select * from aps_resource where registry_object_id=63;
    +----+--------------------+--------------------+------------+---------------+--------+
    | id | registry_object_id | parent_resource_id | service_id | resource_type | app_id |
    +----+--------------------+--------------------+------------+---------------+--------+
    | 27 | 63 | NULL | | aps.database | NULL |
    +----+--------------------+--------------------+------------+---------------+--------+
    1 row in set (0.001 sec)

    MariaDB [apsc]> select * from aps_resource_adjacency_list where base_resource_id=27;
    +----+------------------+-----------------------+----------+------------------+--------+----------------+
    | id | base_resource_id | dependent_resource_id | relation | uniqueness_scope | branch | requirement_id |
    +----+------------------+-----------------------+----------+------------------+--------+----------------+
    | 18 | 27 | 25 | e | | NULL | main |
    +----+------------------+-----------------------+----------+------------------+--------+----------------+

  6. Remove the lines:

    MYSQL_LIN: delete from aps_resource_adjacency_list where base_resource_id=27;
    delete from aps_resource where registry_object_id=63;
    and
    delete from aps_registry_object where uid='ebf59913-084f-4321-b816-279307946427';

  7. If there were some records in psa database remove them:

    MYSQL_LIN: use psa;

    MYSQL_LIN: delete from apsResources where registryId='ebf59913-084f-4321-b816-279307946427';

  8. Run the repair again:

    # plesk repair db

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.