FIX: ALTER DATABASE SET READ_ONLY Statement May Lead to an Assertion If the Transaction Log is Full
Symptoms
If the following conditions are true, SQL Server may encounter an assertion followed by an Access Violation (AV), which may then cause the server to either shut down or become unresponsive:
An ALTER DATABASE Set Read_Only statement has been issued on a database.The transaction log of the database on which the ALTER DATABASE statement is being run is full.
Resolution
When an ALTER DATABASE SET READ_ONLY statement is executed on a database, SQL Server must: Shut down the database cleanly by issuing a CHECKPOINT statement.Update the status in the Master..Sysdatabases system table for that database.Bring the database back up with the new status. However, if the transaction log is full, a CHECKPOINT record cannot be written to the database and it raises an error. SQL Server ignores this error and incorrectly continues to update the status in Master..Sysdatabases. As a result, when the database is brought back up again, the status is set to read-only but SQL Server continues to try to perform a recovery on a read-only database; therefore, an Assertion occurs.

Leave a Reply