Restore database using T-SQL

Restore database using T-SQL

USE [master]
RESTORE DATABASE [BackupDatabase] 
FROM  DISK = N'C:\FullBackups\BackupDatabase.bak' 
WITH  FILE = 1,  
NORECOVERY,  
NOUNLOAD,  
STATS = 5

RESTORE DATABASE [BackupDatabase] 
FROM  DISK = N'C:\FullBackups\BackupDatabase.bak' 
WITH  FILE = 7,  
NORECOVERY,  
NOUNLOAD,  
STATS = 5

RESTORE LOG [BackupDatabase] 
FROM  DISK = N'C:\FullBackups\BackupDatabase.bak' 
WITH  FILE = 8,  
NOUNLOAD,  
STATS = 5
GO

To restore your database, do the following:

  1. Launch SQL Server Management Studio (SSMS) and connect to your SQL Server instance.
  2. Right-click the Databases node in Object Explorer and select Restore Database….
  1. Select Device:, and then select the ellipses (…) to locate your backup file.
  2. Select Add and navigate to where your .bak file is located. Select the .bak file and then select OK.
  3. Select OK to close the Select backup devices dialog box.
  4. Select OK to restore the backup of your database.