Symptoms
-
A backup for a particular domain finishes with the following warning:
Warning: Hosting "example.com"
Broken referential integrity: Database id is not found in data_bases -
There is
database for the subscription.
dbexample
The database presents in
:
psa.data_bases
MariaDB [psa]> select * from data_bases where name="dbexample";
+-----+---------------+-------+---------+---------------+------------------+--------------+
| id | name | type | dom_id | db_server_id | default_user_id | external_id |
+-----+---------------+-------+---------+---------------+------------------+--------------+
| 5 | dbexample | mysql | 37 | 1 | 6 | NULL |
+-----+---------------+-------+---------+---------------+------------------+--------------+ -
In
following records might be found:
/var/log/plesk/PMM/backup-<date>/backup.log
TRACE SQL: SELECT name, type, external_id, host FROM data_bases AS d LEFT JOIN DatabaseCustomHosts AS h ON d.id=h.id WHERE d.id = ?: Params:
WARN 78d4efc5-57f3-4370-89cd-4bf16e6e7d34 Broken referencial integrity: Database id is not found in data_bases
Cause
Database inconsistency.
Resolution
-
Connect to the server using SSH .
-
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' => '',
},
.. -
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
values.
registryId
-
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) -
Update
table with correct values:
psa.apsResources
MariaDB [psa]> update apsResources set pleskId = 6 where id = 8;
MariaDB [psa]> insert into apsResources values (NULL, '380dc3b0-e358-4ecf-a069-bf60eabad408', 'db', 5);