Symptoms
-
A backup for a particular domain finishes with the following warning:
Unable to back up database #. Error: Unable to find row with id in data_bases table.
Cause
Database inconsistency
Resolution
-
Connect to the server using SSH
-
Run the command with the ID of 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' => '',
}, -
Back up the psa database
-
Access the psa database:
# plesk db
-
Make sure that the table contains proper values:
select * from apsResources where registryId='380dc3b0-e358-4ecf-a069-bf60eabad408';
+----+--------------------------------------+-----------+---------+
| id | registryId | pleskType | pleskId |
+----+--------------------------------------+-----------+---------+
|8| 380dc3b0-e358-4ecf-a069-bf60eabad408 | db-user |7|
+----+--------------------------------------+-----------+---------+ -
Find the appropriate values:
select id, default_user_id from data_bases where name="dbexample";
+-----+
| id |
+-----+
|5|
+-----+
1 row in set (0.00 sec)select id from db_users where db_id=5;
+----+
| id |
+----+
|6|
+----+
1 row in set (0.00 sec) -
Update
psa.apsResources
table with correct values:update apsResources set pleskId =6where id =8;
insert into apsResources values (NULL, '380dc3b0-e358-4ecf-a069-bf60eabad408', 'db',5);
Note: If the command executed in step 2 returns more than one database with more than one 'aps-registry-id' and, apply the same process for the other database also. If the command executed in the second step has an empty value for the database ID, that means it is an orphaned record and it should be removed, to do so:
-
Get the aps-registry-id by running the command for the affected domain and searching for a database with an empty value for it's id:
# /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/api-cli/aps.php --get-web-space-instances 37 | grep -A5 database
'_name' => 'database',
'_attrs' => {
'id' => '',
'aps-registry-id' => 'dcb1a095-3aef-4f2b-a872-d196eb041b33',
'user' => '',
'prefix' => '', -
Remove the row with contains the 'RegistryId' from the previous command:
delete from apsResources where registryId='dcb1a095-3aef-4f2b-a872-d196eb041b33';
-
Back up the apsc database and log in apsc database:
# plesk db
use apsc;
-
Retrieve the id to be removed using as UID, the Registryid that you previously got:
[apsc]> select * from aps_registry_object where uid='dcb1a095-3aef-4f2b-a872-d196eb041b33';
-
Now with the ID that resulted to the query above use its value as the registry_object_id:
[apsc]> select * from aps_resource where registry_object_id=16;
-
Use the ID from the output of the above query as the base_resource_id in the following query:
[apsc]> select * from aps_resource_adjacency_list where base_resource_id=9;
After confirming remove the orphaned records:
[apsc]> delete from aps_resource_adjacency_list where base_resource_id=9;
[apsc]> delete from aps_resource_adjacency_list where base_resource_id=16;
Comments
0 comments
Please sign in to leave a comment.