--full backup of the database Backup database Community_Assist To disk= 'C:\Backups\Community_Assist.Bak' with init --create table after full backup and insert a record Create table Test2 ( TestKey int identity(1,1) primary key, TestDate DateTime default GetDate(), TestDescription nvarchar(255) ) Insert into Test2 (TestDescription) values('Table added after full backup.') --then we do the differential backup Backup Database Community_Assist To Disk='C:\Backups\Community_Assist.Bak' with differential Insert into Test2 (TestDescription) values('This record added after differential') --now backup the log use Master Backup log Community_Assist to disk ='C:\Backups\Community_Assistlog.Bak' with norecovery, no_truncate -- restore full backup (file 1) Restore Database Community_Assist From disk='C:\Backups\Community_Assist.Bak' with norecovery, file=1 --Resore Differential backup (file 2) Restore Database Community_Assist From disk='C:\Backups\Community_Assist.Bak' with norecovery, file=2 --restore the log Restore Log Community_Assist From disk='C:\Backups\Community_Assistlog.Bak' with recovery use Community_Assist Select * from Test2 /* Syntax for restoring to a moment in time RESTORE LOG AdventureWorks FROM AdventureWorksBackups WITH FILE=5, NORECOVERY, STOPAT = 'Apr 15, 2020 12:00 AM'; RESTORE DATABASE AdventureWorks WITH RECOVERY; */
Thursday, July 7, 2016
Backup Restore
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment