This article discuss on how you can restore the Cloud Controller Database (CCDB) from a TAS BBR back up file to any MySQL database. The MySQL database should be the same version as your MySQL TAS database.
This is useful for troubleshooting App Usage Report where it is using CCDB as source data.
When you take a TAS BBR backup this will generate a tar file. For this example let use the filename 20240924-pas-backup.tar
1. Uncompress 20240924-pas-backup.tar and you will see the following files under cf-XXXXXXX folder
backup_restore-0-backup-restore-notifications.tar
backup_restore-0-backup-restore-pcf-autoscaling.tar
backup_restore-0-bbr-cfnetworkingdb.tar
backup_restore-0-bbr-cloudcontrollerdb.tar
backup_restore-0-bbr-credhubdb.tar
backup_restore-0-bbr-routingdb.tar
backup_restore-0-bbr-uaadb.tar
backup_restore-0-bbr-usage-servicedb.tar
manifest.yml
metadata
2. Uncompress backup_restore-0-bbr-cloudcontrollerdb.tar and you will see file
cloudcontroller-artifact-file
3. Login into your MySQL database where you want to restore your CCDB. Sample login command
mysql -h <ip> -u <user> -p <password>
4. Create Cloud Controller Database
mysql> create database ccdb;
5. select or use Cloud Controller Database
mysql> use ccdb;
6. Using the file from Step 2 to restore CCDB data
mysql> source /<dir>/cf-XXXXXXX/backup_restore-0-bbr-cloudcontrollerdb/cloudcontroller-artifact-file;
7. To verify check if the tables have been created.
mysql> show tables;
+-------------------------------------------+
| Tables_in_ccdb |
+-------------------------------------------+
| app_annotations |
| app_events |
| app_labels |
| app_usage_events |
| apps
...
| users |
+-------------------------------------------+
122 rows in set (0.01 sec)