x

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, 2010 at 06:22 PM in Default

avatar image

Mr Q
11 1 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, 2010 at 07:29 PM

avatar image

Oleg
17.1k 3 7 28

(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

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x235
x21

asked: Aug 17, 2010 at 06:22 PM

Seen: 934 times

Last Updated: Aug 17, 2010 at 07:11 PM

Copyright 2016 Redgate Software. Privacy Policy