/*============================================================================
  File:     6_Restore_TailLog.sql

  Summary:  This script shows how to restore a tail-log backup
			for a database.

  Date:     April 2015

  SQL Server Version: 2005/2008/2008R2/2012
------------------------------------------------------------------------------
  Written by Erin Stellato, SQLskills.com

  For more scripts and other useful content, go to:
	http://www.SQLskills.com

  This script is intended only as a supplement to demos and lectures
  given by Erin Stellato.  
  
  THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 
  ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED 
  TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  PARTICULAR PURPOSE.
============================================================================*/

USE [master]
RESTORE DATABASE [AdventureWorks2014] 
	FROM  DISK = N'C:\Backups\SQL2014\AW2014_BaseFull.bak' 
	WITH  FILE = 1,  
	NORECOVERY, 
	REPLACE,
	STATS = 5;
GO

RESTORE LOG [AdventureWorks2014] 
	FROM  DISK = N'C:\Backups\SQL2014\AW2014_TLog1.trn' 
	WITH  FILE = 1,  
	NORECOVERY,  
	STATS = 5;
GO

RESTORE LOG [AdventureWorks2014] 
	FROM  DISK = N'C:\Backups\SQL2014\AW2014_TLog2.trn' 
	WITH  FILE = 1,  
	NORECOVERY,  
	STATS = 5;
GO

RESTORE LOG [AdventureWorks2014] 
	FROM  DISK = N'C:\Backups\SQL2014\AW2014_TLog3.trn' 
	WITH  FILE = 1,  
	NORECOVERY,  
	STATS = 5;
GO

RESTORE LOG [AdventureWorks2014] 
	FROM  DISK = N'C:\Backups\SQL2014\AW2014_TLog4.trn' 
	WITH  FILE = 1,  
	NORECOVERY,  
	STATS = 5;
GO

RESTORE LOG [AdventureWorks2014] 
	FROM  DISK = N'C:\Backups\SQL2014\AW2014_TailLog.trn' 
	WITH  FILE = 1,  
	NORECOVERY,
	STATS = 5;
GO


RESTORE DATABASE [AdventureWorks2014]
	WITH RECOVERY;
GO

USE [AdventureWorks2014];
GO

SELECT [FirstName], [LastName]
FROM [Person].[Person]
WHERE [FirstName] = 'Bruce';
GO

SELECT [FirstName], [MiddleName], [LastName]
FROM [Person].[Person]
WHERE [FirstName] = 'Logan';
GO
