Creating Backup via maintainDB command-line tool
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 databases. You can also create data backup using web UI.
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.
The default format of the backup file name is
<timestamp> suffix is added in the
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
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, and so on) 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
--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
To create the backup file in a custom directory, run maintainDB with the
maintainDB Startup Options
If you customize TeamCity server startup options via
TEAMCITY_SERVER_OPTS/TEAMCITY_SERVER_MEM_OPTS environment variables or use custom JDK installation to run the server, you might need to run
maintainDB script with related options added into
TEAMCITY_MAINTAINDB_OPTS/TEAMCITY_MAINTAINDB_MEM_OPTS environment variables and run the script with all the same environment as the TeamCity server, so that the same JVM is used.