How to restore a SQL Server database backup file

In this tutorial I will show how to restore a database and start writing queries. The database I will be working on is the HPN database which I use for several Power BI dashboards. However, Microsoft also provides free databases which can be found in the SQL Server samples GitHub repository here.

Step 1 Move the database to a specific location

Once downloaded, the database backup files need to be placed in the backup folder for the SQL Server installed on the computer. The path to that location is Program Files – Microsoft SQL Server – MSSQL – Backup. The database files have the .bak extension.

Step 2 Log in to Microsoft SQL Server Management Studio

Locate and double click the .exe of your SQL Server Management Studio installation. The Connect to Server window will pop up. For the Server type choose Database Engine. The Server name refers to the SQL Server instances installed on the  network. One can also type localhost or the IP address of the computer where the SQL Server instance is installed on. In my case I go ahead at choose the SQL Server 2019 instance which is installed on my local computer. For the authentication method, mine is set to Windows authentication. Everything is all set, so go ahead and click on the Connect button and Management Studio will connect to the SQL Server instance.

Connect to Server 
Server type 
Server name 
user name: 
Password: 
SQL Server 
Database Engine 
G-SHARK\SQLSERVER201S 
Windows Authentication 
G-SHARK\ÄuIi 
Remember password

Step 3 Restore the database

In the Object Explorer, right click on Databases and click on Restore Databases.

Microsoft SQL Server Management Studio 
Edit View 
Object Explorer 
Connect 
Tools Window Help 
New Query 
G-SHARQSQLSERVER201g (SQL server 15.012080 - G-SHARQgiuIi) 
Datak 
Secu 
Serve 
Repli 
Poly 
New Database... 
Attach... 
Restore Database.. 
Restore Files and Filegroups... 
Deploy Data-tier Application... 
Import Data-tier Application... 
Start PowerSheII 
Reports 
Refresh 
Management 
XEvent Profiler

Under Source, click on Device and then on the ellipsis to the right. Make sure the Backup media type is File then click on Add.

Restore Database 
No backupset selected to be restored 
S' General 
Files 
Options 
G-SHARK\SQLSERVER201S 
IG-SHARK%giu111 
View connection orooeflies 
Script 
' Help 
C) Database 
@ Device 
Database 
Database 
Restore to 
Restore plan 
Select backup devices 
Backup set 
Specify the backup media and ts location for your restore operation 
Backup media type 
Backup media 
Remove 
Contents 
Timeline n 
Verify Backup Media

This will open up the Locate Backup File windows. Click on the .bak file, in my case HeavyPowerNutrition.bak and then click OK and again OK.

Locate Backup File - G-SHARQSQLSERVER201g 
Backup File location 
A AdventureWorks2017 bak 
HeavyPowerNutfition bak 
WideWodd ImporteßDW-FuII bak 
8 
8 
Hemet Explorer 
Log tech 
M em source Editor 
Microsoft 
Microsoft Analysis Services 
Microsoft Office 
Microsoft Office 15 
Microsoft Silvedight 
Microsoft SQL Server 
Microsoft SQL Server Reportinc 
Microsoft SQL Server201S 
• MSSQL15SQLSERVER2C 
MSSQL 
• DATA 
Install 
• JOBS 
Log 
Backup 
File name

In the Object Explorer right click on Databases and click on Refresh. The database should now appear in the list.