Import .bak file to a database in SQL server
Solution 1:
On SQL Server Management Studio
- Right click Databases on left pane (Object Explorer)
- Click Restore Database...
- Choose Device, click ..., and add your .bak file
- Click OK, then OK again
Done.
Solution 2:
.bak files are database backups. You can restore the backup with the method below:
How to: Restore a Database Backup (SQL Server Management Studio)
Solution 3:
This will show you a list of database files contained in DB.bak:
RESTORE FILELISTONLY
FROM DISK = 'D:\3.0 Databases\DB.bak'
You will need the logical names from that list for the MOVE
operation in the second step:
RESTORE DATABASE YourDB
FROM DISK = 'D:\3.0 Databases\DB.bak'
and you have to move appropriate mdf,ndf & ldf files using
With Move 'primarydatafilename' To 'D:\DB\data.mdf',
Move 'secondarydatafile' To 'D:\DB\data1.ndf',
Move 'logfilename' To 'D:\DB\log.ldf'
Solution 4:
You can simply restore these database backup files using native SQL Server methods, or you can use ApexSQL Restore tool to quickly virtually attach the files and access them as fully restored databases.
Disclaimer: I work as a Product Support Engineer at ApexSQL