We are migrating from sql server 2008 to 2017 and will do the following
- install sql server 2017 on the new machine
- make backups of all dbs on old server
RESTORE DATABASE DbName FROM DISK = 'C:\temp\Live\dbname.bak'
WITH
MOVE 'DbName' TO 'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\DbName.mdf',
MOVE 'DbName_log' TO 'C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\DATA\DbName_log.ldf'
I would like to avoid the WITH
Part if possible but that requires me to create a blank db first and set its version to 2008 before i can properly restore.
I guess what i am asking is, what is the best way to take a .bak file and restore it as db on a server that doesnt have any databases.
Prefer to do this without attach/detach
I have a large number of databases so I will be creating a script to do all of them at once.
with
. Unless your file path is same in source and destination you have usewith
andmove
. Did you look psdbatools which is PowerSell Module that has bunch of commands to help you migrate large number of databases?C:
. The last thing you want to happen is to fill up the drive your OS is on.