Restoring a Database to a New Location

The database backup option is fairly straightforward. You make a backup of the database, which writes the backup to a file or set of files. The backup is restored, and any changes to the location of the database files are made at that time. Backup and restoration are discussed in detail in Chapter 11.

You can easily detach a database by right-clicking the database in the Object Explorer and choosing Tasks and then Detach. When the database is detached, you can move the file(s) to the desired location. You can then right-click the database’s node and select Attach. The Attach Databases screen that appears allows you to select the .mdf file and change the file location for any of the related database files. ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.