Delete Old Backup Files

Jun 5, 2001

hi,

i want to delete the backup files older than 15 days. how can i do this?
Actually i backup the db and log using the TSQL, and the backup files are in d:ackup folder. I tried sqlmaint,xp_sqlmaint but its not running .

Any idea? thanks in adv.

kumar

View 2 Replies


ADVERTISEMENT

SQL 2012 :: FOR FILES Command To Delete Old Backup Files On Remote Server?

Feb 24, 2015

I have the need to delete old backup files via TSQL job. Found this solution online:

PushD "
emoteservershareDIFF" &&(
forfiles -m *DIFF*.sqb -d -1 -c "cmd /c del /q @path"
) & PopD

It works remotely if I run it via command prompt. But when I add this to a TSQL job on my remote SQL instance, it runs without deleting anything. What I'm missing?

View 6 Replies View Related

Delete Backup Files Older Then...

Mar 5, 2007

Ok in SQL 2000 this is within the maintaince plan, where as i have to create a seprate one for sql 2005 being i assume the 'clean up history' I choose the backup andrestore option choose 2 weeks and then run the job once created it runs sucssessfully but yet it dosnt delete a thing. I have backups going back almost 2 months now.
What on earth am i not doing?

Thanks in advanced

View 6 Replies View Related

T-SQL To Delete Files From Backup Device

Nov 3, 2006

I created a backup device and a job to backup a full dbs and transaction logs. When I first created the backup statement it was created with RETAIN DAYS = 10

Its been 15 days and the ones created after 10 days appear to be marked for deletiong but I am obviously missing a statement in my backup statement or in another job I need to schedule to come through and delete the old files from the backup device. Please help me figure out what this statement needs to be.

All the backups and T-log backups are written to one device which is one file.



Thanks

Scott

View 6 Replies View Related

SQL 2000 Fails To Delete Old Backup Files From The Network Share

Jul 21, 2006

Hello,

I am experiencing an issue with SQL Server 2000 Maintenance Plan.
DB Backup job fails to delete old backup files from the file server (I am backing up to the network share - actually, a DFS).
Backup part of the maintenance plan/job succeeds, but then cleanup part fails.

I made sure that service account under which SQL Server Agent is running, has sufficient privileges over the network share by logging in and successfully deleting files in question.

I was not able to locate any log entries either on the SQL Server machine or on the file server machine that would indicate the root of the problem. Even though I turned on auditing for Delete operations for the destination folder, its subfolders and files, I could not find anything in the Security event log.

I would appreciate any ideas on how to troubleshoot and correct this problem.

Thanks in advance,

View 3 Replies View Related

SQL Server 2008 :: Query To Delete All Backup Files Older Than A Specific Date?

Jul 29, 2015

I want to delete all backup files from a folder older than a specific date. But if I use the beklow query, I need to pass how many days of older backup files I need to delete whereas in my case, I dont know how many days/month/syears of old backup files are there in the backup folder.

EXEC xp_cmdshell 'FORFILES /p c:BACKUP /s /m *.sql /d -30 /c "CMD /C del /Q /F @FILE"'

View 2 Replies View Related

SQL Server 2008 :: Maintenance Plan Delete History Trying To Delete Wrong Files

Sep 11, 2015

I have some simple files but they are failing because the delete history task is failing as it is looking for files in a non existent directory.

It is looking for files in C:Program FilesMicrosoft SQL ServerMSSQL10_50.INSTANCEMSSQLLog whereas it should be looking in C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLLog

how I can get this corrected so I can get the Maintenance Plans to run correctly.

I have tried deleting and recreating the Plan but to no avail

View 0 Replies View Related

SQL Server 2008 :: Count Number Of Backup Files Deleted From A Default Backup Location

Mar 13, 2015

I've written a custom script to delete backup files from location. But unable to modify now to count the number of files are deleted. How to modify the script...

/* Script to delete older than N days backup from a specific directory */

USE [db_admin]
GO
IF OBJECT_ID('usp_DeleteBackup', 'P') IS NOT NULL
DROP PROC usp_DeleteBackup
GO

[Code] .....

View 2 Replies View Related

Is There A MS SQL Backup Tool That Will Zip Or Compress The Backup Files?

Feb 27, 2007

Currently we use a SQL maintenance plan to do a full backup of all our databases daily (about 40 databases on our production server).  As you can imagine, this eats up disk space quickly so currently we manually zip the backup files and/or move them to an archive drive.  I considered writing an application to walk through the backup folder structure and zip any .bak file it finds, but I know there are some third party tools out there that will backup/restore a MS SQL database.
I was wondering if any of these also zip the backups once they are created.  Any recommendations or suggestions are welcome.
 

View 1 Replies View Related

SQL 2012 :: Missing Other Backup Files Backup

Nov 3, 2014

I scheduled automatic backup process but its only showing backup of the only one .sql file in the backup folder. Other created .sql files are not backed up. Why is it so?

View 5 Replies View Related

Delete Backup From Backup Device?

Apr 16, 2004

I dump my databases to backup devices each night.

However would like to purge old backups - say older than a week - from the device.

Is it a case that I have to drop and re-create the devices every 7 days or can SQL do this for me?

I have seen the RETAINDAYS claus but it applies to tape backups only?

Thanks

View 1 Replies View Related

Backup Db To Split Backup Files

Apr 12, 2007

Hi everyone,

I want to do sql db backup.But how can I backup db to split backup files? The reason I want to split the backup file is becasue single file size is too big and I want to write to dvd.

any idea or scripts?

cheers

View 1 Replies View Related

Delete Files

Aug 31, 2006

I need to delete all the *.txt file in a specific folder modified date is older than 2 months,. How can I do this in a stored procedure?

View 3 Replies View Related

Can Not Delete Log Files

Jun 9, 2008

Hello All
I have a SQL 2005 server I inherited and am trying to clean up. I am unable to delete some log files. The databases they were associated with do not exist in sysdatabases. However, when I try to delete them I get the message they are in use. There are no other instances attached to this server.
Any help is appreciated.

View 3 Replies View Related

Delete Files

Aug 31, 2006

I need to delete all the *.txt file in a specific folder modified date is older than 2 months,. How can I do this in a stored procedure?

View 5 Replies View Related

Delete Files Automatically? Help!!

Jul 31, 2002

I need to setup an automated process to delete all the files older than a month in a particular directory on a network drive, how is that possible? Any help is greatly appreciated.
thanks.
Sheila.

View 1 Replies View Related

Xp_cmdshell To Delete Files

Jul 26, 2006

can I use xp_cmdshell to delete files older than lets say 30 minutes? can anyone show me what the command will look like?

Thanks
Shahab

View 3 Replies View Related

Delete Files More Than N Hours

Mar 1, 2004

Hi everybody,

Can anyone help me out in deleting files more than n- hours from a physical folder using xp_cmdshell ....

View 2 Replies View Related

Delete Files From Directory?

Nov 15, 2014

how can I delete files, which are allready imported into a database. I have a folder with 600,000 files . All Files should be in a database. And I want to delete the files that are found in the table with filename . How can I make the ?? The Filename and physicals Name is the same so i can say table.filename=physical.filename.

View 20 Replies View Related

Delete Old Files (SSIS Or DOS)

Oct 9, 2007

I've been tasked with coming up with a process to delete old files out of a certain directory. It's prefered to have a configuration file to go in and be able to change the number of days to retain files (7 for delete files older than 7 days for example). I've been told I can do this with SSIS. Can anybody point me in the right direction to do this in SSIS or even in DOS? I don't know ActiveX scripting if that's what's needed in SSIS. I prefer doing something like this in DOS but not sure it's possible to automate. Any help is appreciated.

Van

View 2 Replies View Related

Delete Remote Files

Mar 3, 2006

I wish to delete remote files on an FTP server after I download them. I want to download files daily and delete them daily after I finish downloading. I am trying to use the FTP task to do this but I get an error when it tries to delete files from specified location. It says:

"Unable to delete files using FTP Connection Manager" The FTP connection manager contains the FTP connection string and password. I have unchecked the passive mode box. Can someone help me with this error,

Thanks

Annie

View 4 Replies View Related

I Have Two Transaction Log Files In My Database, I Want To Delete One, How?

Sep 14, 2006

I already did the following but still it wont delete the log file because it is not empty- DBCC SHRINKFILE('logfilename',EMPTYFILE) - DBCC SHRINKFILE('logfilename',TRUNCATEONLY)- ALTER DATABASE databasename REMOVE FILE logfilename

View 4 Replies View Related

How To Delete Old Files Stored In A Directory?

Jan 7, 2003

Hello,
How to delete old files stored in a directory using dos script?.
I appreciate your feedback.
Thanks,
Ravi

View 7 Replies View Related

How To Combine Log Files && Delete Secondary

Oct 21, 2003

I have a database with 2 log files VE_log and VE_log2 (the split is left from legacy system with limited disk space). I want to eliminate the 2nd log.

I've tried SHRINKFILE (EMPTYFILE), which of course reduces the file to the default minimum pages, SHRINKFILE (TRUNCATEONLY), SHRINKDATABASE (VE), and in every case the ALTER DATABASE REMOVE FILE command fails cause the log isn't empty.

Ideas???

Thanks,

Al

View 3 Replies View Related

Delete 2 Days Old Files - Xp_cmdshell

Apr 18, 2008

Folks:

I want to delete files on windows from a directory which are 2 days old. I understand we can do that using xp_cmdshell. Anybody with a script would really help me.


Thanks !

View 1 Replies View Related

Using SSIS Package To Delete Source Files

Jan 31, 2013

is it possible to delete a source file(*.txt) when a SSIS package is done with it?

View 3 Replies View Related

Help ---! Procedure To Delete Files From Operating System

Jul 20, 2005

Hi all,Can anyone help me with a script which would delete files ormove them to a different folder at some scheduled time..!Please.....!!!Thanks in advance...

View 5 Replies View Related

Can't Delete Maintenance Report Files (txt) In SQL/2005

Jul 30, 2007

I have several maintenance plans setup and working in SQL/2005 (sp2 9.0.3042) on several servers; however, the .txt maint plan output files will not delete on any of the servers. The backups run fine, the old database and transaction log backup files delete fine (.bak and .trn); but, the .txt files won't go away unless I delete them by hand. I tried copy/paste the scripted command (xp_delete_file) and it runs with no errors but does not delete the old .txt files. ( This server was upgraded from SQL/2000 -

EXECUTE master.dbo.xp_delete_file 1,N'E:Program FilesMicrosoft SQL ServerMSSQLLOG',N'txt',N'2007-07-09T10:59:38'

)
I do NOT specify a period (.) in the file extension dialog box. Any ideas before I setup a .cmd batch file and schedule it instead?

Thanks in Advance,

DeWayne

View 6 Replies View Related

FTP Task - Delete Remote Files Always Fails

Mar 11, 2006



Hello,

I have two FTP Tasks configured in my SSIS package. One is for "Receive files" and the other is set for "Delete remote files." Both use variables for the source/destination paths. My remote path variable contains a wild card in the name field such as /usr/this/is/my/path/*.ext and it is working to FTP all the .ext files to my working directory. I then rename the files and want to remove the original files from the FTP server. I use the same variable as the remote path variable in the delete as I do in the receive.

Using the same FTP connection manager for both tasks I am always getting a failure on the delete. The FTP connection manger is setup to use the root user. Using a terminal I am able to open an FTP connection to the server and remove the files manually. There doesn't seem to be any detailed documentation on the FTP Task configured for Delete remote files so I'm hoping someone might have some insight to the problem.

I receive the same message for each of the files that was downloaded:
Error: 0xC001602A at MyPackage, Connection manager "FTP Connection Manager": An error occurred in the requested FTP operation. Detailed error description: 550 usr hisismypathdatafile1.ext: No such file or directory.
The attempt to delete file "usr hisismypathdatafile1.ext" failed. This may occur when the file does not exist, the file name was spelled incorrectly, or you do not have permissions to delete the file.

With the root user/working manually I'm not understanding the permission reason, the file does exist and is spelled correctly.

Dan

View 21 Replies View Related

FTP Task - Delete Remote Files Issue

Nov 3, 2006

We are Downloading files from FTP Site using "FTP Task" and we need to remove those files after downloading.

We need to delete files of specific names, like "Names_*.TXT" (All the txt files and Names starting from "Names_") so We are using Delete Remote Files and Remote path we are specifying as "/Names_*.TXT"

This doesn't work its not able to delete the files so, We tried using "*.*" and also given the specific filename like "Names_A1.TXT" then also its not deleting the remote files.

Please let me know the solution.

Thanks,

Priaynk Gajera

View 6 Replies View Related

Unable Delete Remote Files Using FTP Task

Sep 28, 2006

I can create remote folder and delete it

I also can create remote files but i can not delete remote files

error warning is like subject

any ides? thanks

View 7 Replies View Related

Unable To Delete Old ZIP Files Using Maintenance Plan

May 8, 2015

I'm using below script within the execute T-SQL statement task of the maintenance plan, which is created to delete the zip files older than 2 days, the task runs before the backup database task gets kicked off, but some how the task is not deleting the old .zip files.

Code being used within the task: output of the @delete_file variable within the delete command is Del X:SQLBackup*2015_05_06*.zip before it is passed to the final exec statement, the server is in EST time zone.

declare @ConvertDate char(10)
declare @Delete_file varchar(80)
set @ConvertDate = CONVERT ( char(10) , dateadd( dd, -2, getdate()) , 121 )

[code]....

View 5 Replies View Related

Delete Backup File

Nov 15, 2005

Hi,
I have a database which size is 64Go, and i backup it everyday with 1 day of retention.
But the maintenance plan don't delete the file older than 1 day.
This works fine for the other db.
Do you know what is the pb ?
regards.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved