listLocks returns the hostname, IP address, and the timestamp the Liquibase lock record was added to the DATABASECHANGELOGLOCK table.


listLocks is typically used when an error occurs during a database deployment. The error might indicate that there is a lock record in the DATABASECHANGELOGLOCK table by another user that is preventing Liquibase from applying changes to the specified database.

listLocks will read the DATABASECHANGELOGLOCK table and return a list that includes the hostname, IP address, and the timestamp the lock record was granted to the DATABASECHANGELOGLOCK table and determines the connections to the DATABASECHANGELOGLOCK table based on the database URL.

Running the list-locks command

To run the list-locks command, specify the driver, classpath, and URL in the Liquibase properties file. For more information, see Specifying Properties in a Connection Profile. You can also specify these properties in your command line.

Then run the list-locks command:

liquibase –-changelog-file=mainchangelog.xml list-locks

Note: Enter the name of the changelog you want to use in place of main-changelog.xml. You can also add the changelog-file to the properties file.

list-locks global attributes

Tip: All commands and parameters use the --kebab-case format in the CLI environment. This is the format Liquibase recommends for best results. If your preference is camelCase, it will still work in the CLI.

Attribute Definition Requirement
--changelog-file The root changelog Required
--username The database username Required
--password The database password Required
--url The JDBC database connection Required

Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.