Here’s a simplest way I found (so far) to restore a database in MS SQL Server. First part lists “logicalnames” from the backup that you want to restore. Modify the path so it points to the actual path where your backup file is:
RESTORE FILELISTONLY FROM DISK = N'C:\[path]\[db_name_backup].bak' GO
This shows LogicalName and PhysicalName of the data and log backup files, which have to be used in the following script:
RESTORE DATABASE [db_name] FROM DISK = N'C:\[path]\[db_name_backup].bak' WITH FILE = 1, MOVE N'[data_file_logical_name]' TO N'C:\[restored_db_path]\[data_file_name].mdf', MOVE N'[log_file_logical_name]' TO N'C:\[restored_db_path]\[log_file_name].ldf', NOUNLOAD, STATS = 10 GO
That’s it. Pretty simple, isn’t it?