LSN

LSN

LSN(Log Sequence Numbers)

·       The log sequence number is a unique id assigned to all entries in the transaction log. The LSN gives an ordered list of changes to a database.
·   LSNs are not a backup-specific entity but are part of the transaction processes that SQL Server utilizes.
·        Whenever there is any change in database the LSN will create.
·        The backupset table in msdb. The columns are named first_lsn and last_lsn.

·        The RESTORE HEADERONLY statement. The columns are named FirstLSN and LastLSN.



Viewing LSNs 

backupset
first_lsn,last_lsn,checkpoint_lsn
backupfile
read_only_lsn,read_write_lsn,differential_base_lsn
sys.database_files; 
sys.master_files
create_lsn, drop_lsn, read_only_lsn,
read_write_lsn, differential_base_lsn,
redo_start_lsn, redo_target_lsn ,backup_lsn
RESTORE HEADERONLY
RESTORE HEADERONLY  FROM DISK =
N'C:\AdventureWorks2008R2-FullBackup.bak'  
WITH NOUNLOAD;  return the information in the
header for the disk file
RESTORE FILELISTONLY
RESTORE FILELISTONLY FROM
AdventureWorks2008R2Backups WITH FILE=2; 
Returns a result set containing a list of the
database and log files contained in the backup set.



RESTORE LOG AdventureWorks FROM DISK = 'c:\adventureworks_log.bak'
WITH STOPATMARK = 'lsn:15000000040000037'
GO

No comments:

Post a Comment

Popular Posts