---
title: "How-to Restore a SQL Database to a Windows Virtual Machine"
slug: "how-to-restore-a-sql-database-to-a-windows-virtual-machine"
updated: 2022-02-11T20:09:13Z
published: 2022-02-11T20:09:13Z
canonical: "kb.expedient.com/how-to-restore-a-sql-database-to-a-windows-virtual-machine"
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://kb.expedient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How-to Restore a SQL Database to a Windows Virtual Machine

### Introduction

SQL databases are restored when they need to be returned to a specific point or recovered entirely. You can initiate a restore task to recover the database to the original or an alternate virtual machine.

### Procedure

1. [Log in](/v1/docs/how-to-access-cloud-data-protection) to the Cloud Data Protection system.
2. Select the Data Protection Recoveries tab from the navigation bar at the top of the page.  
![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075074707.png)
3. Select the **Recover** button and then **MS SQL.** ![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075074749.png)
4. Utilize the search utility to locate the SQL server or database to be restored
  1. Wildcards and partial names are supported.
5. **Click** the desired database to restore and choose the snapshot you wish to recover from

6. Configure the restore on the **Recovery Options** page

If you are restoring an AAG and overwriting the original database, additional actions are required.

See Section on Additional Recovery Steps for Always-on Availability Groups

1. Select **Recover**
2. Upon the success of the restore, you will have the database restored to the location specified on the **Recovery Options** page.

### Additional Recovery Steps for Always-on Availability Groups

When attempting to restore an AAG by overwriting the original database, it will show the following: ![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075074838.png)

Before you select the **Check Box** and click **OK**, you will need to break the AAG manually:

1. Log in to a server with SQL Server Management Studio (SSMS) installed with access to manage the applicable database
2. Launch SSMS and connect to the database
3. Navigate to the AAG by selecting **Always On High Availability → Availability Groups → Availability Databases**
4. **Right Click** the respective database and select **Remove Database from Availability Group.**  
**![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075074884.png)**
5. Confirm you have removed the correct database and select **OK**
6. Verify that the database is no longer listed in the Availability Group and proceed with the restore.

Upon completion of the restore, you may wish to return the database to the Availability Group:

1. Log in to a server with SQL Server Management Studio (SSMS) installed with access to manage the applicable database
2. Launch SSMS and connect to the database
3. Navigate to the AAG by selecting **Always On High Availability → Availability Groups → Availability Databases**
4. **Right Click** the **Availability Databases** folder and select **Add Database**  
**![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075074925.png)**
5. Step through the menu, setting the appropriate database and replica server.
6. Select your seeding method.
7. Select **Finish.**
8. Verify the database synchronizes properly between AAG members.

Once you have fully recovered your database(s), make sure to refresh the AAG configuration within the protection job otherwise, backup operations can fail:

1. Log in to the respective Cloud Data Protection system
2. From the navigation bar at the top of the page, select the **Protection** → **Sources** tab
3. Locate the SQL protection job, select the **Context Menu Icon** (**![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075391796.png)**), and the **Edit** **![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075391836.png)**
4. Select **Edit Objects** **![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075391874.png)**
5. Select **Refresh**, verify the correct databases are showing as recognized, and select **Add** **![](https://cdn.document360.io/69e9f9c7-5da8-45e7-a671-4b8287f36122/Images/Documentation/image-1613075391915.png)**
6. Select **Protect**
