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.
Step 3 Restore the database
In the Object Explorer, right click on Databases and click on Restore Databases.
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.
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.
In the Object Explorer right click on Databases and click on Refresh. The database should now appear in the list.
Leave a Review