Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
Administering
»
Delete old Backup files using T-sql script
52 posts, Page 1 of 6
1
2
3
4
5
»
»»
Delete old Backup files using T-sql script
Rate Topic
Display Mode
Topic Options
Author
Message
sreeni .r.julakanti
sreeni .r.julakanti
Posted Tuesday, April 01, 2008 3:02 PM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, April 02, 2008 2:29 PM
Points: 15,
Visits: 36
Guys
do any one have script to delete old backup files more than 5 days worth using T-SQL Code,if so please post .because i am looking the ways to delete old files in folders.
Post #478091
RBarryYoung
RBarryYoung
Posted Tuesday, April 01, 2008 3:43 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 11:17 AM
Points: 9,855,
Visits: 9,376
Can't you do it with Maintenance Plans?
-- RBarryYoung
,
(302)375-0451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #478120
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Tuesday, April 01, 2008 4:04 PM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 3:19 PM
Points: 31,526,
Visits: 13,863
Search here in the scripts section. There are lots of backup scripts that can probably do this.
Note that they will require the xp_cmdshell for the most part, and that's not necessarily what you want to do. A simple Maintenance plan can do this using the Maintenance Cleanup task.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #478134
Ignacio A. Salom Rangel
Ignacio A. Salom Rangel
Posted Tuesday, April 01, 2008 4:14 PM
Hall of Fame
Group: General Forum Members
Last Login: Yesterday @ 5:05 PM
Points: 3,051,
Visits: 1,364
I agree with Steve! Why don't you use a maintenance plan?
My blog
Post #478141
GreenHorn
GreenHorn
Posted Tuesday, April 01, 2008 8:29 PM
SSC Journeyman
Group: General Forum Members
Last Login: Thursday, May 23, 2013 12:03 AM
Points: 76,
Visits: 46
I've noticed that when I backup to an external drive, the maintanence plan will not delete files. This is in SQL Server 2000. Not sure what the problem is, so I had to create a .bat script and call it from xp_cmdshell.
Post #478199
RBarryYoung
RBarryYoung
Posted Tuesday, April 01, 2008 10:38 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 11:17 AM
Points: 9,855,
Visits: 9,376
Maintenance plans delete backup files for me on SQL 2000.
-- RBarryYoung
,
(302)375-0451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #478240
GreenHorn
GreenHorn
Posted Tuesday, April 01, 2008 10:55 PM
SSC Journeyman
Group: General Forum Members
Last Login: Thursday, May 23, 2013 12:03 AM
Points: 76,
Visits: 46
If I run backups to a network share or on the local drive, I have no issues of having them delete the backups. It just happens when I backup to an external drive. I backup to a 500 GB external hard drive for DRP. I use a .bat script to go out and delete any files older than 7 days.
Post #478247
nmoore
nmoore
Posted Wednesday, April 02, 2008 6:26 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Friday, May 18, 2012 9:37 AM
Points: 176,
Visits: 172
On 2003 I used the forfiles utility via xp_cmdshell to list the files and properties and then load this information into a table. I do a compare of the physical files against the logical history and then decide if it is safe to drop the old backups.
Nigel Moore
======================
Post #478404
sreeni .r.julakanti
sreeni .r.julakanti
Posted Wednesday, April 02, 2008 9:09 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, April 02, 2008 2:29 PM
Points: 15,
Visits: 36
I created maintenance job that job never deletes FAK Files but it shows success,
i did not get why it is so.
Post #478605
sreeni .r.julakanti
sreeni .r.julakanti
Posted Wednesday, April 02, 2008 9:09 AM
Grasshopper
Group: General Forum Members
Last Login: Wednesday, April 02, 2008 2:29 PM
Points: 15,
Visits: 36
Maintanence Job is not working for me .
Post #478607
« Prev Topic
|
Next Topic »
52 posts, Page 1 of 6
1
2
3
4
5
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.