sql server restore database

Solutions on MaxInterview for sql server restore database by the best coders in the world

showing results for - "sql server restore database"
Ella
24 Apr 2018
1--Step 1: Check the logical file names with the help of the following command:
2
3  RESTORE FILELISTONLY 
4  FROM DISK = 'E:\DBBackups\mydb.bak'
5
6--Step 2: Use the logical names you get from the above query in the below query:
7
8  RESTORE DATABASE [mydb_new]
9  FILE = N'<MDFLogicalName>' 
10  FROM DISK = N'E:\DBBackups\mydb.bak'
11  WITH FILE = 1
12	  ,NOUNLOAD
13	  ,STATS = 10
14	  ,MOVE N'<MDFLogicalname>' TO N'E:\DBBackups\mydb_new.mdf'
15	  ,MOVE N'<LDFLogicalName>' TO N'E:\DBBackups\mydb_new_0.ldf'