Adi
Adi

Reputation: 139

Not able to attach SQL backups in tfs 2015

We take daily SQL backups of our TFS server Project collections. One of the collection has to be copied to new TFS server 2015. We took the backup from our daily backups, restored it from the SQL. TFS versions in both servers are same TFS 2015 Update 1 and SQL version of old TFS is SQL 2014 SP1, new TFS is SQL 2014 SP2.

However while attaching the collection from console, we get an error like enter image description here Is it always to be practiced to detach the collection and copy to another server to restore it? If so why are the backups daily SQL backups useful? (supposed to be useful for disaster recovery)

Please help.

Upvotes: 0

Views: 845

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30392

For the scheduled backups restore, you need to use the Restore tool. Just start the Restore wizard but not copy the collection database backup directly to SQL server, see Restore the databases for details. The steps vary depending on whether you need to restore data to a new server, or whether you want to restore data to the same server.

You'll need to start with a machine that doesn't have any TFS databases, install using the application-tier only installation type, restore your backed-up databases then use tfsconfig remapdbs from the commandline to set the right database server, service account etc. See Move or Clone Team Foundation Server from one hardware to another for details.

In you case, you are trying to move/copy the collection to another server. So you need to detach the collection first. See Move a team project collection for details.

You cannot attach a database backup of a TFS database that wasn't detached before. Detached collection database should have TFS_SNAPSHOT_STATE extended attribute set to Complete. If this attribute does not exist then collection is not detached and it cannot be attached.


UPDATE:

You have to detach to backup then restore to attach if you want to replicate a project collection in another TFS, just exactly following Move a team project collection.

If you just require the only one project, you have two ways to do that:

  • Create a new team project within the existing collection, then add the existing specific project to source control, then check in the project to the new TFS.
  • If you want to keep the source control history, then you need to Move a team project collection to the TFS, then delete other projects, just keep the project you needed.

Upvotes: 1

Related Questions