In this article, I will explain the Restore in SQL Server 2017.
You can read SQL Server 2017 Backup Tutorials before this article.
Firstly go to Database tab and right click then click Restore database.
After that Choose Source as Device, then Select backup devices like following.
You can change Filename when restore database files like following.
You can choose Restore options in the following screen.
I will restore transaction logs additional after full database restore. So I have chosen Restore with norecovery. Additional transaction logs can be restored.
You can restore database with following T-SQL Code.
USE [master] RESTORE DATABASE [TEST] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\TEST.bak' WITH FILE = 2, NORECOVERY, NOUNLOAD, STATS = 5 GO
After Restore database is completed with norecovery mode, we can restore transaction logs to recover database up to date.
You can right click related database and choose Restore–>Transaction log like following.
Choose Restore source from Device as latest Transaction logs like following.
You can choose Recovery state as Recovery in this step like following. If you have more transaction logs to restore, then you should choose with norecovery mode in this step.
You can restore transaction logs with following T-SQL Code.
RESTORE LOG [TEST2] FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\TransactionlogBackup.trn' WITH FILE = 2, NOUNLOAD, STATS = 10 GO
After restore database is completed, we have restored TEST database as TEST2 like following.
Do you want to learn Microsoft SQL Server DBA Tutorials for Beginners, then read the following articles.
1,987 views last month, 1 views today