What is SCH S lock?
Elijah King
Updated on March 15, 2026
What is SCH S lock?
A Sch-S lock is a Schema stability lock. It is taken to ensure that the structure of the table doesn’t change. This includes adding/removing columns, etc. NOLOCK hints and isolation levels affect the locking and versioning of the data in the table, not the structure of the table itself.
What is S lock in SQL Server?
The below image illustrates the lock hierarchy of SQL Server. Shared (S) Locks: This lock type occurs when the object needs to be read. This lock type does not cause much problem. Exclusive (X) Locks: When this lock type occurs, it occurs to prevent other transactions to modify or access a locked object.
What causes Lck_m_sch_s?
A transaction is waiting to acquire a schema stability lock. This lock is used when queries are being compiled and executed. It doesn’t block transactional locks such as exclusive locks (LCK_M_X), so other transactions can run concurrently while this lock is in place.
How do I stop a page lock in SQL Server?
Useful ways to avoid and minimize SQL Server deadlocks
- Try to keep transactions short; this will avoid holding locks in a transaction for a long period of time.
- Access objects in a similar logical manner in multiple transactions.
- Create a covering index to reduce the possibility of a deadlock.
What is a shared lock?
Shared locks exist when two transactions are granted read access. One transaction gets the shared lock on data and when the second transaction requests the same data it is also given a shared lock. Shared locks last as long as they need to last; it depends on the level of the transaction that holds the lock.
Do transactions lock tables?
A transaction acquires a table lock when a table is modified in the following DML statements: INSERT , UPDATE , DELETE , SELECT with the FOR UPDATE clause, and LOCK TABLE .
Which are two types of lock in SQL?
At the table level, there are five different types of locks:
- Exclusive (X)
- Shared (S)
- Intent exclusive (IX)
- Intent shared (IS)
- Shared with intent exclusive (SIX)
What is database lock in SQL?
What is a database lock in the context of SQL? When two sessions or users of database try to update or delete the same data in a table, then there will be a concurrent update problem. In order to avoid this problem, database locks the data for the first user and allows him to update/delete the data.
What is Lck_m_sch_s?
LCK_M_SCH_S is a schema stability lock. This lock is used when queries are being compiled and executed. Lengthy blocking by this type of lock suggest you have a long running query in one or more of your databases. Other than batches these long running queries there is no easy way to get around this type of lock.
How do you clear a SQL lock?
Type “Kill ” into the command prompt, and press “Enter.” Replace “Session ID” with the session ID number you wrote down in Step 2. This kills the user’s session and the SQL lock that was created.
What causes SQL database locks?
What is shared lock in SQL?
A shared lock reserves a resource (page or row) for reading only. Other processes cannot modify the locked resource while the lock remains. On the other hand, several processes can hold a shared lock for a resource at the same time—that is, several processes can read the resource locked with the shared lock.
What is sch1 and sch2 in SQL?
1 = Sch-S (Schema stability). Ensures that a schema element, such as a table or index, is not dropped while any session holds a schema stability lock on the schema element. 2 = Sch-M (Schema modification).
What is an example of a shared lock in SQL Server?
A typical example of this lock is when a transaction is using a query executed with the PAGELOCK hint and query, then the update query. After the transaction acquires an SIU lock on the table, the query with the PAGELOCK hint will acquire the shared (S) lock while the update query will acquire intent update (IU) lock
What happens when an object is locked in SQL Server?
While objects are locked, SQL Server will prevent other transactions from making any change of data stored in objects affected by the imposed lock. Once the lock is released by committing the changes or by rolling back changes to initial state, other transactions will be allowed to make required data changes.
Is it possible to block A SCH-s Lock?
In short – the ONLY operation that should block a SCH-S held lock would be a SCH-M lock. So the only way this would be happening would be someone is modifying a table’s STRUCTURE whilst you are querying the table’s data. My guess is you are really on a goose chase, and the issue is #2, though.