question

Mr Q avatar image
Mr Q asked

Log Chains

I am using the following the code to back up my log file: backup log blackiceproject to disk = 'C:\Black Ice Project Log\logbackup.bak'; Over time (the back up job runs every 15 mins)I was expecting to see a number of different files in the "C:\\Black Ice Project Log" however I only see the one back up file. Can you please help me by telling me how I can generate a log chain. Thank you
backuplog
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Oleg avatar image
Oleg answered
The script does exactly what you ask, and thus, it always overwrites existing file because the script always provides same path. The simplest thing to do would be to add the date and time part to the file name, for example: declare @path nvarchar(255); set @path = N'C:\Black Ice Project Log\logbackup_' + convert(nvarchar(8), getDate(), 112) + N'_' + replace(convert(nvarchar(8), getDate(), 8), ':', '') + N'.bak'; backup log blackiceproject to disk = @path; This will generate the log files like C:\\Black Ice Project Log\\logbackup\_20100817\_212509.bak
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.