How to Find Org/Space for a Specific Service Instance
search cancel

How to Find Org/Space for a Specific Service Instance

book

Article ID: 295154

calendar_today

Updated On:

Products

Redis for VMware Tanzu

Issue/Introduction

Customers may run into issues with stale service instances or discrepancies between the CCDB service instance and Bosh deployments. This will cause recreate-all-service-instances and upgrade-all-service instances errands to fail and result in an error similar to the one below.
 
[recreate-all-service-instances] 2023/04/27 02:12:55.295274 operation type: recreate failed for service instance 2edf2a70-9ba7-481d-bf14-3edd4378c632: unexpected status code: 500. description: Could not recreate deployment service-instance_2edf2a70-9ba7-481d-bf14-3edd4378c632: Changing state: Director responded with non-successful status code '404' response '{"code":70000,"description":"Deployment 'service-instance_2edf2a70-9ba7-481d-bf14-3edd4378c632' doesn't exist"}'


Environment

Product Version: 2.4

Resolution

In order to delete or purge the service instance, you need to know which org/space it exists. 

Bosh SSH into the TAS MySQL VM

bosh -d cf-xxxx ssh mysql/0

Connect to DB

sudo mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf


Use the same service instance GUID (2edf2a70-9ba7-481d-bf14-3edd4378c632) from the error message to query the DB

mysql> select name,space_id from ccdb.service_instances where guid = '2edf2a70-9ba7-481d-bf14-3edd4378c632';
+------------------------+----------+
| name                   | space_id |
+------------------------+----------+
| scheduler-broker-mysql |       17 |
+------------------------+----------+
1 row in set (0.00 sec)


Use the space_id value to get the Org

mysql> select name, organization_id from ccdb.spaces where id = 17;
+-----------+-----------------+
| name      | organization_id |
+-----------+-----------------+
| scheduler |               1 |
+-----------+-----------------+
1 row in set (0.00 sec)
mysql> select name from ccdb.organizations where id = 1;
+--------+
| name   |
+--------+
| system |
+--------+
1 row in set (0.00 sec)

Once you know the org/space you can target the org/space.

cf target -o system -s scheduler

Then use 'cf delete-service' or 'cf purge-service-instance' to remove the service instance.