Resolving Table Locks
- When users of a database are performing transactions, like updates and inserts, table locking occurs by default
- Two people cannot edit the same record at the exact same time
- lock ensures data integrity
- prevents objects that are currently in use from being harmed when commands are running and working on the data system
- all other objects have to wait for the lock to be released before any other edits can be applied
- locks are released when the transaction is committed
- There is an order to locking that prevents a lot of “accidents” in our data
- A row locks a page
- a page locks a table
- a table locks the database
- cannot delete/remove a table/record/database when it is in use/being edited
- There are reports that DBAs can use in SQL Server to see details about active transactions
- including what SQL statement is being blocked
- Knowing the locking order can be important when you are trying to determine the source of a lock