SELECT LOCKED FROM public.databasechangeloglock WHERE ID=1 1

SELECT LOCKED FROM public.databasechangeloglock WHERE ID=1

UPDATE DATABASECHANGELOGLOCK SET LOCKED=FALSE, LOCKGRANTED=null, LOCKEDBY=null where ID=1;

Here is what the above code is Doing:
1. It’s checking if the database is locked.
2. If it is locked, it’s checking if the lock was granted more than 5 minutes ago.
3. If the lock was granted more than 5 minutes ago, it’s releasing the lock.
4. If the lock was granted less than 5 minutes ago, it’s throwing an error.
5. If the database is not locked, it’s locking the database.

Similar Posts