Showing posts with label deleting. Show all posts
Showing posts with label deleting. Show all posts

Friday, March 30, 2012

Maintenance Plan File Deletion Bug

I have a maintenance plan set to delete files after 1 week. Instead it is deleting everthing older then 1 day. When I view the tsql in the designer, the xp_delete_file string looks correct. Is there anyway to see the exact xp_delete_file string that is actually being executed at run time?

I found the problem.

There is an "off by one" bug using the time unit of measure in "Maintenance" and "Cleanup" tasks.

If you select "Weeks" you get "Days", with "Days" you get "Hours", and "Hours" blows the index.

The patching procedure is a little complicated. Read this:

http://blogs.msdn.com/psssql/archive/2007/04/06/post-sql-server-2005-service-pack-2-sp2-fixes-explained.aspx

What service pack you are on?

There were maintenane related bugs in SP2 so that MS released hot fix on 03/05/2007.

Check the hot fix if you are already on SP2 applied before the hot fix release. If you are on SP1 apply the SP2 down loaded after 03/06/2007 which is hot fix included.

|||

I found out what the problem is.

There is an "off by one" bug where the wrong time unit of measure is being used.

"Hours" are being converted to "Days", Days" are being converted to "Hours", and "Hours" will blow with an invalid index.

This problem exists for "Maintenance Cleanup" tasks and "Clean Up History" tasks.

The fix is a little complicated because there are two versions of sp2 out there.

Read this to figure out the proper fix:

http://blogs.msdn.com/psssql/archive/2007/04/06/post-sql-server-2005-service-pack-2-sp2-fixes-explained.aspx

Monday, March 26, 2012

Maintenance Plan

I have a maintenance plan that is setup to delete backup files older than x
days. And it was deleting the files just fine until a few days ago . . .
now it will not delete older files. I even setup a new maintenance plan and
it still won't delete older files. Any idea as to why?
Brandon
==================
Presentations Direct - http://www.presentationsdirect.com
> Binding Machines
http://www.presentationsdirect.com/...ng-machines.asp
> Laminators
http://www.presentationsdirect.com/...-laminators.asp
> Paper Shredders
http://www.presentationsdirect.com/...r-shredders.asp
==================Check all the databases in the plan. If any of them are in Simple Recovery
model, this may be the issue.
2000, or 2005?
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
http://kevin3nf.blogspot.com
"Brandon" <bsmith@.presentationsdirect.nospam.com> wrote in message
news:OZkIa2c%23GHA.2180@.TK2MSFTNGP05.phx.gbl...
>I have a maintenance plan that is setup to delete backup files older than x
>days. And it was deleting the files just fine until a few days ago . . .
>now it will not delete older files. I even setup a new maintenance plan
>and it still won't delete older files. Any idea as to why?
> --
> Brandon
> ==================
> Presentations Direct - http://www.presentationsdirect.com
> http://www.presentationsdirect.com/...-laminators.asp
> http://www.presentationsdirect.com/...r-shredders.asp
> ==================
>|||SQL 2000 . . . none are in simple mode.
Brandon
==================
Presentations Direct - http://www.presentationsdirect.com
> Binding Machines
http://www.presentationsdirect.com/...ng-machines.asp
> Laminators
http://www.presentationsdirect.com/...-laminators.asp
> Paper Shredders
http://www.presentationsdirect.com/...r-shredders.asp
==================
"Kevin3NF" <kevin@.SPAMTRAP.3nf-inc.com> wrote in message
news:%23SsIogd%23GHA.1220@.TK2MSFTNGP05.phx.gbl...
> Check all the databases in the plan. If any of them are in Simple
> Recovery model, this may be the issue.
> 2000, or 2005?
> --
> Kevin Hill
> 3NF Consulting
> http://www.3nf-inc.com/NewsGroups.htm
> http://kevin3nf.blogspot.com
>
> "Brandon" <bsmith@.presentationsdirect.nospam.com> wrote in message
> news:OZkIa2c%23GHA.2180@.TK2MSFTNGP05.phx.gbl...
>

Friday, March 23, 2012

Maintenance Plan

I have a maintenance plan that is setup to delete backup files older than x
days. And it was deleting the files just fine until a few days ago . . .
now it will not delete older files. I even setup a new maintenance plan and
it still won't delete older files. Any idea as to why?
--
Brandon
================== Presentations Direct - http://www.presentationsdirect.com
> Binding Machines
http://www.presentationsdirect.com/binding-machines/gbc-binding-machines.asp
> Laminators
http://www.presentationsdirect.com/laminators/gbc-laminators.asp
> Paper Shredders
http://www.presentationsdirect.com/paper-shredders/gbc-paper-shredders.asp
==================Check all the databases in the plan. If any of them are in Simple Recovery
model, this may be the issue.
2000, or 2005?
--
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
http://kevin3nf.blogspot.com
"Brandon" <bsmith@.presentationsdirect.nospam.com> wrote in message
news:OZkIa2c%23GHA.2180@.TK2MSFTNGP05.phx.gbl...
>I have a maintenance plan that is setup to delete backup files older than x
>days. And it was deleting the files just fine until a few days ago . . .
>now it will not delete older files. I even setup a new maintenance plan
>and it still won't delete older files. Any idea as to why?
> --
> Brandon
> ==================> Presentations Direct - http://www.presentationsdirect.com
> > Binding Machines
> http://www.presentationsdirect.com/binding-machines/gbc-binding-machines.asp
> > Laminators
> http://www.presentationsdirect.com/laminators/gbc-laminators.asp
> > Paper Shredders
> http://www.presentationsdirect.com/paper-shredders/gbc-paper-shredders.asp
> ==================>|||SQL 2000 . . . none are in simple mode.
--
Brandon
==================Presentations Direct - http://www.presentationsdirect.com
> Binding Machines
http://www.presentationsdirect.com/binding-machines/gbc-binding-machines.asp
> Laminators
http://www.presentationsdirect.com/laminators/gbc-laminators.asp
> Paper Shredders
http://www.presentationsdirect.com/paper-shredders/gbc-paper-shredders.asp
=================="Kevin3NF" <kevin@.SPAMTRAP.3nf-inc.com> wrote in message
news:%23SsIogd%23GHA.1220@.TK2MSFTNGP05.phx.gbl...
> Check all the databases in the plan. If any of them are in Simple
> Recovery model, this may be the issue.
> 2000, or 2005?
> --
> Kevin Hill
> 3NF Consulting
> http://www.3nf-inc.com/NewsGroups.htm
> http://kevin3nf.blogspot.com
>
> "Brandon" <bsmith@.presentationsdirect.nospam.com> wrote in message
> news:OZkIa2c%23GHA.2180@.TK2MSFTNGP05.phx.gbl...
>>I have a maintenance plan that is setup to delete backup files older than
>>x days. And it was deleting the files just fine until a few days ago . .
>>. now it will not delete older files. I even setup a new maintenance plan
>>and it still won't delete older files. Any idea as to why?
>> --
>> Brandon
>> ==================>> Presentations Direct - http://www.presentationsdirect.com
>> > Binding Machines
>> http://www.presentationsdirect.com/binding-machines/gbc-binding-machines.asp
>> > Laminators
>> http://www.presentationsdirect.com/laminators/gbc-laminators.asp
>> > Paper Shredders
>> http://www.presentationsdirect.com/paper-shredders/gbc-paper-shredders.asp
>> ==================>

Maintenance Cleanup task NOT deleting files

I have applied SP2 and my maintenance cleanup tasks are NOT deleting the files. I have ensured that the folder path is correct. I have also checked the 'age' setting and saved the package. I rebooted the server and ran the job and it still is not deleting the files.

What types of files are not being deleted? I've tested this with backup files (.bak), and it works. I vaguely remember another type of file does not get deleted. Please post more information and we'll figure out next steps.

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||

post the result of Select @.@.Version .... After release of SP2, MS has released some fixes for Matinenance Plan and if you have downloaded the SP2 before 05 mar ... then u need to apply those patches

Refer this link : http://support.microsoft.com/kb/933508

if the patch is already applied then the version should be : 9.0.3050.00

Madhu

|||

Yes, we had downloaded SP2 before March 5th, but we saw the release of 2a and have applied it also. The version is , Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Mar 2 2007 20:01:28 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4).

I have also applied 2a to my workstation so my tools version should also be correct.

|||

The file types are the maintenance plan output files, the .txt files. It's the default extension if you select 'maintenance plans files' in the clean up task. The version is Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Mar 2 2007 20:01:28 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4) .

Thanks for any help you can give me.

|||

Mel100 wrote:

The file types are the maintenance plan output files, the .txt files.

As I suspected, this is a known issue that we could not fix in time for Service Pack 2. We ensured that .bak files are deleted properly, but the .txt files are not. See below for the associated Microsoft Connect item. If this scenario is important to you, please vote on it.

https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=259390&wa=wsignin1.0&siteid=68

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||Thanks so much for your help. This explains the task not deleting the files. I guess until this is fixed we will not use the Maintenance cleanup task.|||

I have a Maintenance Cleanup task that is not deleting bak files. The server connection is valid, the account for the connection is a local admin and the owner of the agent job is a local admin. Local admins have full control to the folder where the files are. Also both accounts have the SA role. I have tried the folder name with a \ at the end and without. The job executes and completes successfully, it just doesn't remove bak files from the folder. I am on SP1 = Microsoft SQL Server 2005 - 9.00.2047.00 (Intel X86) Apr 14 2006 01:12:25 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Any assistance would be appreciated, thanks.

|||

We have the same issue but not in SP2: ver:9.00.2047.00

The trn files are deleted, but the txt not !!

Wednesday, March 21, 2012

Maintenance cleanup task not deleting files

Running SQL2005 STD.

I have a maintenance cleanup task that is not actually deleting the files that it should be.

Here's the most recently task generated T-SQL statement:

EXECUTE master.dbo.xp_delete_file 0,N'F:\Program Files\Microsoft SQL Server\MSSQL\BACKUP',N'bak',N'12/05/2006 10:42:08'

The problem is that the files aren't actually being deleted when the job runs. However, if I create a new job with the statement as a single step or run it manually from a query window then the files are deleted as expected.

Is there anything I should be looking for? The job runs as 'sa' and I connect to the database engine using 'sa'... any ideas?

Thanks!Hi Davve,

Do you get an error message saying the the job has failed or does it appear to run successfully?

If its the latter is it possibly you can run sql profiler and run the job so we can help you further.

Pace
|||

Please file a defect report for this issue at http://connect.microsoft.com/sqlserver. We use issues reported by customers to prioritize future work including service packs.

What is the version number of SQL Server Management Studio you are running? You can check in the About... dialog shown by clicking the "Help | About..." menu item in SSMS.

Thanks,
Steve

|||It turns out that after a routine reboot of the server, the following time the job ran it deleted the files. Thanks for the replies.

Maintenance cleanup task not deleting files

Running SQL2005 STD.

I have a maintenance cleanup task that is not actually deleting the files that it should be.

Here's the most recently task generated T-SQL statement:

EXECUTE master.dbo.xp_delete_file 0,N'F:\Program Files\Microsoft SQL Server\MSSQL\BACKUP',N'bak',N'12/05/2006 10:42:08'

The problem is that the files aren't actually being deleted when the job runs. However, if I create a new job with the statement as a single step or run it manually from a query window then the files are deleted as expected.

Is there anything I should be looking for? The job runs as 'sa' and I connect to the database engine using 'sa'... any ideas?

Thanks!Hi Davve,

Do you get an error message saying the the job has failed or does it appear to run successfully?

If its the latter is it possibly you can run sql profiler and run the job so we can help you further.

Pace
|||

Please file a defect report for this issue at http://connect.microsoft.com/sqlserver. We use issues reported by customers to prioritize future work including service packs.

What is the version number of SQL Server Management Studio you are running? You can check in the About... dialog shown by clicking the "Help | About..." menu item in SSMS.

Thanks,
Steve

|||It turns out that after a routine reboot of the server, the following time the job ran it deleted the files. Thanks for the replies.sql

Maintenance Cleanup task NOT deleting files

I have applied SP2 and my maintenance cleanup tasks are NOT deleting the files. I have ensured that the folder path is correct. I have also checked the 'age' setting and saved the package. I rebooted the server and ran the job and it still is not deleting the files.

What types of files are not being deleted? I've tested this with backup files (.bak), and it works. I vaguely remember another type of file does not get deleted. Please post more information and we'll figure out next steps.

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||

post the result of Select @.@.Version .... After release of SP2, MS has released some fixes for Matinenance Plan and if you have downloaded the SP2 before 05 mar ... then u need to apply those patches

Refer this link : http://support.microsoft.com/kb/933508

if the patch is already applied then the version should be : 9.0.3050.00

Madhu

|||

Yes, we had downloaded SP2 before March 5th, but we saw the release of 2a and have applied it also. The version is , Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Mar 2 2007 20:01:28 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4).

I have also applied 2a to my workstation so my tools version should also be correct.

|||

The file types are the maintenance plan output files, the .txt files. It's the default extension if you select 'maintenance plans files' in the clean up task. The version is Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Mar 2 2007 20:01:28 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4) .

Thanks for any help you can give me.

|||

Mel100 wrote:

The file types are the maintenance plan output files, the .txt files.

As I suspected, this is a known issue that we could not fix in time for Service Pack 2. We ensured that .bak files are deleted properly, but the .txt files are not. See below for the associated Microsoft Connect item. If this scenario is important to you, please vote on it.

https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=259390&wa=wsignin1.0&siteid=68

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||Thanks so much for your help. This explains the task not deleting the files. I guess until this is fixed we will not use the Maintenance cleanup task.|||

I have a Maintenance Cleanup task that is not deleting bak files. The server connection is valid, the account for the connection is a local admin and the owner of the agent job is a local admin. Local admins have full control to the folder where the files are. Also both accounts have the SA role. I have tried the folder name with a \ at the end and without. The job executes and completes successfully, it just doesn't remove bak files from the folder. I am on SP1 = Microsoft SQL Server 2005 - 9.00.2047.00 (Intel X86) Apr 14 2006 01:12:25 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Any assistance would be appreciated, thanks.

|||

We have the same issue but not in SP2: ver:9.00.2047.00

The trn files are deleted, but the txt not !!

Maintenance Cleanup task NOT deleting files

I have applied SP2 and my maintenance cleanup tasks are NOT deleting the files. I have ensured that the folder path is correct. I have also checked the 'age' setting and saved the package. I rebooted the server and ran the job and it still is not deleting the files.

What types of files are not being deleted? I've tested this with backup files (.bak), and it works. I vaguely remember another type of file does not get deleted. Please post more information and we'll figure out next steps.

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||

post the result of Select @.@.Version .... After release of SP2, MS has released some fixes for Matinenance Plan and if you have downloaded the SP2 before 05 mar ... then u need to apply those patches

Refer this link : http://support.microsoft.com/kb/933508

if the patch is already applied then the version should be : 9.0.3050.00

Madhu

|||

Yes, we had downloaded SP2 before March 5th, but we saw the release of 2a and have applied it also. The version is , Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Mar 2 2007 20:01:28 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4).

I have also applied 2a to my workstation so my tools version should also be correct.

|||

The file types are the maintenance plan output files, the .txt files. It's the default extension if you select 'maintenance plans files' in the clean up task. The version is Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Mar 2 2007 20:01:28 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.0 (Build 2195: Service Pack 4) .

Thanks for any help you can give me.

|||

Mel100 wrote:

The file types are the maintenance plan output files, the .txt files.

As I suspected, this is a known issue that we could not fix in time for Service Pack 2. We ensured that .bak files are deleted properly, but the .txt files are not. See below for the associated Microsoft Connect item. If this scenario is important to you, please vote on it.

https://connect.microsoft.com/feedback/viewfeedback.aspx?FeedbackID=259390&wa=wsignin1.0&siteid=68

Paul A. Mestemaker II
Program Manager
Microsoft SQL Server Manageability
http://blogs.msdn.com/sqlrem/

|||Thanks so much for your help. This explains the task not deleting the files. I guess until this is fixed we will not use the Maintenance cleanup task.|||

I have a Maintenance Cleanup task that is not deleting bak files. The server connection is valid, the account for the connection is a local admin and the owner of the agent job is a local admin. Local admins have full control to the folder where the files are. Also both accounts have the SA role. I have tried the folder name with a \ at the end and without. The job executes and completes successfully, it just doesn't remove bak files from the folder. I am on SP1 = Microsoft SQL Server 2005 - 9.00.2047.00 (Intel X86) Apr 14 2006 01:12:25 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Any assistance would be appreciated, thanks.

|||

We have the same issue but not in SP2: ver:9.00.2047.00

The trn files are deleted, but the txt not !!

Monday, March 12, 2012

Maint not deleting old backups

I use the Maintenance utility to backup the database. I have specified for
it to delete any backup older than 1 day, but it doesn't delete anything.
The old backups end of taking up all the disk space, and then the backup
doesn't complete.
Any suggestions?
Below KB might help:
http://support.microsoft.com/default...&Product=sql2k
Also, check out below great troubleshooting suggestions from Bill H at MS:
-- Log files don't delete --
This is likely to be either a permissions problem or a sharing violation
problem. The maintenance plan is run as a job, and jobs are run by the
SQLServerAgent service.
Permissions:
1. Determine the startup account for the SQLServerAgent service
(Start|Programs|Administrative tools|Services|SQLServerAgent|Startup). This
account is the security context for jobs, and thus the maintenance plan.
2. If SQLServerAgent is started using LocalSystem (as opposed to a domain
account) then skip step 3.
3. On that box, log onto NT as that account. Using Explorer, attempt to
delete an expired backup. If that succeeds then go to Sharing Violation
section.
4. Log onto NT with an account that is an administrator and use Explorer to
look at the Properties|Security of the folder (where the backups reside)
and ensure the SQLServerAgent startup account has Full Control. If the
SQLServerAgent startup account is LocalSystem, then the account to consider
is SYSTEM.
5. In NT, if an account is a member of an NT group, and if that group has
Access is Denied, then that account will have Access is Denied, even if
that account is also a member of the Administrators group. Thus you may
need to check group permissions (if the Startup Account is a member of a
group).
6. Keep in mind that permissions (by default) are inherited from a parent
folder. Thus, if the backups are stored in C:\bak, and if someone had
denied permission to the SQLServerAgent startup account for C:\, then
C:\bak will inherit access is denied.
Sharing violation:
This is likely to be rooted in a timing issue, with the most likely cause
being another scheduled process (such as NT Backup or Anti-Virus software)
having the backup file open at the time when the SQLServerAgent (i.e., the
maintenance plan job) tried to delete it.
1. Download filemon and handle from www.sysinternals.com.
2. I am not sure whether filemon can be scheduled, or you might be able to
use NT scheduling services to start filemon just before the maintenance
plan job is started, but the filemon log can become very large, so it would
be best to start it some short time before the maintenance plan starts.
3. Inspect the filemon log for another process that has that backup file
open (if your lucky enough to have started filemon before this other
process grabs the backup folder), and inspect the log for the results when
the SQLServerAgent agent attempts to open that same file.
4. Schedule the job or that other process to do their work at different
times.
5. You can use the handle utility if you are around at the time when the
job is scheduled to run.
If the backup files are going to a \\share or a mapped drive (as opposed to
local drive), then you will need to modify the above (with respect to where
the tests and utilities are run).
Finally, inspection of the maintenance plan's history report might be
useful.
Thanks,
Bill Hollinshead
Microsoft, SQL Server
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Gary465" <Gary465@.discussions.microsoft.com> wrote in message
news:34112B79-046E-40AB-B489-34A1AD589C45@.microsoft.com...
>I use the Maintenance utility to backup the database. I have specified for
> it to delete any backup older than 1 day, but it doesn't delete anything.
> The old backups end of taking up all the disk space, and then the backup
> doesn't complete.
> Any suggestions?
|||Make sure the account running the SQLAgent service has delete permissions on
the backup folder
Kevin Hill
President
3NF Consulting
www.3nf-inc.com/NewsGroups.htm
www.DallasDBAs.com/forum - new DB forum for Dallas/Ft. Worth area DBAs.
www.experts-exchange.com - experts compete for points to answer your
questions
"Gary465" <Gary465@.discussions.microsoft.com> wrote in message
news:34112B79-046E-40AB-B489-34A1AD589C45@.microsoft.com...
>I use the Maintenance utility to backup the database. I have specified for
> it to delete any backup older than 1 day, but it doesn't delete anything.
> The old backups end of taking up all the disk space, and then the backup
> doesn't complete.
> Any suggestions?
|||Thanks guys for the suggestions. It was a more obvious problem, as the
backups had not been completing successfully due to a lack of space. I guess
the utility does not delete the old backups if the job does not complete
successfully.
"Kevin3NF" wrote:

> Make sure the account running the SQLAgent service has delete permissions on
> the backup folder
> --
> Kevin Hill
> President
> 3NF Consulting
> www.3nf-inc.com/NewsGroups.htm
> www.DallasDBAs.com/forum - new DB forum for Dallas/Ft. Worth area DBAs.
> www.experts-exchange.com - experts compete for points to answer your
> questions
>
> "Gary465" <Gary465@.discussions.microsoft.com> wrote in message
> news:34112B79-046E-40AB-B489-34A1AD589C45@.microsoft.com...
>
>