CMDBuild Command Line Interface (CLI)
The CMDBuild Command Line Interface (CLI) provides a set of utility commands designed to simplify the administration and maintenance of a CMDBuild instance.
Within the CMDBuild installation directory, a script named cmdbuild.sh is available in the CMDBuild Tomcat web application directory. This script exposes a custom command-line interface that allows administrators to perform a variety of common operations directly from the terminal.
These commands are designed to simplify routine administration tasks, providing a faster and more convenient way to perform database maintenance, import and export operations, validation procedures, and other administrative activities.
Database Configuration Commands
The cmdbuild.sh dbconfig command provides utilities for database creation, import/export, maintenance, validation, and anonymization.
Syntax and Options
cmdbuild.sh dbconfig [options] <method> [arguments]
| Option | Description |
|---|---|
-backuprestore | Enables backup-restore import mode, restoring all configurations contained in the dump |
-configfile <file> | Specifies the database configuration file. Defaults to conf/<webapp>/database.conf |
-dataonly | Imports only application data, excluding configurations except those strictly required by the data model (for example, multitenant settings) |
-excludelogs | Excludes the _Request, _JobRun, and _EventLog tables from dump operations |
-freezesessions | Freezes all active database sessions to prevent expiration during operations. This is useful when importing a bug report |
-interactive | Forces interactive execution mode |
-keepconfigs | Preserves local configurations for categories excluded from configuration import |
-singlecore | Uses a single CPU core during database restore operations. Useful when concurrency issues occur |
-skippatches | Skips database patch execution after import or creation |
-xzip | Compresses dumps using xzip, providing maximum compression at the cost of slower execution |
Available Methods
anonymize | anonymizedb
Creates an anonymized database dump. The anonymization process affects only attributes marked as anonymizable.
cmdbuild.sh dbconfig anonymize [temporary_database_name] [database_anonymized_dump]
check | checkdump
Validates a dump file and checks its consistency before import.
cmdbuild.sh dbconfig check [database_type|dump_to_import]
compactdb
Compacts the database by removing unnecessary data and optimizing storage usage.
cmdbuild.sh dbconfig compactdb
create
Creates a new database. Optionally, the database can be initialized from a supported dump file. Works only if the database does not already exist. If the database already exists, an error is returned.
cmdbuild.sh dbconfig create [database_type|dump_to_import]
recreate
Drops the existing database and recreates it, optionally importing data and configuration from the specified dump.
cmdbuild.sh dbconfig recreate [database_type|dump_to_import]
drop
Removes the configured database.
cmdbuild.sh dbconfig drop
dump
Creates a database dump and stores it in the specified target file.
cmdbuild.sh dbconfig dump [target_file]