Configuration version is XXX but Database version is YYY
Last modified: 20 April 2023If you have several TeamCity Data Directories (the one used by TeamCity server, and, for example, an obsolete one) with the "database.properties
" files that point to the same database; and wrong directory is specified during upgrade, you get the following exception: "Database version mismatch: Configuration version is XXX but Database version is YYY", where XXX is less than YYY.
The best way to solve the problem is to recover all data from saved copies and to perform upgrade again with proper data directory. If you don't have saved copies, you can do one of the following:
Drop Build/Test History and User Accounts
Simply drop all tables in the database. TeamCity server on startup creates all neccessary tables if database is completely empty. Once the server is started all configurations will be accessible, but build history and test history will be empty.
Try to Recover Data
The scenario below helps to recover as much data as possible.
Locate the data directory your TeamCity installation is running with. When the server is not operable you can peek this value from the logs (the "
teamcity-server.log
" file), look through it for a line like the following one:note
INFO - dServer.serverSide.ServerPaths - TeamCity data directory: C:/TeamCity/.BuildServer/
Back up both database and data directory.
On another computer make a new TeamCity installation of previous version (XXX) with a new data directory and new internal database. Start it once (to create an empty database) and then shut it down.
Clear the new data directory (just remove all files and subdirectories from it) and populate it with the content of the production data directory. Then delete the "
config/database.properties
" file.Start this TeamCity server, ensure that it does work and there are all your projects and build configurations. Shut the server down.
Perform upgrade to the new version of TeamCity (YYY). See the upgrade notes in the TeamCity documentation corresponding to the TeamCity version you're upgrading to.
Start the TeamCity server and ensure that it works the shut it down again.
Delete the following files:
config/database.properties
(if exists)system/buildserver.*
Replace the production data directory with one you have got by this upgrade. Ensure the production "
database.properties
" file points to the right database.Start the production system. This should work in most cases.
This scenario, however, doesn't guarantee to fix the problem. Moreover, some data may be corrupted because the upgrading data directory and database were not synchronized - so follow it only if you have no saved copies.
Thanks for your feedback!