lockandrun - Lock Database and Run Command


lockandrun [-d database] [-c command] [-m {READ|WRITE}] [table ...]

The lockandrun program allows you to run a command while all or specified tables in a database are locked. This can be useful to prevent tables being updated while backing them up. Once the command finishes the tables will be unlocked.

The -m option specifies the mode to lock the database. Use READ (the default) if you plan on reading the tables, e.g. for backup, and you want to allow users to search the tables. Updates will be blocked. WRITE can be used to prevent any other process from reading the table as well as writing to the table. This should be used with caution.

If you do not specify tables then every table in the database will be locked. Locking tables individually can be useful to reduce contention if the command might take a long time, and there are unrelated tables that do not need to be accessed in the same "lock". Added in version 4.03.10535 May 20 2003.


lockandrun -c "backup all"
lockandrun -d /db/live -c "backup some" table1 table2

Copyright © Thunderstone Software     Last updated: Oct 5 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.