SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Database Restore Stratergy
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ahmeds08
Aged Yak Warrior

India
656 Posts

Posted - 08/30/2013 :  06:55:38  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
Dear Experts,
below is the backup strategy in place.
1.Daily Full backup at 2 AM.
2.Log backups every 15 mins.

If i had to restore the database to 5 AM.

I will restore the full backup of 2 AM and then i will restore all the log backups from 2:15 AM to the latest Log backup 5 AM.

is that right what i mentioned?



mohammad.javeed.ahmed@gmail.com

James K
Flowing Fount of Yak Knowledge

3707 Posts

Posted - 08/30/2013 :  08:25:09  Show Profile  Reply with Quote
That is mostly correct. If your goal is to get the database as it existed at exactly 5:00 AM use point in time recovery rather than relying on the log backup being correct upto 5:00 AM. So I would specify 5:00 AM as the point in time and use log backups including the one from 5:15. This page describes the step by step procedure. http://technet.microsoft.com/en-us/library/ms190982(v=sql.105).aspx

Also be sure to restore WITH NORECOVERY for the full backup and the log files and then do the WITH RECOVERY
Go to Top of Page

ahmeds08
Aged Yak Warrior

India
656 Posts

Posted - 08/30/2013 :  08:59:12  Show Profile  Send ahmeds08 a Yahoo! Message  Reply with Quote
Thank you James.

mohammad.javeed.ahmed@gmail.com
Go to Top of Page

Ifor
Aged Yak Warrior

590 Posts

Posted - 08/30/2013 :  09:23:47  Show Profile  Reply with Quote
Also, here is an old bit of outline WScript to help generate the RESTORE LOG commands.


var fso =  WScript.CreateObject("Scripting.FileSystemObject");

var fldr = fso.GetFolder(".");
var fenum = new Enumerator(fldr.files);
var File_Array = new Array();
var i = 0;

while (!fenum.atEnd())
{
	if
	(
		(fenum.item().Name).toUpperCase().search(/^YourDB/) != -1
		&&
		(fenum.item().Name).toUpperCase().search(/TRN$/) != -1
	)
	{
		File_Array[i++] = (fenum.item().Path);
	}
	fenum.moveNext();
}

if (File_Array.length > 0)
{
	try
	{
		var list = fso.createTextFile(".\\RestoreLog.sql", true);

		File_Array.sort();

		for (i = 0; i < File_Array.length; i++)
		{
			list.writeLine("RESTORE LOG YourDB FROM DISK = '" + File_Array[i] + "' WITH NORECOVERY;");
			list.writeBlankLines(1);
		}
	}
	catch(e)
	{
		throw(e);
	}
	finally
	{
		list.close();
	}
}
WScript.Echo("RestoreLog.sql has been generated.");

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000