Comments
Sort by recent activity
thanks / comments
thanks
Hi Pete,
I don't this will work because Redgate will still processes all log files present in the log directory regardless of the log file timestamp.
What we have done is delay processing of individual log files by 4 hrs based on log file timestamp.
Ex.
We log backup our production database every 30 minutes and copy to standby. Our log ship job runs every hour and only processes the individual log files which are over 4 hrs. We have a custom script which looks at the individual log files in the log directory and grabs files based on filename timestamp to process.
ex. script
Declare int
Set @DelayMins = 240
create table #dir
(
[FileName] varchar(2000)
)
select @cmd = 'dir /B ' + @SourcePath + '*.sqb'
insert #dir exec master..xp_cmdshell @cmd
-- Delete anything which is not a log backup for this database
delete #dir
where [FileName] is null
or [FileName] not like '%.sqb'
or [FileName] not like '%^_log^_%' escape '^'
or [FileName] not like @DBName + '^_log^_%' escape '^'
-- Delete anything that is less than @DelayMins minutes old
delete #dir
where [FileName] > @LastFile
while exists (select * from #dir)
begin
select top 1 @filename = [FileName]
from #dir d
order by right([FileName],20)
if not exists (select 1 from #restores where [FileName] = @filename)
begin
print convert(varchar(25),getdate(),121) + ' Restoring ' + @DBName + ' from ' + @filename
set @StandByFile = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\UNDO_' + @DBName
-- Restore log
select @cmd = 'master..sqlbackup '
+ ' -SQL restore log '
+ @DBName
+ ' from disk = '''
+ @SourcePath
+ @filename
+ ''' with standby = '''
+ @StandByFile + ''''
exec(@cmd)
end / comments
Hi Pete,
I don't this will work because Redgate will still processes all log files present in the log directory regardless of the log file timestamp.
What we have done is delay processing of indivi...
Excellent idea!
Thanks! / comments
Excellent idea!
Thanks!