Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Script to restore all the Transaction log Expand / Collapse
Author
Message
Posted Thursday, April 10, 2008 7:53 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, January 9, 2014 1:57 AM
Points: 30, Visits: 168
Hi ,

How can i restore bunch of Transaction log backup with out restoring one at a time. Which
is very time consuming.
Few time after the full database restore i have to manually applied all the transaction log backup
manually.Any help will be appreciated.

Regards
Hammad khan
Post #483039
Posted Thursday, April 10, 2008 8:31 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Thursday, November 20, 2014 9:39 AM
Points: 870, Visits: 911
Since you're using SQL 2000 you could potentially use a combination of xp_dirtree and xp_getfiledetails to automate this. Here's a basic template for what you'd need to do.

It's dependant on several things but it's possible. Hope this helps.

--create a temp table called #files with 3 columns

--insert contents of backup directory into table
insert into #files exec exec xp_dirtree 'c:\sqlbackup\log\', 1, 1

--delete rows from table that aren't files
delete #files where [file] <> 1

--now cursor through the rows in #files and for each file, use master.dbo.xp_getfiledetails 'file name' to find out when the file was created.

--if you store the timestamp in the filename then you won't need to use xp_getfiledetails




Karl
source control for SQL Server
Post #483069
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse