![]() The transaction log is scanned for active portions which contain information about transactions that were not yet committed. Think of the transaction log as a replay button. That’s because it goes through a process called crash recovery, because there’s no way for the service to know with 100% certainty that it started cleanly for each database. When SQL Server starts up, sometimes it can take a while for a database to come back online again. There are cases where operations from the original query may cause changes to the physical database and file structure, which may not be undone exactly, but the rollback will ensure that the database is at least in a consistent state and that any data modifications performed during a failed transaction are reversed. Yes, that generates even more logs as it makes changes to the database to perform the rollback, until the database is in a state that is equivalent to the moment just before the transaction began. If there’s a failure, the rollback will “undo” all the logs to that point from the starting marker (called an LSN, or Log Sequence Number in SQL Server). Every single modification in the database must be recorded in the transaction log as it occurs, and each modification has to have a start and an end marker. It doesn’t just keep track of successful changes in the database. This is why the transaction log on SQL Server is so important. Isolation does not prevent more than one change on the same data, nor is it designed to.ĭurable – once the transaction has been committed, that data is now persisted, and any failure that occurs after the commit will not affect the durability of the operation. If your transaction starts before mine, your change will go through first, and then mine will go through. That does not mean that you and I cannot update the same column in the same table. Isolated – when I run an operation, it should not impact how you run an operation. When we see a failure due to this type of error, the database must revert back to a known state again. If something goes wrong, the entire transaction should go back to a previously known state.Ĭonsistent – the data has to follow the internal rules of the database structure, including (but not limited to) data types, foreign key constraints, and default constraints. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |