Plesk

Backup finishes with the warning: Database id is not found in data_bases

Symptoms

Cause

Database inconsistency.

Resolution

  1. Connect to the server using SSH .

  2. Run the command for the affected domain (in this case, dom_id=37):

    # /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/api-cli/aps.php --get-web-space-instances 37
    ..
    '_name' => 'database',
    '_attrs' => {
    'id' => '5',
    'aps-registry-id' => '380dc3b0-e358-4ecf-a069-bf60eabad408',
    'user' => 'dbuser',
    'prefix' => '',
    },
    ..

  3. Back up and log in to psa database.

  4. Make sure that the table below contains proper values:

    MariaDB [psa]> select * from apsResources where registryId='380dc3b0-e358-4ecf-a069-bf60eabad408';
    +----+--------------------------------------+-----------+---------+
    | id | registryId | pleskType | pleskId |
    +----+--------------------------------------+-----------+---------+
    | 8 | 380dc3b0-e358-4ecf-a069-bf60eabad408 | db-user | 7 |
    +----+--------------------------------------+-----------+---------+

    There should be two records for the database and the database user with equal
    registryId
    values.

  5. Find the appropriate values:

    MariaDB [psa]> select id, default_user_id from data_bases where name="dbexample";
    +-----+
    | id |
    +-----+
    | 5 |
    +-----+
    1 row in set (0.00 sec)

    MariaDB [psa]> select id from db_users where db_id=5;
    +----+
    | id |
    +----+
    | 6 |
    +----+
    1 row in set (0.00 sec)

  6. Update
    psa.apsResources
    table with correct values:

    MariaDB [psa]> update apsResources set pleskId = 6 where id = 8;
    MariaDB [psa]> insert into apsResources values (NULL, '380dc3b0-e358-4ecf-a069-bf60eabad408', 'db', 5);