SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL not deleting files


SQL not deleting files

Author
Message
dwilliscp
dwilliscp
SSC Eights!
SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)

Group: General Forum Members
Points: 840 Visits: 775
Why is the following statement not deleting the backup files?

EXECUTE master.dbo.xp_delete_file 0,N'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\master',N'.bak',N'2012-09-12T16:25:36',1

It finishes without error, in a second, but there are still files with the .bak at that file path.. dating back to Jan 2011.. when we loaded SQl on to this box.
Lynn Pettis
Lynn Pettis
SSC-Forever
SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)SSC-Forever (40K reputation)

Group: General Forum Members
Points: 40424 Visits: 38567
dwilliscp (9/19/2012)
Why is the following statement not deleting the backup files?

EXECUTE master.dbo.xp_delete_file 0,N'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\master',N'.bak',N'2012-09-12T16:25:36',1

It finishes without error, in a second, but there are still files with the .bak at that file path.. dating back to Jan 2011.. when we loaded SQl on to this box.



Probably because of the "." in the N'.bak' string. This is probably being done through a maintenance plan, and you don't include the "." when providing the extension for the file names.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Thomas Rushton
Thomas Rushton
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: Moderators
Points: 3349 Visits: 3387
Ah, the joys of using undocumented stored procedures...

Note that there's a "feature" in the SQL2005 RTM version of that xp too - it won't traverse subdirectories, as I found a few years ago... Pimping myself? Surely not... Whistling
dwilliscp
dwilliscp
SSC Eights!
SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)

Group: General Forum Members
Points: 840 Visits: 775
Thanks Lynn, that was the problem... darn I did not even think anything when I read the T-SQL.. you were right that they created this as a maintenance plan. Interesting that our non-system databases are all done using stored proc's but the system ones use maintenance plans.
dwilliscp
dwilliscp
SSC Eights!
SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)SSC Eights! (840 reputation)

Group: General Forum Members
Points: 840 Visits: 775
ThomasRushton (9/19/2012)
Ah, the joys of using undocumented stored procedures...

Note that there's a "feature" in the SQL2005 RTM version of that xp too - it won't traverse subdirectories, as I found a few years ago... Pimping myself? Surely not... Whistling


Well we are running 2005 but it is deleteing files at least one level down.. from the backup directory. ;-)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search