How SQL Lock works
Published 05 January 2016
SQL Lock creates a database named RedGate with the following objects:
| Object name | Object type | Purpose |
|---|---|---|
| [dbo].[LockedObjects] | Table | Stores locks on objects |
| [dbo].[GetLockedObjects] | Stored procedure | Retrieves locked objects from [dbo].[LockedObjects] |
| [dbo].[IsObjectLocked] | Stored procedure | Checks if objects are locked |
| [dbo].[LockObject] | Stored procedure | Locks objects |
| [dbo].[UnlockObject] | Stored procedure | Unlocks objects |
| [RedGate_CheckForLockedObjectOnDDLChange] | Trigger | Detects when someone tries to modify a locked object |
You can review the script to before you run it.
After the script runs, you can use the SQL Lock interface to lock and unlock objects, or lock objects manually by running SQL.