TFS2013 to TFS2017 / Single SQL Server 2012 to SQL Server 2014 AAG - tfs

My current environment is on a single vm:
TFS2013
SQL Server 2012 (dedicated instance, installed on the same vm)
1 project collection
Reporting configured
My migration target environment is:
New VM containing TFS 2017 update 1
Existing SQL Server 2014 AAG, without SSAS
Reporting not configured (because of SSAS not installed), and I actually don't need reporting
I tried multiple ways to do this installation, but encountered many problems with Always-On:
Upgrade/configure directly with database restore (through SQL Management Studio) directly in AAG, encountered TF400711 error
Upgrade/configure without Always-On, works well, but now my problem is to move my databases to AAG. Tfs_Configuration is OK, but when I attach my collection, encountering the TF246017 error. I'm not understanding this error because I use the same connection string than my Tfs_Configuration database...
What is the best procedure in my case?
I read this and this post, but they don't match to my situation.

You could use way2, since Tfs_Configuration is OK, you just need to figure out the error TFS246017. This error can occur due to following reasons
Incorrect SQL Installation order especially if you are using Express edition
Database In Recovery
Database Out-of-Sync – during migration to newer version of TFS
Permission of Service Account is not right
SQL Database not running or not reachable
TFS Proxy not reachable
Double check if you have got enough permission for the installation account. Suggest you go through the Windows Event Log , a good candidate where to look for the potential cause.
Also take a look at this thread: TF246017: Team Foundation Server could not connect to the database & this one. There are many resource about this issue in google which may help you figured it out.

Related

TFS doesn't recognize imported DB

My company is using a TFS 2013 (Update 4 = 12.0.31101.0) server for development. I was tasked with migrating the TFS server to VSTS but realized I had to update to TFS2018 to be able to use the current migration tool.
My boss obviously didn't like the idea of performing "open heart surgery" on our productive environment so we created a back-up of the SQL Collection-Database (by creating a dump using Management Studio) installed a Trial Version of TFS/SQL Server in a VM (VirtualBox) and tried importing the back-up.
Using the built-in import tool (TFS\Tools\TfsRestore.exe) I imported the old DB into the SQL Server, which actually worked really well, looking at the DB in ManagementStudio everything that needs to be there seems to be there.
However, trying to attach the Team Project Collection in the Team Foundation Server Administration Console I simply can't find it. I List Available Databases and the only one it finds is the DefaultCollection that was created during installation of the server.
I made sure that the versions are the exact same version, only difference is the License which is a real License on our production environment and a Dev License on the VM.
Anyone got an idea why this is happening? Maybe some way to get a more detailed Exception?
Edit: Trying to use the TfsConfig registerDB command throws an expection:
TFS30040: The database is not correctly configured. Contact your Team Foundation Server administrator
First, please make sure you are a member of the Team Foundation Administrators security group and a member of the sysadmin security group for any SQL Server databases that the new Team Foundation Server uses.
Usually this kind of issue should be solved after giving proper database permissions to the user.
Besides, after the configuration you can try RemapDBs to redirect TFS to its databases.
Back to the error: TF30040: The database is not correctly configured. Contact your Team Foundation Server. Here is a similar thread for your reference: TF30040: The database is not correctly configured
Moreover, you could also check the event view on your VM, if there are some more detail error message for troubleshooting.
Did you detach the collection in the TFS admin console before taking the backup on your 2013 server?
When you detach the collection is moves all of the relevant data from the TFS configuration database in to the collection database. You can then take a backup of the collection database and restore it to the new SQL server instance.
Note that detaching the collection will take it offline until the backup is complete and you re-attach the collection.
Then the new version of TFS should be able to see the collection and attach it. This will copy the configuration data to the new configuration database and you'll be able to bring the collection online.
So steps are
Detach collection in TFS 2013
Take backup of the TFS 2013 collection DB
Re-attach the TFS 2013 collection so that users can continue to use the collection whilst you test your upgrade
Copy the backup to the 2018 server
Restore the backup
In the TFS 2018 Admin console attach the collection
Once you're happy that the upgrade will go smoothly repeat the process but skip step 3.
Managed to do it by following this guide : https://cromwellhaus.com/2013/08/restoring-tfs-2012-to-sandbox/
Short Version: I was missing the config database, it was quite easy once I was using the old config.

SQL Database does not show up after copying it to (localdb)\MSSQLLocalDB in "sql server object explorer" visual studio 2015

After the Crash of my Laptop I was able to recover the data that I had on the hard drive. In the meantime I have a new Laptop and I'm restoring my last ASP.NET MVC Core Project in Visual Studio 2015 (Community).
In this Project I've created a database using EF Core Code First.
In SQL Server Object Explorer (on my old Laptop) the database was showing up.
Visual Studio saved the data under the path "C:\Users\USERNAME".
In appsetting.json the Connection string was "DATABASEDbConnection": "Server=(localdb)\\mssqllocaldb;Database=DATABASE_v1;Trusted_Connection=True;MultipleActiveResultSets=true".
My new Laptop has the exact Name of the old one.
I've copied the database in the same Location as before.
But:
the database does not Show up in SQL Server Object Explorer, and I have no idea how to bind it again
if I try to run my Project I get this error:
SqlException: Cannot open database "DATABASE_v1" requested by the login. The login failed Login failed for user 'USER-PC\USER.
How can I bind again my database?
After googling a couple of hours, I've found the solution.
I started Microsoft SQL Server Management Studio and added a reference to (localdb)\MSSQLLOcalDB and from there it was possible to bind my database located in C:\Users\USERNAME.
The localdb instance in VS seems to be influenced by SQL Server Management Studio. The latter rules binding to user's DBs.
I'm wondering why localdb does not start authomatically when running SQL Server Management Studio.

Complicated TFS 2017 Upgrade

I wish to upgrade my current TFS 2015.3 instance to 2017. It's not going to be quite as easy as advertised, however, due to some complicating factors. My scenario appears to be undocumented.
I'll be installing a new domain controller (moving from Server Essentials 2012 R2 to Server Essentials 2016).
The current OS is Server 2012 R2; I will be upgrading this as well, to Server 2016 (a clean install to a new VM).
Both of these new VMs must retain the same NETBIOS names as before.
The current SQL Server instance is 2014; I will be upgrading this as well, to SQL Server 2016.
The SQL Server instance for the current TFS instance is on a separate VM. I would like to consolidate this and put everything on a single VM. (I'm a solo developer putting a very light load on my server and I want to shed the extra complexity and overhead.)
Is it merely a matter of installing TFS 2017 and restoring from a 2015.3-generated backup? Will 2017 automatically apply any schema changes etc. during the restore process? Could it be that simple?
The closest question I could find to this is here, but unfortunately it doesn't quite address my situation.
Instead of doing a detach/attach upgrade there is another option available to you. detach/attach upgrades have had issues in the past and though most of these issues have been fixed, it's considered a suboptimal solution.
Instead, perform an Upgrade Installation.
Take a full backup of all your TFS 2015u3 databases and restore them to the new SQL server instance. You can create the full backup using the Team Foundation Server Admin Console, or use SQL Server Management Studio after stopping all TFS services on each Application Tier (in your case there is probably only one) using
TFSServiceControl quiesce
Now install TFS 2017 and perform the "upgrade" installation and point it to your existing databases. It will ask you if you want to upgrade them and whether you have a valid backup.
And after some time (upgrades can take a while, as data is moved around the databases), your TFS server will come back online. The installation wizard usually does all the mapping work required.
There is one big caveat, and that has to do with domain changes. If you are
installing in the same Windows Active Directory domain, you're good. But if your server is running in Workgroup mode you may want to remap all the identities in your TFS database prior to running the upgrade step. So install TFS, but do not configure yet. Run the following command
TFSConfig Identities /change /fromdomain:Domain1 /todomain:Domain2
Then use the upgrade option to have TFS use your database backups. The full explanation on doing a cross domain server migration is documented on MSDN. Be sure to safeguard your pre-upgrade backup until you've verified a successful upgrade.
We face almost the same thing, as our server was created for TFS 2013 and therefore has SQL 2012 installed.
Yes, it actually is as easy as your question states. When you attach the collection that you restored form the backup all the schema changes will be applied. Before then you configure the app tier of TFS and skip
An important thing though is to detach the collection before doing the backup. This copies various configuration into the collection database so that it is self-contained and can be moved to another server. You then only move the collection database to the new server.
Here is how in list form:
Detach collection using TFS Admin Console
Backup collection database using SSMS, e.g. Tfs_YourCollection
Restore collection database on new server using SSMS
Install TFS
Configure app tier, skip creation of new DefaultCollection
Attach collection in the TFS Admin Console, might take some time depending on your collection size.
You can do 4+5 before 3.
Note: Changing domain can add complexity. SharePoint and Reporting sites are not migrated!

Having issues with my TFS 2013 Installation after the previous installation expires

I have previously Install the TFS 2013 pre-lease,create team project everything was working fine util the license expired,giving me only one option that is to uninstall and reinstall.
I Now install new instance of tfs 2013,I created a report server do all the configuration,tested the url and it works fine.But when i try to configure the TFS In a stadard single server mode. i keep getting error when its configuring the report. Am new to this Technology but i did not face such issues during my first installation.The report server and the tfs are both on the same server.But the database am using is on a name instance.
here is the error i keep getting:
TF255324: The database that you specified cannot be created because a database already exists with that name. The database name is: Tfs_Warehouse. The server hosting the database is: URANUS\dev. You can use one of the three following options.
• If the database is a valid database from a previous version of Team Foundation Server and you want to upgrade it, you must use the Upgrade from Previous Version Wizard.
• If the database is a valid database from the current version of Team Foundation Server and you want to use it, you must use the Application Tier Only Wizard.
• If the database is a valid database used by another Team Foundation Server instance and you wish to create a new database, you must use the advanced wizard to supply a different SQL Server instance or database label.
For more information, see the readme file and the installation guide for Team Foundation.
The following database already exists, but cannot be used as part of this installation of Team Foundation Server: Tfs_Configuration. The database is hosted on the following server: URANUS\dev. You can manually delete or rename this database before you continue, but it is not required. If you do not, the database will be renamed as part of the installation process.
TF400080: Your system does not have the recommended amount of system memory available: 10 GB. While SharePoint 2013 with Team Foundation Server can operate with less than this amount of memory, the performance will be degraded. Upgrade your system memory to at least the recommended minimum for optimal performance.
TF255142: Windows Firewall is not enabled. If you enable Windows Firewall after configuring Team Foundation Server, you must add exceptions for ports used by Team Foundation Server to Windows Firewall.
Enabling legacy trace logging for SharePoint. Upon completion of installation or upgrade, legacy trace logging will be returned to its original status.
I suggest you to upgrade your TFS 2013, by using http://aka.ms/TFSUpgradeWeekend.
link : http://blogs.msdn.com/b/briankel/archive/2013/08/23/register-now-for-team-foundation-server-2013-upgrade-weekend.aspx
Remark : Enter your credentials on MSDN

Backing up TFS manually because TFS/Sharepoint Integration is hosed

After an ill-advised DCPROMO on our TFS server, and subsequent demotion, TFS continues to work but the SharePoint integration is totally hosed. SharePoint app pool refuses to run as a "Network Service" and so does SQLEXPRESS service. Unless there is some way to fix this, which I have not been able to find, I would like to totally re-install Windows Server 08 and TFS on our server. However, while trying to create a backup plan, I received an error relating to the fact that TFS cannot access MS SQL because of permissions issues. I would like to reliably and manually back up all TFS source control/history (I'm not worried about SP stuff at all, we haven't used it yet) and then restore it after I've re-installed stuff. Is this possible?
If you haven't really used ssrs/sharepoint etc you should be able to fairly easily detach any project collections and just migrate their databases to the new server. Each project collection only has one database normally named Tfs_{CollectionName}. The move the database to the new server with TFS already installed on it, restore the databases and attach them in the management console. http://msdn.microsoft.com/en-us/library/dd936138.aspx
Otherwise the recent versions of the TFS Server Power Tools have added a backup tab to the TFS management console which should be able to run you through making a backup. http://blog.hinshelwood.com/creating-a-backup-in-team-foundation-server-2010-using-the-power-tools/

Resources