Moving external TeamCity database to new server; keeping application untouched


We have one server that has the TeamCity application.  Another server has the external database on there.  This machine is getting old and needs to be retired.  We have a new server for the database.

The only thing that will be moving is the external database, not the application itself.

The documentation I have seen talks about moving to an external database and all of these other methods that just doesn't make sense.

Can't I just do this:

1. Stop the TC services

2. Take the current database on "DB server one" and drop it from the server.  Copy the two database files over to the new server and attach it on "DB server two".

3. Open the "" file and modify the line from:




4. Start up all of the services.

I would think that this would work fine.  I searched the entire directory structure for DBSERVER1 (not the real name) in every file and other than log files and xml files from builds, the "database.properites" was it.  I believe that changing that to DBSERVER2 (again not the real name) and leaving the application untouched, this should be fine moving the database to a new server.

Thoughts?  Concerns?  If I am incorrect, please let me know what I need to follow in the help section to accomplish this.


1 comment
Comment actions Permalink

Hello Eric,

As long as you make sure the SQL Server login with the same login/password pair is linked to the database on the new server, I believe it should work for you. Probably you`d also want to leave original DB intact and just copy it over to the new server, so you would have a quick rollback option. 

The approach we usually recommend is to use maintainDB script; you could think of it as an interface of sorts, which handles not only the backup and restore, but also moving the data where required (build logs and artifacts which are stored outside of the DB). If you would aim to move the whole installation (including TeamCity server) I would definitely recommend this approach, but given that you are using MS SQL Server (which boils down to BACKUP and RESTORE statements) and in the end only the DB server will be changed, you could take a simpler route. 

Just for the sake of completeness, here are the steps you`d have to take if you would use maintainDB script:
1) backup DB:

maintainDB.cmd backup -D

(-D would make sure just the DB backup is taken, w/o builds data)

2) update, particularly hostname if the rest is unchanged;

3) restore DB:

maintainDB.cmd restore -A <absolute path to TeamCity Data Directory> -F <path to the TeamCity backup file> -D (D switch for database restore only)

Please let me know in case of any questions or concerns and I will gladly assist.


Please sign in to leave a comment.