Skip to content

Commit 3864296

Browse files
Merge pull request #236021 from MikeRayMSFT/20230426-backup-controller-database
Stage backup controller database.
2 parents 8172221 + 28a32c3 commit 3864296

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Backup controller database
3+
description: Explains how to backup the controller database for Azure Arc-enabled data services
4+
services: azure-arc
5+
ms.service: azure-arc
6+
ms.subservice: azure-arc-data
7+
author: dnethi
8+
ms.author: dinethi
9+
ms.reviewer: mikeray
10+
ms.date: 04/26/2023
11+
ms.topic: how-to
12+
---
13+
14+
# Backup controller database
15+
16+
When you deploy Azure Arc data services, the Azure Arc Data Controller is one of the most critical components of the deployment. The data controller:
17+
18+
- Provisions and deprovisions resources
19+
- Orchestrates most of the activities for Azure Arc-enabled SQL Managed Instance
20+
- Captures the billing and usage information of each Arc SQL managed instance.
21+
22+
All information such as inventory of all the Arc SQL managed instances, billing, usage and the current state of all these SQL managed instances is stored in a database called `controller` under the SQL Server instance that is deployed into the `controldb-0` pod.
23+
24+
This article explains how to back up the controller database.
25+
26+
Following steps are needed in order to back up the `controller` database:
27+
28+
1. Retrieve the credentials for the secret
29+
1. Decode the base64 encoded credentials
30+
1. Use the decoded credentials to connect to the SQL instance hosting the controller database, and issue the `BACKUP` command
31+
32+
## Retrieve the credentials for the secret
33+
34+
`controller-db-rw-secret` is the secret that holds the credentials for the `controldb-rw-user` user account that can be used to connect to the SQL instance.
35+
Run the following command to retrieve the secret contents:
36+
37+
```azurecli
38+
kubectl get secret controller-db-rw-secret --namespace [namespace] -o yaml
39+
```
40+
41+
For example:
42+
43+
```azurecli
44+
kubectl get secret controller-db-rw-secret --namespace arcdataservices -o yaml
45+
```
46+
47+
## Decode the base64 encoded credentials
48+
49+
The contents of the yaml file of the secret `controller-db-rw-secret` contain a `password` and `username`. You can use any base64 decoder tool to decode the contents of the `password`.
50+
51+
## Back up the database
52+
53+
With the decoded credentials, run the following command to issue a T-SQL `BACKUP` command to back up the controller database.
54+
55+
```azurecli
56+
kubectl exec controldb-0 -n contosons -c mssql-server -- /opt/mssql-tools/bin/sqlcmd -S localhost -U controldb-rw-user -P "<password>" -Q "BACKUP DATABASE [controller] TO DISK = N'/var/opt/controller.bak' WITH NOFORMAT, NOINIT, NAME = N'Controldb-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10, CHECKSUM"
57+
```
58+
59+
Once the backup is created, you can move the `controller.bak` file to a remote storage for any recovery purposes.
60+
61+
> [!TIP]
62+
> Back up the controller database before and after any custom resource changes such as creating or deleting an Arc-enabled SQL Managed Instance.
63+
64+
## Next steps
65+
66+
[Azure Data Studio dashboards](azure-data-studio-dashboards.md)

articles/azure-arc/data/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ items:
7676
href: view-billing-data-in-azure.md
7777
- name: View data controller (portal)
7878
href: view-data-controller-in-azure-portal.md
79+
- name: Backup data controller
80+
href: backup-controller-database.md
7981
- name: Delete resources
8082
href: delete-azure-resources.md
8183
- name: Uninstall Azure Arc data controller

0 commit comments

Comments
 (0)