Last active
January 25, 2019 14:40
-
-
Save Andrey2G/b2c3704f3dab02709375bd1f1c55915b to your computer and use it in GitHub Desktop.
restoring TFS Database on the other server without ldf files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE master | |
GO | |
CREATE DATABASE Tfs_DefaultCollection | |
GO | |
ALTER DATABASE Tfs_DefaultCollection SET OFFLINE | |
GO | |
-- NOW Delete Tfs_DefaultCollection mdf and ldf files | |
-- AND copy mdf you need to restore | |
ALTER DATABASE Tfs_DefaultCollection SET ONLINE | |
GO | |
ALTER DATABASE Tfs_DefaultCollection REBUILD LOG ON | |
( | |
NAME='Tfs_DefaultCollection_log', | |
FILENAME='c:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\Tfs_DefaultCollection_log.ldf' | |
) | |
GO | |
ALTER DATABASE [Tfs_DefaultCollection] SET MULTI_USER | |
GO | |
-- Do the same for Tfs_Configuration and Tfs_YourCollection files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Server is died, and TFS files has been copied from Raid.
ldf files was corrupted
This script allow to restore TFS Databases on new server
Сonclusion: Do backups every day!
Note:
You also need to modify web.config->appSettings->applicationId with a value from field HostId from the table Tfs_Configuration.tbl_ServiceHost
where name=TEAM_FOUNDATION
Also, please check Tfs_Configuration database Extended Properties->TFS_SERVICE_LEVEL should be the same as web.config->appSettings->staticContentVersion
web.config from "Path to TFS"/Application Tier/Web Services/web.config