SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Script to restore all the Transaction log


Script to restore all the Transaction log

Author
Message
Hammad khan
Hammad khan
Valued Member
Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)

Group: General Forum Members
Points: 52 Visits: 193
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
SQLZ
SQLZ
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1256 Visits: 940
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search