x
login about faq Site discussion (meta-askssc)

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

more ▼

asked Aug 17 '10 at 06:22 PM in Default

Mr Q gravatar image

Mr Q
11 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

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

more ▼

answered Aug 17 '10 at 07:29 PM

Oleg gravatar image

Oleg
15.4k 1 4 24

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x170
x11

asked: Aug 17 '10 at 06:22 PM

Seen: 451 times

Last Updated: Aug 17 '10 at 07:11 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.