You are right, SQL Server 2012 seems to have a different behavior with regards to restoring over an existing database.
In SQL Server 2005 and 2008, you could overwrite an existing database, and have the existing database's data files (whose logical names match those in the backup set) replaced by those in the backup set, using the REPLACE option.
In SQL Server 2012, this is no longer the case. SQL Server 2012 insists on placing the data files in their original location, unless the existing database was originally restored from a backup of the same database.
In your case, you would need to first restore the dev database from a backup of the production database, using the MOVE options. After that, subsequent restores can be performed without the need for the MOVE options.
If it's any consolation, SQL Backup 7.3 can help somewhat with the MOVE options. If all the data files and trx log files can be grouped in the same folders, you can use the MOVE DATAFILES/LOGFILES shortcut e.g.
There is also MOVE FILESTREAMS ... for filestreams, and MOVE FULLTEXTCATALOGS ... for full text catalogs.
In SQL Server 2005 and 2008, you could overwrite an existing database, and have the existing database's data files (whose logical names match those in the backup set) replaced by those in the backup set, using the REPLACE option.
In SQL Server 2012, this is no longer the case. SQL Server 2012 insists on placing the data files in their original location, unless the existing database was originally restored from a backup of the same database.
In your case, you would need to first restore the dev database from a backup of the production database, using the MOVE options. After that, subsequent restores can be performed without the need for the MOVE options.
If it's any consolation, SQL Backup 7.3 can help somewhat with the MOVE options. If all the data files and trx log files can be grouped in the same folders, you can use the MOVE DATAFILES/LOGFILES shortcut e.g.
Code: |
EXEC master..sqlbackup '-sql "RESTORE DATABASE ahah_devl FROM DISK = [...] WITH MOVE DATAFILES TO [E:\applctn\ahah\devl\database\data\], MOVE LOGFILES TO [E:\applctn\ahah\devl\database\log\]"' |
There is also MOVE FILESTREAMS ... for filestreams, and MOVE FULLTEXTCATALOGS ... for full text catalogs.