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.
To run the
listLocks command, you can specify the driver, classpath, and URL in your
liquibase.properties file. For more information, see Creating and configuring a liquibase.properties file. You can also specify these properties in your command line.
Then run the
liquibase –-changeLogFile=mainchangelog.xml listLocks
Note: Enter the name of the changelog you want to use in place of
main-changelog.xml. You can also add the
changeLogFile to your
listLocks global attributes
||The root changelog||Required|
||The database username||Required|
||The database password||Required|
||The JDBC database connection||Required|
Note: The username and password attributes are not required for connections and systems which use alternate means of authentication.
listLocks command produces the following output when there is no lock on the table:
Liquibase Pro 3.9.0 by Datical licensed to Liquibase Pro Customer until Tue Sep 22 19:00:00 CDT 2020 Database change log locks for HR_DEV@jdbc:oracle:thin:@support.datical.net:1521:ORCL - No locks Liquibase command 'listLocks' was executed successfully.
listLocks command produces the following output when there is a lock on the table:
Liquibase Community 3.9.0 by Datical Database change log locks for db2inst1@jdbc:db2://localhost:50000/sample2 - 2605:6000:101c:686:486:f4ae:82fe:3c99%en0 (2605:6000:101c:686:486:f4ae:82fe:3c99%en0) at Jul 6, 2020, 4:45:38 PM Liquibase command 'listlocks' was executed successfully.