You are viewing the documentation of TeamCity 9.x, which is not the most recently released version of TeamCity.
View this page in TeamCity 10.x and 2017.1 documentation or refer to the listing to choose the documentation corresponding to your TeamCity version.

Skip to end of metadata
Go to start of metadata

TeamCity .tar.gz and .exe distributions provide the maintainDB.bat|sh utility located in the <TeamCity Home>/bin directory.  This command-line tool enables you to back up the server data, restore it, and migrate between different databasesFor data backup, a web UI part is also available.

On this page:


Before You Backup

Before backing up data, it is recommended to shut down the TeamCity server to include all builds into the backup. If the backup process is started when the TeamCity server is up, running and queued builds are not included into the backup.

Backup File Location and Format

The default directory for backup files is the <TeamCity Data Directory>\backup.


If not specified otherwise with the -A option, TeamCity will read the TeamCity Data Directory path from the TEAMCITY_DATA_PATH environment variable, or the default path ($HOME\.Buildserver) will be used.

The default format of the backup file name is TeamCity_Backup_<timestamp>.zip; the <timestamp> suffix is added in the 'YYYYMMDD_HHMMSS' format.

Performing TeamCity Data Backup with maintainDB Utility

This section describes some of the maintainDB options. For a complete list of all available options, run maintainDB from the command line with no parameters.

To create data backup file, from the command line start maintainDB utility with the backup command:

TeamCity data backup has some limitations. By default, if you run maintainDB utility with no optional parameters, only the database, server settings, projects and builds configurations, plugins and supplementary data (settings history, triggers states, plugins data, etc.) will be backed up, omitting build logs and personal changes.

Configuring backup scope

To configure the scope of data to include in the backup file, use the following options:

  • -C or --include-config — includes build configurations settings
  • -D or --include-database — includes database
  • -L or --include-build-logs — includes build logs
  • -P or --include-personal-changes — includes personal changes
  • -U or --include-supplementary-data — includes supplementary (plugins') data

Specifying different combinations of the above options, you can control the content of the backup file. For example, to create backup with all supported types of data, run

maintainDB Usage Examples for Data Backup

To create backup file with custom name, run maintainDB with -F or --backup-file option and specify desired backup file name without extension:

Executing the command above will create a new zip-file with the specified name in the default backup directory.

To add the timestamp suffix to a custom filename, add -M or --timestamp option:

To create the backup file in a custom directory, run maintainDB with the -F option:

See also: