September 20, 2016 at 10:08 pm
Hi,
I am not sure how would I explain, but here is what I am looking for. Suppose, I have a full backup job that runs daily say at 1p and then I have a log backup job that runs every 30 minutes. I know the fact that there won't be any issues if the schedules coincides and the log backup won't be able to clear out the log while the full backup executes. However, I need a script or a logic wherein I can avoid running log backup when full backup starts say at 11p and since the databases are fairly small, the overall execution completes in say 30 minutes by the time next log backup schedule kicks in, so basically I don't want log backup to coincide with the start time of Full backup. Is there a way to handle this?
Regards,
Feivel
September 21, 2016 at 12:01 am
Hi,
I think this is pretty simple.
Fullbackup starts at 1pm
Logbackups runs every 30 minutes
In the scheduler gui you can decide when the scheduler should start and stop.
Just start the scheduler for Logbackups after the Fullback has finished, lets say after 45 minutes?
And stop the Logbackups 15 minutes before the Fullbackup starts
Kind regards,
Andreas
September 26, 2016 at 4:09 am
maybe you could try this. with a little bit more parameterisation, you could make a proc.
Check if a backup operation is running for this particular DB then if it is not at that instant, then do a backup.
Declare @dbname sysname = 'MyDB'
declare @dbid int = (select max(database_id) from sys.databases where name = @dbname)
if not exists( select null from sys.dm_exec_requests
where command = 'BACKUP DATABASE'
and database_id = @dbID)
Begin
BACKUP LOG @dbname TO DISK = N'I:\Backups\MyDB.trn' WITH NOFORMAT, NOINIT,
NAME = N'MyDB-LOG Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
END
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply