Generate 1 log file every 1 hour doing a backup every 1 hour?

  • EXECUTE dbo.DatabaseBackup
    @Databases = 'USER_DATABASES',
    @Directory = 'D:\DADOS-LOG',
    @BackupType = 'LOG',
    @LogSizeSinceLastLogBackup = 1,
    @TimeSinceLastLogBackup = 60,
    @DirectoryStructure = NULL,
    @FileName = '{DatabaseName}_{BackupType}_{Partial}_{CopyOnly}.{FileExtension}',
    @AvailabilityGroupDirectoryStructure = NULL

    -- How to modify this script to generate 1 log file every 1 hour doing a backup every 1 hour?

  • Create a SQL Server Agent job (if using Standard/Enterprise/Developer) or Windows Task Scheduler job (if using any edition), which runs that code every 1 hour.

     

    You may want to also remove the @TimeSinceLastLogBackup parameter in case it is something like 59minutes 58seconds as timings can fluctuate slightly, so you don't want to miss out on having a log backup taken.

  • With these changes made, am I able to restore the database to 5 hours ago, for example?

  • As long as you have the necessary full backup and an intact log chain yes.

    But please make sure you have something backing up the D:\DADOS-LOG folder, if that was to be lost, then you cannot restore.

  • Thanks.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply