Tuesday, March 20, 2012

How to delete old backup files by script.


Extended procedure 'xp_delete_file ' is used for to delete the backup files in the server.

We need to specify the file type selected ((0 = FileBackup,1 = File Report),folder path(trailing slash), file extension which needs to be deleted (N'bak'),date(prior which to delete) and folder flag level((1 = include files in first subfolder level, 0 = not) as like below in the Sql Server Management Studio.

EXECUTE master.dbo.xp_delete_file 0, N’D:\SQLBackup',N'BAK',N'06/07/2011 10:18:49',1

By running above script, we can able to delete the old backup files prior to the above specified date.

MYSQL:::Seamless Data Archiving: Exporting, Importing, and Pruning MySQL Tables

  Seamless Data Archiving: Exporting, Importing, and Pruning MySQL Tables Introduction: In the dynamic landscape of database management...