There are times that you need to restore a database backup to a different database name. You may need it for testing or data migration. In my case, I needed to rename a TFS 2013 project collection and one of the steps is to backup and restore the TFS project collection to a new database name.

Here are the steps on how to do it:

1. Open up your SQL Server Management Studio and connect your SQL Server instance to back-up the project collection database.  Look for the project collection database. Normally named as “Tfs_Collection Name”. Right click the database and select properties. From the properties page, choose “Options” and go to “State” and restrict access to “Single_User”.

tfs10

tfs11

2. Click “Yes” to ensure all connections are closed.  

tfs12

 3. Right click the project collection database again and create a backup.

tfs13

 4. Verify your backup location.

tfs25

tfs26

 5. Take the database offline and then detach.

tfs18

tfs19

 6. Restore the database to the a new database name.

tfs20

tfs21

 7. Locate your backup file.

tfs22

tfs23

 8. Make sure to change the database name to the new name.

tfs24

 9. Change the filenames to match the new database name.

tfs25

tfs26

You are done!

Like this post? Share it!