Događaji
M03 31 23 - M04 2 23
Najveći događaj učenja jezika SQL, platforme Fabric i platforme Power BI. 31. mart - 2. april Koristite kod FABINSIDER da uštedite 400 dolara.
Registrirajte se danasOvaj preglednik više nije podržan.
Nadogradite na Microsoft Edge da iskoristite najnovije osobine, sigurnosna ažuriranja i tehničku podršku.
Applies to:
SQL Server
This topic is relevant only for databases that are using the full or bulk-logged recovery models.
You can use a log sequence number (LSN) to define the recovery point for a restore operation. However, this is a specialized feature that is intended for tools vendors and is unlikely to be generally useful.
LSNs are used internally during a RESTORE sequence to track the point in time to which data has been restored. When a backup is restored, the data is restored to the LSN corresponding to the point in time at which the backup was taken. Differential and log backups advance the restored database to a later time, which corresponds to a higher LSN. For more information about LSNs, see the SQL Server Transaction Log Architecture and Management Guide.
Bilješka
LSNs are values of data type numeric(25,0). Arithmetic operations (for example, addition or subtraction) are not meaningful and must not be used with LSNs.
The LSN of a log record at which a given backup and restore event occurred is viewable using one or more of the following:
Bilješka
LSNs also appear in some messages in the error log.
By using a RESTORE statement, you can stop at or immediately before the LSN, as follows:
Use the WITH STOPATMARK ='lsn:<lsn_number>' clause, where lsn:<lsnNumber> is a string that specifies that the log record that contains the specified LSN is the recovery point.
STOPATMARK roll forwards to the LSN and includes that log record in the roll forward.
Use the WITH STOPBEFOREMARK ='lsn:<lsn_number>' clause, where lsn:<lsnNumber> is a string that specifies that the log record immediately before the log record that contains the specified LSN number is the recovery point.
STOPBEFOREMARK rolls forward to the LSN and excludes that log record from the roll forward.
Typically, a specific transaction is selected to be included or excluded. Although not required, in practice, the specified log record is a transaction-commit record.
The following example assumes that the AdventureWorks
database has been changed to use the full recovery model.
RESTORE LOG AdventureWorks FROM DISK = 'c:\adventureworks_log.bak'
WITH STOPATMARK = 'lsn:15000000040000037'
GO
Restore a Database to the Point of Failure Under the Full Recovery Model (Transact-SQL)
Restore a Database to a Marked Transaction (SQL Server Management Studio)
Restore a SQL Server Database to a Point in Time (Full Recovery Model)
Apply Transaction Log Backups (SQL Server)
The Transaction Log (SQL Server)
RESTORE (Transact-SQL)
Restore and Recovery Overview (SQL Server)
SQL Server Transaction Log Architecture and Management Guide
Događaji
M03 31 23 - M04 2 23
Najveći događaj učenja jezika SQL, platforme Fabric i platforme Power BI. 31. mart - 2. april Koristite kod FABINSIDER da uštedite 400 dolara.
Registrirajte se danasObučavanje
Modul
Back up and restore your Azure SQL database - Training
Learn how to protect the data in your Azure SQL database and recover from data loss or corruption with backup and restore.
Dokumentacija
backupset (Transact-SQL) - SQL Server
Contains a row for each backup set. A backup set contains the backup from a single, successful backup operation.
Restore a Transaction Log Backup (SQL Server) - SQL Server
This article describes how to restore a transaction log backup in SQL Server by using SQL Server Management Studio or Transact-SQL.
SQL Server transaction log architecture and management guide - SQL Server
The SQL Server transaction log is a critical component. Learn about its architecture and how to manage it.