# Is there a way to add lock from command line?

**URL:** <https://forum.liquibase.org/t/is-there-a-way-to-add-lock-from-command-line/3070>\
**Category:** General Discussion\
**Created:** [July 23, 2014, 2:14pm UTC](https://forum.liquibase.org/t/is-there-a-way-to-add-lock-from-command-line/3070 "2014-07-23T14:14:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nvoxland](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@nvoxland](https://forum.liquibase.org/u/nvoxland)\
**Post date:** [July 23, 2014, 2:14pm UTC](https://forum.liquibase.org/t/is-there-a-way-to-add-lock-from-command-line/3070/1 "2014-07-23T14:14:00Z")

</div>

There isn’t a command line prompt to lock the database, but I could see it being helpful. I created&nbsp;[https://liquibase.jira.com/browse/CORE-1980](https://liquibase.jira.com/browse/CORE-1980) so the feature doesn’t get lost.

For now, you could call out to the java APIS: LockServiceFactory.getInstance().getLockService(database).lock() or something similar.

Or, you could create the databasechangeloglock table yourself and set the LOCKED column to 1. That is all liquibase uses to track the lock.

Nathan

---

<div class="post-metadata">

**Author:** ![GavrielFleischer](https://avatars.discourse-cdn.com/v4/letter/g/7ea924/32.png) [@GavrielFleischer](https://forum.liquibase.org/u/GavrielFleischer)\
**Post date:** [July 23, 2014, 2:14pm UTC](https://forum.liquibase.org/t/is-there-a-way-to-add-lock-from-command-line/3070/2 "2014-07-23T14:14:00Z")

</div>

Hi,

our development lifecycle includes the following steps:

1. create a clean DB

2. copy the schema + subset of data from prod

3. run liquibase update

Step 2 takes something like 2 hours, and the easiest would be to be able to do something like `liquibase lock "DB is being copied from prod"` before it, and `liquibase releaseLocks` after it, so that noone could accidentally start step 3 too early.
