Creating Backup via maintainDB command-line tool
In TeamCity you can back up server data, restore it, and migrate between different databases using single maintainDB.bat|sh
utility. For the data backup, TeamCity also provides web UI part, in the Creating Backup from TeamCity Web UI of TeamCity web UI.
maintainDB
utility is located in the <TeamCity Home>/bin
directory. That is only available in TeamCity .tar.gz and .exe distributions. To get short reference for all available maintainDB
options, run maintainDB
from command line with no parameters.
Backing up Data
TeamCity allows backing up the following data:
Server settings and configurations, which includes all server settings, properties, and project and build configuration settings
Database
Build logs
Personal changes
Custom plugins and database drivers installed under TeamCity Data Directory.
Backup of the following data is not supported:
build artifacts (because of their size). If you need the build artifacts, please also backup content of
<TeamCity Data Directory>/system/artifacts
directory manually.TeamCity application manual customizations under
<TeamCity server home>
, including used server port numberTeamCity application logs (they also reside under
<TeamCity server home>
.Any manually created files under
<TeamCity Data Directory>
that do not fall into previously mentioned items.
By default, if you run maintainDB
utility with no optional parameters, build logs and personal changes will be omitted in the backup.
The default directory for the backup files is the <
>
\backup
.
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
To create data backup file, from the command line start maintainDB
utility with the backup
command:
maintainDB.[cmd|sh] backup
To specify type 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
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 backup -C -D -L -P
If backup is started when the TeamCity server is running, running and queued builds are not included into backup. If the TeamCity server is shut down, all builds are included into backup.
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:
maintainDB.cmd backup -F <backup file custom name> or maintainDB.cmd backup --backup-file <backup file custom name>
The above command will result in creating new zip-file with specified name in the default backup directory.
To add timestamp suffix to the custom filename, add -M or --timestamp option:
maintainDB.cmd backup -F <backup file custom name> -M or maintainDB.cmd backup -F <backup file custom name> --timestamp
To create backup file in the custom directory, run maintainDB with -F option:
maintainDB backup -F <absolute path to the custom backup directory> or maintainDB backup --data-dir <absolute path to the custom backup directory>