Showing posts with label backups. Show all posts
Showing posts with label backups. Show all posts

Wednesday, March 28, 2012

Maintenance Plan email report failure

Hello,
I have a simple daily maintenance plan for backups.(check integrity, back up, clean up history and then report) However, sending the email report always fails with the following error:

"Could not generate mail report.An exception occurred while executing a Transact-SQL statement or batch.Incorrect syntax near 'sys'."

How can the wizard output Incorrect syntax?

I have set up and tested Database mail and set the default public profile.
I have enabled the mail profile in SQL server agent properties and then restarted SQL server agent.
I have set up operator to receive the mail.
The frustrating thing is that if I set up and schedule a really simple test maintenance plan, the email report works! But it always fails on the real one.
How can I get more detail in the error message and actually see the SQL it is trying to execute when it send the mail?

Thanks,
Adam

More detail.

Having done a few tests it seems that this mail report error only occurs after the check integrity job fails. eg.

Executing the query "DBCC CHECKDB WITH NO_INFOMSGS
" failed with the following error:

"Incorrect PFS free space information for page (1:278) in object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 71776119065149440 (type LOB data). Expected value 0_PCT_FULL, actual value 100_PCT_FULL.
CHECKDB found 0 allocation errors and 1 consistency errors in table 'sys.sysobjvalues' (object ID 60).

CHECKDB found 0 allocation errors and 1 consistency errors in database 'RHJ'.
repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKDB (RHJ).".

Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


This failure does not affect the backup and maintenance cleanup tasks that run afterwards, only the email report that it tries to send at the end.

Maintenance Plan DB Integrity Job Failed

I created a SQL Server 2000 database maintenance plan with the wizard.
I selected integrity checks and complete backups for my database and
completed the requiremenents.
I received the following error listed below.
Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42
000]
(Error 22029). The step failed.
Please help me resolve this error.Joe
Did you check an Error log for any info there?
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE
> 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>|||Yes, I checked the SQL Server error log.
Nothing was in the error log that correponds to this error.
Thanks,
"Uri Dimant" wrote:

> Joe
> Did you check an Error log for any info there?
> "Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
> news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
>
>|||Also, which job did this fail on?
For example, if you have a tran log backup job and you have mixed full
recovery model databases with simple model, you will get an error (even
though the backups completed, the error will be thrown). Its always a good
idea to separate out the system, full model user, bulk mode user and simple
model user database backups into separate plans, and configure each
appropriately.
Awaiting your response for more info as per Uri.
AndyP,
Sr. Database Administrator,
MCDBA 2003 &
Sybase Certified Pro DBA (AA115, SD115, AA12, AP12)
"Joe K." wrote:

> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE
42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>|||Specify a report file for the main plan and check that report file for error
messages.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE
42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>sql

Maintenance Plan DB Integrity Job Failed

I created a SQL Server 2000 database maintenance plan with the wizard.
I selected integrity checks and complete backups for my database and
completed the requiremenents.
I received the following error listed below.
Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42000]
(Error 22029). The step failed.
Please help me resolve this error.
Joe
Did you check an Error log for any info there?
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE
> 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>
|||Yes, I checked the SQL Server error log.
Nothing was in the error log that correponds to this error.
Thanks,
"Uri Dimant" wrote:

> Joe
> Did you check an Error log for any info there?
> "Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
> news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
>
>
|||Also, which job did this fail on?
For example, if you have a tran log backup job and you have mixed full
recovery model databases with simple model, you will get an error (even
though the backups completed, the error will be thrown). Its always a good
idea to separate out the system, full model user, bulk mode user and simple
model user database backups into separate plans, and configure each
appropriately.
Awaiting your response for more info as per Uri.
AndyP,
Sr. Database Administrator,
MCDBA 2003 &
Sybase Certified Pro DBA (AA115, SD115, AA12, AP12)
"Joe K." wrote:

> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>
|||Specify a report file for the main plan and check that report file for error messages.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>

Maintenance Plan DB Integrity Job Failed

I created a SQL Server 2000 database maintenance plan with the wizard.
I selected integrity checks and complete backups for my database and
completed the requiremenents.
I received the following error listed below.
Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42000]
(Error 22029). The step failed.
Please help me resolve this error.Joe
Did you check an Error log for any info there?
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE
> 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>|||Yes, I checked the SQL Server error log.
Nothing was in the error log that correponds to this error.
Thanks,
"Uri Dimant" wrote:
> Joe
> Did you check an Error log for any info there?
> "Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
> news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> >
> > I created a SQL Server 2000 database maintenance plan with the wizard.
> > I selected integrity checks and complete backups for my database and
> > completed the requiremenents.
> >
> > I received the following error listed below.
> >
> > Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE
> > 42000]
> > (Error 22029). The step failed.
> >
> > Please help me resolve this error.
> >
>
>|||Also, which job did this fail on?
For example, if you have a tran log backup job and you have mixed full
recovery model databases with simple model, you will get an error (even
though the backups completed, the error will be thrown). Its always a good
idea to separate out the system, full model user, bulk mode user and simple
model user database backups into separate plans, and configure each
appropriately.
Awaiting your response for more info as per Uri.
--
AndyP,
Sr. Database Administrator,
MCDBA 2003 &
Sybase Certified Pro DBA (AA115, SD115, AA12, AP12)
"Joe K." wrote:
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>|||Specify a report file for the main plan and check that report file for error messages.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Joe K." <Joe K.@.discussions.microsoft.com> wrote in message
news:2B2D49CA-5E9F-4B76-AE3E-CE9F52E6B802@.microsoft.com...
> I created a SQL Server 2000 database maintenance plan with the wizard.
> I selected integrity checks and complete backups for my database and
> completed the requiremenents.
> I received the following error listed below.
> Executed as user: NT AUTHORITY\SYSTEM. sqlmaint.exe failed. [SQLSTATE 42000]
> (Error 22029). The step failed.
> Please help me resolve this error.
>

Maintenance plan backups fail

Hi, I have a scheduled maintenance plan that backs up my database (SQL 2000). The db is 108 Meg. Usually the backup files are around 89 Meg and the transaction log backups are around 4.5 Megs.

The problem is that every once a while the backup fails with the following error:

[Microsoft SQL-DMO (ODBC SQLState: 42000)] Error 3202: [Microsoft][ODBC SQL Server Driver][SQL Server]Write on 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\CRM_db_200312230100.BAK' failed, status = 112. See the SQL Server error log for more details.
[Microsoft][ODBC SQL Server Driver][SQL Server]BACKUP DATABASE is terminating abnormally.

What usually happens is that the last backup that has failed has a size of 9 or 8 Gigs!

My guess is that a backup file gets corrupt (the size increases to 8 Gigs) and the server runs out of space and wont be able to do more backups. However I cant figure out why the backup file size increases to and gets corrupt.

Can anyone help me?What does the error log say...

did you a dbcc checkdb?|||Thanks for your reply, the error log says:

1.Source:Backup
BACKUP failed to complete the command BACKUP DATABASE [MYDB] TO DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MYDB_db_200312230100.BAK' WITH INIT , NOUNLOAD , NOSKIP , STATS = 10, NOFORMAT

2.Source:spid54
BackupMedium::ReportIoError: write failure on backup device 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MYDB_db_200312230100.BAK'. Operating system error 112(There is not enough space on the disk.).

3.Source:spid54
Internal I/O request 0x12844D98: Op: Write, pBuffer: 0x12C40000, Size: 983040, Position: 14752256, UMS: Internal: 0x103, InternalHigh: 0x0, Offset: 0xE11A00, OffsetHigh: 0x0, m_buf: 0x12C40000, m_len: 983040, m_actualBytes: 0, m_errcode: 112, BackupFile: C:\Program Files\Microsoft SQL

It looks like somthing happended to the last backup and the size increased to 8 Gigs and the disk ran out of space, but I can't figure why this happenes every once in a while.

Thanks



Originally posted by Brett Kaiser
What does the error log say...

did you a dbcc checkdb?|||You can't just assume that the backup gets corrupted without trying to restore it. Have you tried to do that?|||I havn't but there must be somthing wrong with it, since its 8 gig instead of 80 Megs, plus when I deleted it and made a backup manualy the size of the new backup was the regular 80 megs

Originally posted by rdjabarov
You can't just assume that the backup gets corrupted without trying to restore it. Have you tried to do that?

Monday, March 26, 2012

Maintenance Plan

I've done quite a bit of reading about SQL 2000 full backups and log
backups. I have a pretty good idea on how to make this happen (or at
least I think I do).
Here's the current problem, I have a database that was created by a
third party and it needs to be fully backed up every night with hourly
log backups. I scheduled this to run using the maintenance wizard, I
changed the recovery model from Simple to Full in order to keep log
backups.
Now the transaction log is getting quite large, through my readings,
I've found out that backing up the log does truncate the log but
doesn't reduce the physical log size. I guess I need to backup the log
and then do a dbcc shrinkfile in order to actually shrink the physical
log to a target size. In order to do this I need to write my own backup
scripts without using the wizard...Right?
So if that's correct my question is: Where do I write the scripts? In a
SP and then schedule it to run somehow? Additionally should I write 2
sp's, one for the nightly full backup and another for the hourly log
backups?
This 3rd party db has a lot of tables that are unused (about 100), so
when I write my maintenance script should I specify only the tables I
want to reindex? Is there any performance consideration here?
In the end, I need to fully back up the db nightly and the transaction
log hourly while keeping the physical file size as small as possible
while still being able to restore to a point-in-time.
I'm pretty sure I can write the scripts for this, I'm just not sure
where to put the scripts and how to schedule it?
Any help would be appreciated.
Israel> Now the transaction log is getting quite large, through my readings,
> I've found out that backing up the log does truncate the log but
> doesn't reduce the physical log size. I guess I need to backup the log
> and then do a dbcc shrinkfile in order to actually shrink the physical
> log to a target size.
What do you mean by "target size"? Why would you want to shrink the log file
if it will just bump up
to the size it need to be again? See http://www.karaszi.com/SQLServer/in...br />
rink.asp for more
details.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144682154.389600.122100@.t31g2000cwb.googlegroups.com...
> I've done quite a bit of reading about SQL 2000 full backups and log
> backups. I have a pretty good idea on how to make this happen (or at
> least I think I do).
> Here's the current problem, I have a database that was created by a
> third party and it needs to be fully backed up every night with hourly
> log backups. I scheduled this to run using the maintenance wizard, I
> changed the recovery model from Simple to Full in order to keep log
> backups.
> Now the transaction log is getting quite large, through my readings,
> I've found out that backing up the log does truncate the log but
> doesn't reduce the physical log size. I guess I need to backup the log
> and then do a dbcc shrinkfile in order to actually shrink the physical
> log to a target size. In order to do this I need to write my own backup
> scripts without using the wizard...Right?
> So if that's correct my question is: Where do I write the scripts? In a
> SP and then schedule it to run somehow? Additionally should I write 2
> sp's, one for the nightly full backup and another for the hourly log
> backups?
> This 3rd party db has a lot of tables that are unused (about 100), so
> when I write my maintenance script should I specify only the tables I
> want to reindex? Is there any performance consideration here?
> In the end, I need to fully back up the db nightly and the transaction
> log hourly while keeping the physical file size as small as possible
> while still being able to restore to a point-in-time.
> I'm pretty sure I can write the scripts for this, I'm just not sure
> where to put the scripts and how to schedule it?
> Any help would be appreciated.
> Israel
>|||OK, thanks for the article, point taken.
The size of the db is 7.5GB, Indexes are rebuilt every night when the
db is backed up. I'm guessing that is what caused the log file to grow
beyond 11GB, reindexing of the tables. Even if this was only done once
a week, eventually the log would grow again too a size it shouldn't
need to be.
How do I get around this problem of the log getting too big and using
up the available disk space?
In the past this database was set to Simple Recovery so this wasn't an
issue, now the need has changed and losing a day of work isn't an
option.
What would you recommend?
Thanks,
Israel|||Why shouldn't it need to be that size? If it requires to hold that much
info in-between log backups then that is the size it needs to be. Shrinking
it doesn't make that go away. If you want to keep the log file smaller at
all times you basically have two options. One is to do several log backups
while the reindexing is going on. Or simply reindex the indexes that
actually need to be reindexed. Forget the maintenance plan and write your
own job to issue a DBCC DBREINDEX on only the indexes that have enough
fragmentation to warrant it. You can find an example in BooksOnLine under
DBCC SHOWCONTIG for how to do that.
Andrew J. Kelly SQL MVP
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144691290.716456.303060@.g10g2000cwb.googlegroups.com...
> OK, thanks for the article, point taken.
> The size of the db is 7.5GB, Indexes are rebuilt every night when the
> db is backed up. I'm guessing that is what caused the log file to grow
> beyond 11GB, reindexing of the tables. Even if this was only done once
> a week, eventually the log would grow again too a size it shouldn't
> need to be.
> How do I get around this problem of the log getting too big and using
> up the available disk space?
> In the past this database was set to Simple Recovery so this wasn't an
> issue, now the need has changed and losing a day of work isn't an
> option.
> What would you recommend?
> Thanks,
> Israel
>|||Thanks Andrew,
That's pretty much the conclusion I've come to as well. Until I get the
scripts written I've disabled the reindexing.
In one thread someone recommended changing the Recovery Model to
Bulk-Logged during the reindexing and changing it back once it
completes, they said that would keep the transaction log from getting
so big. What is your take on that approach?
My original question was how to go about executing my own scripts. Do I
create a SP for this? If so how do I schedule the SP to run?
This is my first attempt at recovery procedures, so sorry if that
question seems a little "no brainer".|||> In one thread someone recommended changing the Recovery Model to
> Bulk-Logged during the reindexing and changing it back once it
> completes, they said that would keep the transaction log from getting
> so big. What is your take on that approach?
The ldf files might not log nearly as much for some operations (like index r
ebuilds). but the
following transaction log backup will not only contain log records, but also
data pages - so it can
get very big. Also, you cannot perform point in time restore for such a tran
saction log backup. You
can give it a spin ans see how well it work out for your environment.

> My original question was how to go about executing my own scripts. Do I
> create a SP for this? If so how do I schedule the SP to run?
Encapsulating the TSQL commands in a procedure is a good idea. You can then
schedult the procedure
using SQL Server Agent (EM, Management, ...).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144759482.900957.286230@.i40g2000cwc.googlegroups.com...
> Thanks Andrew,
> That's pretty much the conclusion I've come to as well. Until I get the
> scripts written I've disabled the reindexing.
> In one thread someone recommended changing the Recovery Model to
> Bulk-Logged during the reindexing and changing it back once it
> completes, they said that would keep the transaction log from getting
> so big. What is your take on that approach?
> My original question was how to go about executing my own scripts. Do I
> create a SP for this? If so how do I schedule the SP to run?
> This is my first attempt at recovery procedures, so sorry if that
> question seems a little "no brainer".
>|||Thanks Tibor,
I now have a SP to reindex only tables with an index that is >= 30%
fragmented. I tried it out on my test db and got some wierd results.
I found a table which is 66% fragmented, ran DBCC DBREINDEX
(EDI_210,'',80) on just that table and it still shows it being 66%
fragmented.
Any idea why that is?
Here is the results of running DBCC SHOWCONTIG (EDI_210)
DBCC SHOWCONTIG scanning 'edi_210' table...
Table: 'edi_210' (725577623); index ID: 0, database ID: 9
TABLE level scan performed.
- Pages Scanned........................: 4
- Extents Scanned.......................: 3
- Extent Switches.......................: 2
- Avg. Pages per Extent..................: 1.3
- Scan Density [Best Count:Actual Count]......: 33.33% [1:3]
- Extent Scan Fragmentation ...............: 66.67%
- Avg. Bytes Free per Page................: 2849.5
- Avg. Page Density (full)................: 64.79%|||IndexID 0 means this is a heap, so DBREINDEX will not shuffle any data pages
.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144767691.735932.174430@.i39g2000cwa.googlegroups.com...
> Thanks Tibor,
> I now have a SP to reindex only tables with an index that is >= 30%
> fragmented. I tried it out on my test db and got some wierd results.
> I found a table which is 66% fragmented, ran DBCC DBREINDEX
> (EDI_210,'',80) on just that table and it still shows it being 66%
> fragmented.
> Any idea why that is?
> Here is the results of running DBCC SHOWCONTIG (EDI_210)
> DBCC SHOWCONTIG scanning 'edi_210' table...
> Table: 'edi_210' (725577623); index ID: 0, database ID: 9
> TABLE level scan performed.
> - Pages Scanned........................: 4
> - Extents Scanned.......................: 3
> - Extent Switches.......................: 2
> - Avg. Pages per Extent..................: 1.3
> - Scan Density [Best Count:Actual Count]......: 33.33% [1:3]
> - Extent Scan Fragmentation ...............: 66.67%
> - Avg. Bytes Free per Page................: 2849.5
> - Avg. Page Density (full)................: 64.79%
>|||So let me make sure I have this right.
After I write the SP to performe the maintenance, I'll create a new
Job...give it a schedule...and just put EXEC Procedure in the Command
box when creating a new job step.
Is that all there is too it?|||Yep. And, make that jobstep a TSQL one. Also check out the Advanced tab, whe
re you can specify an
output file.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144777279.033714.283750@.g10g2000cwb.googlegroups.com...
> So let me make sure I have this right.
> After I write the SP to performe the maintenance, I'll create a new
> Job...give it a schedule...and just put EXEC Procedure in the Command
> box when creating a new job step.
> Is that all there is too it?
>

Friday, March 23, 2012

Maintenance Plan

I've done quite a bit of reading about SQL 2000 full backups and log
backups. I have a pretty good idea on how to make this happen (or at
least I think I do).
Here's the current problem, I have a database that was created by a
third party and it needs to be fully backed up every night with hourly
log backups. I scheduled this to run using the maintenance wizard, I
changed the recovery model from Simple to Full in order to keep log
backups.
Now the transaction log is getting quite large, through my readings,
I've found out that backing up the log does truncate the log but
doesn't reduce the physical log size. I guess I need to backup the log
and then do a dbcc shrinkfile in order to actually shrink the physical
log to a target size. In order to do this I need to write my own backup
scripts without using the wizard...Right?
So if that's correct my question is: Where do I write the scripts? In a
SP and then schedule it to run somehow? Additionally should I write 2
sp's, one for the nightly full backup and another for the hourly log
backups?
This 3rd party db has a lot of tables that are unused (about 100), so
when I write my maintenance script should I specify only the tables I
want to reindex? Is there any performance consideration here?
In the end, I need to fully back up the db nightly and the transaction
log hourly while keeping the physical file size as small as possible
while still being able to restore to a point-in-time.
I'm pretty sure I can write the scripts for this, I'm just not sure
where to put the scripts and how to schedule it?
Any help would be appreciated.
Israel> Now the transaction log is getting quite large, through my readings,
> I've found out that backing up the log does truncate the log but
> doesn't reduce the physical log size. I guess I need to backup the log
> and then do a dbcc shrinkfile in order to actually shrink the physical
> log to a target size.
What do you mean by "target size"? Why would you want to shrink the log file if it will just bump up
to the size it need to be again? See http://www.karaszi.com/SQLServer/info_dont_shrink.asp for more
details.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144682154.389600.122100@.t31g2000cwb.googlegroups.com...
> I've done quite a bit of reading about SQL 2000 full backups and log
> backups. I have a pretty good idea on how to make this happen (or at
> least I think I do).
> Here's the current problem, I have a database that was created by a
> third party and it needs to be fully backed up every night with hourly
> log backups. I scheduled this to run using the maintenance wizard, I
> changed the recovery model from Simple to Full in order to keep log
> backups.
> Now the transaction log is getting quite large, through my readings,
> I've found out that backing up the log does truncate the log but
> doesn't reduce the physical log size. I guess I need to backup the log
> and then do a dbcc shrinkfile in order to actually shrink the physical
> log to a target size. In order to do this I need to write my own backup
> scripts without using the wizard...Right?
> So if that's correct my question is: Where do I write the scripts? In a
> SP and then schedule it to run somehow? Additionally should I write 2
> sp's, one for the nightly full backup and another for the hourly log
> backups?
> This 3rd party db has a lot of tables that are unused (about 100), so
> when I write my maintenance script should I specify only the tables I
> want to reindex? Is there any performance consideration here?
> In the end, I need to fully back up the db nightly and the transaction
> log hourly while keeping the physical file size as small as possible
> while still being able to restore to a point-in-time.
> I'm pretty sure I can write the scripts for this, I'm just not sure
> where to put the scripts and how to schedule it?
> Any help would be appreciated.
> Israel
>|||OK, thanks for the article, point taken.
The size of the db is 7.5GB, Indexes are rebuilt every night when the
db is backed up. I'm guessing that is what caused the log file to grow
beyond 11GB, reindexing of the tables. Even if this was only done once
a week, eventually the log would grow again too a size it shouldn't
need to be.
How do I get around this problem of the log getting too big and using
up the available disk space?
In the past this database was set to Simple Recovery so this wasn't an
issue, now the need has changed and losing a day of work isn't an
option.
What would you recommend?
Thanks,
Israel|||Why shouldn't it need to be that size? If it requires to hold that much
info in-between log backups then that is the size it needs to be. Shrinking
it doesn't make that go away. If you want to keep the log file smaller at
all times you basically have two options. One is to do several log backups
while the reindexing is going on. Or simply reindex the indexes that
actually need to be reindexed. Forget the maintenance plan and write your
own job to issue a DBCC DBREINDEX on only the indexes that have enough
fragmentation to warrant it. You can find an example in BooksOnLine under
DBCC SHOWCONTIG for how to do that.
--
Andrew J. Kelly SQL MVP
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144691290.716456.303060@.g10g2000cwb.googlegroups.com...
> OK, thanks for the article, point taken.
> The size of the db is 7.5GB, Indexes are rebuilt every night when the
> db is backed up. I'm guessing that is what caused the log file to grow
> beyond 11GB, reindexing of the tables. Even if this was only done once
> a week, eventually the log would grow again too a size it shouldn't
> need to be.
> How do I get around this problem of the log getting too big and using
> up the available disk space?
> In the past this database was set to Simple Recovery so this wasn't an
> issue, now the need has changed and losing a day of work isn't an
> option.
> What would you recommend?
> Thanks,
> Israel
>|||Thanks Andrew,
That's pretty much the conclusion I've come to as well. Until I get the
scripts written I've disabled the reindexing.
In one thread someone recommended changing the Recovery Model to
Bulk-Logged during the reindexing and changing it back once it
completes, they said that would keep the transaction log from getting
so big. What is your take on that approach?
My original question was how to go about executing my own scripts. Do I
create a SP for this? If so how do I schedule the SP to run?
This is my first attempt at recovery procedures, so sorry if that
question seems a little "no brainer".|||> In one thread someone recommended changing the Recovery Model to
> Bulk-Logged during the reindexing and changing it back once it
> completes, they said that would keep the transaction log from getting
> so big. What is your take on that approach?
The ldf files might not log nearly as much for some operations (like index rebuilds). but the
following transaction log backup will not only contain log records, but also data pages - so it can
get very big. Also, you cannot perform point in time restore for such a transaction log backup. You
can give it a spin ans see how well it work out for your environment.
> My original question was how to go about executing my own scripts. Do I
> create a SP for this? If so how do I schedule the SP to run?
Encapsulating the TSQL commands in a procedure is a good idea. You can then schedult the procedure
using SQL Server Agent (EM, Management, ...).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144759482.900957.286230@.i40g2000cwc.googlegroups.com...
> Thanks Andrew,
> That's pretty much the conclusion I've come to as well. Until I get the
> scripts written I've disabled the reindexing.
> In one thread someone recommended changing the Recovery Model to
> Bulk-Logged during the reindexing and changing it back once it
> completes, they said that would keep the transaction log from getting
> so big. What is your take on that approach?
> My original question was how to go about executing my own scripts. Do I
> create a SP for this? If so how do I schedule the SP to run?
> This is my first attempt at recovery procedures, so sorry if that
> question seems a little "no brainer".
>|||Thanks Tibor,
I now have a SP to reindex only tables with an index that is >= 30%
fragmented. I tried it out on my test db and got some wierd results.
I found a table which is 66% fragmented, ran DBCC DBREINDEX
(EDI_210,'',80) on just that table and it still shows it being 66%
fragmented.
Any idea why that is?
Here is the results of running DBCC SHOWCONTIG (EDI_210)
DBCC SHOWCONTIG scanning 'edi_210' table...
Table: 'edi_210' (725577623); index ID: 0, database ID: 9
TABLE level scan performed.
- Pages Scanned........................: 4
- Extents Scanned.......................: 3
- Extent Switches.......................: 2
- Avg. Pages per Extent..................: 1.3
- Scan Density [Best Count:Actual Count]......: 33.33% [1:3]
- Extent Scan Fragmentation ...............: 66.67%
- Avg. Bytes Free per Page................: 2849.5
- Avg. Page Density (full)................: 64.79%|||IndexID 0 means this is a heap, so DBREINDEX will not shuffle any data pages.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144767691.735932.174430@.i39g2000cwa.googlegroups.com...
> Thanks Tibor,
> I now have a SP to reindex only tables with an index that is >= 30%
> fragmented. I tried it out on my test db and got some wierd results.
> I found a table which is 66% fragmented, ran DBCC DBREINDEX
> (EDI_210,'',80) on just that table and it still shows it being 66%
> fragmented.
> Any idea why that is?
> Here is the results of running DBCC SHOWCONTIG (EDI_210)
> DBCC SHOWCONTIG scanning 'edi_210' table...
> Table: 'edi_210' (725577623); index ID: 0, database ID: 9
> TABLE level scan performed.
> - Pages Scanned........................: 4
> - Extents Scanned.......................: 3
> - Extent Switches.......................: 2
> - Avg. Pages per Extent..................: 1.3
> - Scan Density [Best Count:Actual Count]......: 33.33% [1:3]
> - Extent Scan Fragmentation ...............: 66.67%
> - Avg. Bytes Free per Page................: 2849.5
> - Avg. Page Density (full)................: 64.79%
>|||So let me make sure I have this right.
After I write the SP to performe the maintenance, I'll create a new
Job...give it a schedule...and just put EXEC Procedure in the Command
box when creating a new job step.
Is that all there is too it?|||Yep. And, make that jobstep a TSQL one. Also check out the Advanced tab, where you can specify an
output file.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144777279.033714.283750@.g10g2000cwb.googlegroups.com...
> So let me make sure I have this right.
> After I write the SP to performe the maintenance, I'll create a new
> Job...give it a schedule...and just put EXEC Procedure in the Command
> box when creating a new job step.
> Is that all there is too it?
>|||Great!
You guys have been a big help and I appreciate it.
Israel Richner, SQL Server Newbie :-)|||Great!
You guys have been a big help and I appreciate it.
Israel Richner, SQL Server Newbie :-)|||Just to add some to Tibor's reply on the heap issue. It is recommended that
every table have a clustered index if for no other reason than to allow you
to control fragmentation. This particular table has too few pages to worry
about it one way or the other. Until you get to 8 or more pages a table or
index will always use a Mixed Extent (means the pages are spread across up
to 8 extents instead of just one) and the fragmentation will never look
good. Reindexing these will not hurt anything but just keep this in mind.
--
Andrew J. Kelly SQL MVP
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144767691.735932.174430@.i39g2000cwa.googlegroups.com...
> Thanks Tibor,
> I now have a SP to reindex only tables with an index that is >= 30%
> fragmented. I tried it out on my test db and got some wierd results.
> I found a table which is 66% fragmented, ran DBCC DBREINDEX
> (EDI_210,'',80) on just that table and it still shows it being 66%
> fragmented.
> Any idea why that is?
> Here is the results of running DBCC SHOWCONTIG (EDI_210)
> DBCC SHOWCONTIG scanning 'edi_210' table...
> Table: 'edi_210' (725577623); index ID: 0, database ID: 9
> TABLE level scan performed.
> - Pages Scanned........................: 4
> - Extents Scanned.......................: 3
> - Extent Switches.......................: 2
> - Avg. Pages per Extent..................: 1.3
> - Scan Density [Best Count:Actual Count]......: 33.33% [1:3]
> - Extent Scan Fragmentation ...............: 66.67%
> - Avg. Bytes Free per Page................: 2849.5
> - Avg. Page Density (full)................: 64.79%
>|||Ok, since the table is very small I wont worry about trying to fix
something that isn't broken.
I've got a script now that will reindex tables that are >= 30%
fragmented, but I want to employ your suggestion regarding performing
log backups during
reindexing if the tlog grows beyond a certain point.
Right now my log seems to be holding steady at about 80mb and I'd like
to see it stay less than 1gb because storage space is a factor.
If it were my decision I'd just add enough drive space to accomidate
whatever size it needed to grow too. But it's not, in fact my IT
manager has two heavily used network shares on the same drive as our
database and Tlog file. I bet that made you cringe hu?!
I've tried to talk him into moving the shares and putting the database
file and tlog file on seperate drives, but no luck there.
Anyway, so I'm wondering is there a way too evaluate the size of the
Tlog while I'm looping through my tables and reindexing them?
Here is my script for reindexing my tables, I got it from BOL and
modified it a little.
SET NOCOUNT ON
DECLARE @.TABLENAME VARCHAR (128)
DECLARE @.EXECSTR VARCHAR (255)
DECLARE @.MAXFRAG DECIMAL
DECLARE @.FILLFACTOR TINYINT
SELECT @.MAXFRAG = 30.0
SELECT @.FILLFACTOR = 80
DECLARE TABLES CURSOR FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'
CREATE TABLE #FRAGLIST (
OBJECTNAME CHAR (255),
OBJECTID INT,
INDEXNAME CHAR (255),
INDEXID INT,
LVL INT,
COUNTPAGES INT,
COUNTROWS INT,
MINRECSIZE INT,
MAXRECSIZE INT,
AVGRECSIZE INT,
FORRECCOUNT INT,
EXTENTS INT,
EXTENTSWITCHES INT,
AVGFREEBYTES INT,
AVGPAGEDENSITY INT,
SCANDENSITY DECIMAL,
BESTCOUNT INT,
ACTUALCOUNT INT,
LOGICALFRAG DECIMAL,
EXTENTFRAG DECIMAL)
OPEN TABLES
FETCH NEXT FROM TABLES INTO @.TABLENAME
WHILE @.@.FETCH_STATUS = 0
BEGIN
INSERT INTO #FRAGLIST
EXEC ('DBCC SHOWCONTIG (''' + @.TABLENAME + ''')
WITH FAST, TABLERESULTS, ALL_INDEXES, NO_INFOMSGS')
FETCH NEXT FROM TABLES INTO @.TABLENAME
END
CLOSE TABLES
DEALLOCATE TABLES
DECLARE INDEXES CURSOR FOR
SELECT DISTINCT OBJECTNAME
FROM #FRAGLIST
WHERE LOGICALFRAG >= @.MAXFRAG
OPEN INDEXES
FETCH NEXT FROM INDEXES INTO @.TABLENAME
WHILE @.@.FETCH_STATUS = 0
BEGIN
SELECT @.EXECSTR = 'DBCC DBREINDEX (' + @.TABLENAME + ','''',' +
RTRIM(@.FILLFACTOR) + ')'
EXEC (@.EXECSTR)
--I'd like to evaluate the tlog here and perform a backup if size is >=value
FETCH NEXT FROM INDEXES INTO @.TABLENAME
END
CLOSE INDEXES
DEALLOCATE INDEXES
DROP TABLE #FRAGLIST
SET NOCOUNT OFF
GO|||I figured it out, and for anyone wondering how...it's like this:
CREATE TABLE #LOGS
(
DATABASENAME VARCHAR(25),
LOGSIZE DECIMAL(10,5),
LOGSPACEUSED DECIMAL(10,5),
LOGSTATUS TINYINT
)
INSERT INTO #LOGS
EXEC ('DBCC SQLPERF(LOGSPACE)')
SELECT LOGSIZE
FROM #LOGS
WHERE DATABASENAME = [database name]
DROP TABLE #LOGS|||Yup, that is what I would have suggested had you given me the chance:).
--
Andrew J. Kelly SQL MVP
"Izzy" <israel.richner@.gmail.com> wrote in message
news:1144852022.220627.5640@.i40g2000cwc.googlegroups.com...
>I figured it out, and for anyone wondering how...it's like this:
> CREATE TABLE #LOGS
> (
> DATABASENAME VARCHAR(25),
> LOGSIZE DECIMAL(10,5),
> LOGSPACEUSED DECIMAL(10,5),
> LOGSTATUS TINYINT
> )
> INSERT INTO #LOGS
> EXEC ('DBCC SQLPERF(LOGSPACE)')
> SELECT LOGSIZE
> FROM #LOGS
> WHERE DATABASENAME = [database name]
> DROP TABLE #LOGS
>

maintenance fails

Hi
Im running a Windows 2003 server and MSSQL 2000 that manages some 45
databases. I created an maintenance plan that does an integrity check,
backups all databases, and backup all transactionlogs.
If I look at the "Jobs" list it looks like backing up the databases runs OK,
but both the integrity check and transaction log seams to fail.
If I look at the folder holding the backupfiles all transactionfiles looks
to be there (backup of all the transaction logs). So what makes the job
fail? If I look at the event log all transaction-log-backups complete OK,
but still the job ends in failure and the eventlog only states that the job
faild - not why it failed.
How can I track this problem? And is this why the transaction logs are not
truncated?
Regards
Jan Agermose
Hi
Within a job specify an output file to see what is going on.
<msde@.csite.com> wrote in message
news:epoOEnVUFHA.1044@.TK2MSFTNGP10.phx.gbl...
> Hi
> Im running a Windows 2003 server and MSSQL 2000 that manages some 45
> databases. I created an maintenance plan that does an integrity check,
> backups all databases, and backup all transactionlogs.
> If I look at the "Jobs" list it looks like backing up the databases runs
OK,
> but both the integrity check and transaction log seams to fail.
> If I look at the folder holding the backupfiles all transactionfiles looks
> to be there (backup of all the transaction logs). So what makes the job
> fail? If I look at the event log all transaction-log-backups complete OK,
> but still the job ends in failure and the eventlog only states that the
job
> faild - not why it failed.
> How can I track this problem? And is this why the transaction logs are not
> truncated?
> Regards
> Jan Agermose
>
>
|||Hello Jan,
Go to your maintenance plan in enterprise manager and right click on it.
Select "Maintenance Plan History...". In the Status dropdown, select
"Failed". You should now see a list of failed tasks in your plan. Look for a
plan with an activity of "Backup Transaction Log" and double click it. The
reason for failure will appear. My guess is that the database is in simple
recovery mode and you will get an error similar to "Backup can not be
performed on this database. This sub task is ignored".
All you have to do in this instance is remove databases that have simple
recovery from your maintenance plan, or change them to a different recovery
model (if that's what you need).
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
"msde@.csite.com" wrote:

> Hi
> Im running a Windows 2003 server and MSSQL 2000 that manages some 45
> databases. I created an maintenance plan that does an integrity check,
> backups all databases, and backup all transactionlogs.
> If I look at the "Jobs" list it looks like backing up the databases runs OK,
> but both the integrity check and transaction log seams to fail.
> If I look at the folder holding the backupfiles all transactionfiles looks
> to be there (backup of all the transaction logs). So what makes the job
> fail? If I look at the event log all transaction-log-backups complete OK,
> but still the job ends in failure and the eventlog only states that the job
> faild - not why it failed.
> How can I track this problem? And is this why the transaction logs are not
> truncated?
> Regards
> Jan Agermose
>
>
|||Ahhh :-) Of cause - I selsected to backup all databases - this includes
"master", "tempdb" and the test database "northwind". Doing a backup of the
transaction log fails.
I guess that means I need two plans
One for all user databases but not the system databases - this plan does a
databasebackup and a transactionlog backup.
And one for the system databases that does not try to backup the
transactionlog?
Regards
Jan
"Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
news:7D5CF0AB-9C9C-4675-8CCA-BFFA2E3092FB@.microsoft.com...[vbcol=seagreen]
> Hello Jan,
> Go to your maintenance plan in enterprise manager and right click on it.
> Select "Maintenance Plan History...". In the Status dropdown, select
> "Failed". You should now see a list of failed tasks in your plan. Look for
> a
> plan with an activity of "Backup Transaction Log" and double click it. The
> reason for failure will appear. My guess is that the database is in simple
> recovery mode and you will get an error similar to "Backup can not be
> performed on this database. This sub task is ignored".
> All you have to do in this instance is remove databases that have simple
> recovery from your maintenance plan, or change them to a different
> recovery
> model (if that's what you need).
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
>
> "msde@.csite.com" wrote:
|||You got the point, Jan.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<msde@.csite.com> wrote in message news:O8YUBjbUFHA.3280@.TK2MSFTNGP09.phx.gbl...
> Ahhh :-) Of cause - I selsected to backup all databases - this includes "master", "tempdb" and the
> test database "northwind". Doing a backup of the transaction log fails.
> I guess that means I need two plans
> One for all user databases but not the system databases - this plan does a databasebackup and a
> transactionlog backup.
> And one for the system databases that does not try to backup the transactionlog?
> Regards
> Jan
>
> "Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
> news:7D5CF0AB-9C9C-4675-8CCA-BFFA2E3092FB@.microsoft.com...
>

maintenance fails

Hi
Im running a Windows 2003 server and MSSQL 2000 that manages some 45
databases. I created an maintenance plan that does an integrity check,
backups all databases, and backup all transactionlogs.
If I look at the "Jobs" list it looks like backing up the databases runs OK,
but both the integrity check and transaction log seams to fail.
If I look at the folder holding the backupfiles all transactionfiles looks
to be there (backup of all the transaction logs). So what makes the job
fail? If I look at the event log all transaction-log-backups complete OK,
but still the job ends in failure and the eventlog only states that the job
faild - not why it failed.
How can I track this problem? And is this why the transaction logs are not
truncated?
Regards
Jan AgermoseHi
Within a job specify an output file to see what is going on.
<msde@.csite.com> wrote in message
news:epoOEnVUFHA.1044@.TK2MSFTNGP10.phx.gbl...
> Hi
> Im running a Windows 2003 server and MSSQL 2000 that manages some 45
> databases. I created an maintenance plan that does an integrity check,
> backups all databases, and backup all transactionlogs.
> If I look at the "Jobs" list it looks like backing up the databases runs
OK,
> but both the integrity check and transaction log seams to fail.
> If I look at the folder holding the backupfiles all transactionfiles looks
> to be there (backup of all the transaction logs). So what makes the job
> fail? If I look at the event log all transaction-log-backups complete OK,
> but still the job ends in failure and the eventlog only states that the
job
> faild - not why it failed.
> How can I track this problem? And is this why the transaction logs are not
> truncated?
> Regards
> Jan Agermose
>
>|||Hello Jan,
Go to your maintenance plan in enterprise manager and right click on it.
Select "Maintenance Plan History...". In the Status dropdown, select
"Failed". You should now see a list of failed tasks in your plan. Look for a
plan with an activity of "Backup Transaction Log" and double click it. The
reason for failure will appear. My guess is that the database is in simple
recovery mode and you will get an error similar to "Backup can not be
performed on this database. This sub task is ignored".
All you have to do in this instance is remove databases that have simple
recovery from your maintenance plan, or change them to a different recovery
model (if that's what you need).
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html
"msde@.csite.com" wrote:

> Hi
> Im running a Windows 2003 server and MSSQL 2000 that manages some 45
> databases. I created an maintenance plan that does an integrity check,
> backups all databases, and backup all transactionlogs.
> If I look at the "Jobs" list it looks like backing up the databases runs O
K,
> but both the integrity check and transaction log seams to fail.
> If I look at the folder holding the backupfiles all transactionfiles looks
> to be there (backup of all the transaction logs). So what makes the job
> fail? If I look at the event log all transaction-log-backups complete OK,
> but still the job ends in failure and the eventlog only states that the jo
b
> faild - not why it failed.
> How can I track this problem? And is this why the transaction logs are not
> truncated?
> Regards
> Jan Agermose
>
>|||Ahhh :-) Of cause - I selsected to backup all databases - this includes
"master", "tempdb" and the test database "northwind". Doing a backup of the
transaction log fails.
I guess that means I need two plans
One for all user databases but not the system databases - this plan does a
databasebackup and a transactionlog backup.
And one for the system databases that does not try to backup the
transactionlog?
Regards
Jan
"Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
news:7D5CF0AB-9C9C-4675-8CCA-BFFA2E3092FB@.microsoft.com...[vbcol=seagreen]
> Hello Jan,
> Go to your maintenance plan in enterprise manager and right click on it.
> Select "Maintenance Plan History...". In the Status dropdown, select
> "Failed". You should now see a list of failed tasks in your plan. Look for
> a
> plan with an activity of "Backup Transaction Log" and double click it. The
> reason for failure will appear. My guess is that the database is in simple
> recovery mode and you will get an error similar to "Backup can not be
> performed on this database. This sub task is ignored".
> All you have to do in this instance is remove databases that have simple
> recovery from your maintenance plan, or change them to a different
> recovery
> model (if that's what you need).
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602m.html
>
>
> "msde@.csite.com" wrote:
>|||You got the point, Jan.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<msde@.csite.com> wrote in message news:O8YUBjbUFHA.3280@.TK2MSFTNGP09.phx.gbl...en">
> Ahhh :-) Of cause - I selsected to backup all databases - this includes "m
aster", "tempdb" and the
> test database "northwind". Doing a backup of the transaction log fails.
> I guess that means I need two plans
> One for all user databases but not the system databases - this plan does a
databasebackup and a
> transactionlog backup.
> And one for the system databases that does not try to backup the transacti
onlog?
> Regards
> Jan
>
> "Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
> news:7D5CF0AB-9C9C-4675-8CCA-BFFA2E3092FB@.microsoft.com...
>

Maintenance Cleanup Task……

SQL Server 2005 Standard Edition

Windows Server 2003.

I have created an ‘Backup Database Task’ to create the database backups and checked the option “Create a subdirectory for each database”.

When I add the “Maintenance Cleanup Task” I am not getting the similar option to clean the backup files in the subdirectory.

Any suggestion on how to solve this?

I can always uncheck the “Create a subdirectory for each database” option to create the backup files in one location.

Thank you,

Smith

Smith,
Once you create a Sub directory the backup files will be placed there...now in the clean up task there is an option called "Search folder and delete files based on an extension" you need to specify the sub directory folder in the above mentioned option........the clean up task will delete it and also you need to psecify the extension as "bak" to delete backup files.........refer the below link,
http://www.sql-server-performance.com/articles/dba/creating_backup_jobs_p2.aspx


|||

This article could be helpful for you

http://msdn2.microsoft.com/en-us/library/ms345177.aspx

|||

Deepak,

This link says...

"To delete the first-level subfolders, you must explicitly elect to do this by checking the Include first-level subfolders option in the Maintenance Cleanup Task dialog box."

I am not finding the "Includefirst-level subfolders" option to check.

How to check this option.

Thank you

-Smith

|||

Hi,

What Service Pack are you on? You should be getting that option when you Edit the Maintenance Plab Sub-task "Clean up Maintenance Task"

|||

select @.@.version

Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Thanks,

|||Try to install SQL 2005 SP2 critical update from
http://www.microsoft.com/downloads/details.aspx?FamilyId=e2c358a1-ecc4-4c49-8f65-daa6b7800eec&displaylang=en

refer the below link,
http://support.microsoft.com/kb/933508 as there were many problems relating to maintenance plan which were fixed with critical update ! ! !
|||

Thank you for your suggestions in resolving this issue.

Since it is not a critical issue affecting the production I will wait for the SP3 :-)

Infact when I installed the SP2 I did download the latest copy available.

Thank you,

|||Well i don't think SP3 would be released for sql 2005 as sql 2008 is going to be released in Feb 2008 Smile

Maintenance Cleanup Task……

SQL Server 2005 Standard Edition

Windows Server 2003.

I have created an ‘Backup Database Task’ to create the database backups and checked the option “Create a subdirectory for each database”.

When I add the “Maintenance Cleanup Task” I am not getting the similar option to clean the backup files in the subdirectory.

Any suggestion on how to solve this?

I can always uncheck the “Create a subdirectory for each database” option to create the backup files in one location.

Thank you,

Smith

Smith,
Once you create a Sub directory the backup files will be placed there...now in the clean up task there is an option called "Search folder and delete files based on an extension" you need to specify the sub directory folder in the above mentioned option........the clean up task will delete it and also you need to psecify the extension as "bak" to delete backup files.........refer the below link,
http://www.sql-server-performance.com/articles/dba/creating_backup_jobs_p2.aspx


|||

This article could be helpful for you

http://msdn2.microsoft.com/en-us/library/ms345177.aspx

|||

Deepak,

This link says...

"To delete the first-level subfolders, you must explicitly elect to do this by checking the Include first-level subfolders option in the Maintenance Cleanup Task dialog box."

I am not finding the "Includefirst-level subfolders" option to check.

How to check this option.

Thank you

-Smith

|||

Hi,

What Service Pack are you on? You should be getting that option when you Edit the Maintenance Plab Sub-task "Clean up Maintenance Task"

|||

select @.@.version

Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Thanks,

|||Try to install SQL 2005 SP2 critical update from
http://www.microsoft.com/downloads/details.aspx?FamilyId=e2c358a1-ecc4-4c49-8f65-daa6b7800eec&displaylang=en

refer the below link,
http://support.microsoft.com/kb/933508 as there were many problems relating to maintenance plan which were fixed with critical update ! ! !
|||

Thank you for your suggestions in resolving this issue.

Since it is not a critical issue affecting the production I will wait for the SP3 :-)

Infact when I installed the SP2 I did download the latest copy available.

Thank you,

|||Well i don't think SP3 would be released for sql 2005 as sql 2008 is going to be released in Feb 2008 Smile

Maintenance Cleanup Task……

SQL Server 2005 Standard Edition

Windows Server 2003.

I have created an ‘Backup Database Task’ to create the database backups and checked the option “Create a subdirectory for each database”.

When I add the “Maintenance Cleanup Task” I am not getting the similar option to clean the backup files in the subdirectory.

Any suggestion on how to solve this?

I can always uncheck the “Create a subdirectory for each database” option to create the backup files in one location.

Thank you,

Smith

Smith,
Once you create a Sub directory the backup files will be placed there...now in the clean up task there is an option called "Search folder and delete files based on an extension" you need to specify the sub directory folder in the above mentioned option........the clean up task will delete it and also you need to psecify the extension as "bak" to delete backup files.........refer the below link,
http://www.sql-server-performance.com/articles/dba/creating_backup_jobs_p2.aspx


|||

This article could be helpful for you

http://msdn2.microsoft.com/en-us/library/ms345177.aspx

|||

Deepak,

This link says...

"To delete the first-level subfolders, you must explicitly elect to do this by checking the Include first-level subfolders option in the Maintenance Cleanup Task dialog box."

I am not finding the "Includefirst-level subfolders" option to check.

How to check this option.

Thank you

-Smith

|||

Hi,

What Service Pack are you on? You should be getting that option when you Edit the Maintenance Plab Sub-task "Clean up Maintenance Task"

|||

select @.@.version

Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Thanks,

|||Try to install SQL 2005 SP2 critical update from
http://www.microsoft.com/downloads/details.aspx?FamilyId=e2c358a1-ecc4-4c49-8f65-daa6b7800eec&displaylang=en

refer the below link,
http://support.microsoft.com/kb/933508 as there were many problems relating to maintenance plan which were fixed with critical update ! ! !
|||

Thank you for your suggestions in resolving this issue.

Since it is not a critical issue affecting the production I will wait for the SP3 :-)

Infact when I installed the SP2 I did download the latest copy available.

Thank you,

|||Well i don't think SP3 would be released for sql 2005 as sql 2008 is going to be released in Feb 2008 Smile
sql

Maintenance Cleanup Task……

SQL Server 2005 Standard Edition

Windows Server 2003.

I have created an ‘Backup Database Task’ to create the database backups and checked the option “Create a subdirectory for each database”.

When I add the “Maintenance Cleanup Task” I am not getting the similar option to clean the backup files in the subdirectory.

Any suggestion on how to solve this?

I can always uncheck the “Create a subdirectory for each database” option to create the backup files in one location.

Thank you,

Smith

Smith,
Once you create a Sub directory the backup files will be placed there...now in the clean up task there is an option called "Search folder and delete files based on an extension" you need to specify the sub directory folder in the above mentioned option........the clean up task will delete it and also you need to psecify the extension as "bak" to delete backup files.........refer the below link,
http://www.sql-server-performance.com/articles/dba/creating_backup_jobs_p2.aspx


|||

This article could be helpful for you

http://msdn2.microsoft.com/en-us/library/ms345177.aspx

|||

Deepak,

This link says...

"To delete the first-level subfolders, you must explicitly elect to do this by checking the Include first-level subfolders option in the Maintenance Cleanup Task dialog box."

I am not finding the "Includefirst-level subfolders" option to check.

How to check this option.

Thank you

-Smith

|||

Hi,

What Service Pack are you on? You should be getting that option when you Edit the Maintenance Plab Sub-task "Clean up Maintenance Task"

|||

select @.@.version

Microsoft SQL Server 2005 - 9.00.3042.00 (Intel X86) Feb 9 2007 22:47:07 Copyright (c) 1988-2005 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

Thanks,

|||Try to install SQL 2005 SP2 critical update from
http://www.microsoft.com/downloads/details.aspx?FamilyId=e2c358a1-ecc4-4c49-8f65-daa6b7800eec&displaylang=en

refer the below link,
http://support.microsoft.com/kb/933508 as there were many problems relating to maintenance plan which were fixed with critical update ! ! !
|||

Thank you for your suggestions in resolving this issue.

Since it is not a critical issue affecting the production I will wait for the SP3 :-)

Infact when I installed the SP2 I did download the latest copy available.

Thank you,

|||Well i don't think SP3 would be released for sql 2005 as sql 2008 is going to be released in Feb 2008 Smile

Maintenance Cleanup task not functioning properly?

Using SQL Server 2005 Management Studio and backing up databases. When I add the task Maintenance Cleanup to remove database backups older then 1 day the task fails?
What part of this TSQL code does SQL Server 2005 Management Studio not understand?

EXECUTE master.dbo.xp_delete_file 0,N'\\pdxsql03\SQL Backup\POSSQL_Server',N'.bak',N'05/15/2006 08:09:37'

The database file backup extension is .bak and the file is older than one day which was specified.
It is just not deleting the file.
We have deleted the maintenance task and recreated it with no effect and this has been happening for over a month.
Any help here would be greatly appreciated.

Carl
carlt@.gicw.org

I've been having the same problem for over three months now and keep checking back here to see if there's been a fix....

|||

http://blogs.msdn.com/sanchan/archive/2006/04/23/581640.aspx

This is addressed in SP1. Please look at the above blog for more information.

Gops Dwarak

|||

The trick is to replace .bak with *.*

It definitely works. :-)

|||

I tried to replace the extension "bak" with "*.*", "*" and ".*" I know this looks like the meeting of the disabled Smilie group, but you know what I mean. It definitely _DOESN′T_ delete any backups. However, when I execute the t-sql created by the maintenance Cleanup Task, it deletes the files.

Any suggestions?

|||Not working for me either. SP1 applied and all. Subdirectories for backups. .. trying to delete archived backups, in the form Filename.bak.7z. No worky worky!
Please advise? (Read: How hard is it to implement a functioning XSP?!)|||

My solution was to take the T-SQL created by the cleanup task and modifying it slightly:

declare @.dt datetime

select @.dt=getdate()-5
EXECUTE master.dbo.xp_delete_file 0,N'E:\Backups',N'BAK',@.dt,1

The variable is used to check the age of the backup-files. In this case, all backups older than 5 days are deleted. The last Number (=1) gives the number of subdirectories to be searched in for .bak-files. AFAIK a maximum of 5 subdirs is supported.

Then you can take it and put it into an "execute SQL"-Task, take the package and schedule it or directly schedule it in the Job Scheduler of Management Studio as SQL-Statement

|||

The workaround above may or may not work, depending on what the problem is.

To get to the bottom of the problem - what is the exact error that you are getting? We can then search if this is a known problem. There were number of issues with Cleanup task. A few were fixed in SP1, like Gops has mentioned, more were fixed in SP2 which is in the CTP release right now. If you can, please install SQL Server 2005 SP2 CTP December from here: http://www.microsoft.com/sql/ctp.mspx and let us know if the problem sitll exists.

Regards,

Maciek Sarnowicz

|||

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

Thanks,

-lance

|||

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

|||

-lance wrote:

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

You are running SQL Server 2005 Service Pack 2 (9.00.3054.00).

You are running Windows Server 2003 Service Pack 1.

Hope this clears up your confusion.

Paul A. Mestemaker II

Program Manager

Microsoft SQL Server Manageability

http://blogs.msdn.com/sqlrem/

|||

I was also having a similar issue. First the cleanup task would just not delete any files no matter where I pointed it to. I originally had put “.trn” in the file extension box. I then removed the . and everything deleted correctly. The problem we then ran into was that it would only delete from the top level folder that we pointed to. In another blog I read that I must check the Include first-level subfolders box to delete from these sub folders. The problem is that this checkbox is nowhere to be found on the maintenance cleanup task dialog box. We do have service pack 2 loaded and most of the updates but….?

I finally just got the T-SQL statement and created my own job.

This is the original statement:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18'

Is simply added a 1 to the end of the statement and made it:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18',1

This job runs great and deletes all the files on level below the top level folder. I did try adding a 2 to see if it would let me delete further levels but it errors out. Hope this helps somebody!

Maintenance Cleanup task not functioning properly?

Using SQL Server 2005 Management Studio and backing up databases. When I add the task Maintenance Cleanup to remove database backups older then 1 day the task fails?
What part of this TSQL code does SQL Server 2005 Management Studio not understand?

EXECUTE master.dbo.xp_delete_file 0,N'\\pdxsql03\SQL Backup\POSSQL_Server',N'.bak',N'05/15/2006 08:09:37'

The database file backup extension is .bak and the file is older than one day which was specified.
It is just not deleting the file.
We have deleted the maintenance task and recreated it with no effect and this has been happening for over a month.
Any help here would be greatly appreciated.

Carl
carlt@.gicw.org

I've been having the same problem for over three months now and keep checking back here to see if there's been a fix....

|||

http://blogs.msdn.com/sanchan/archive/2006/04/23/581640.aspx

This is addressed in SP1. Please look at the above blog for more information.

Gops Dwarak

|||

The trick is to replace .bak with *.*

It definitely works. :-)

|||

I tried to replace the extension "bak" with "*.*", "*" and ".*" I know this looks like the meeting of the disabled Smilie group, but you know what I mean. It definitely _DOESN′T_ delete any backups. However, when I execute the t-sql created by the maintenance Cleanup Task, it deletes the files.

Any suggestions?

|||Not working for me either. SP1 applied and all. Subdirectories for backups. .. trying to delete archived backups, in the form Filename.bak.7z. No worky worky!
Please advise? (Read: How hard is it to implement a functioning XSP?!)
|||

My solution was to take the T-SQL created by the cleanup task and modifying it slightly:

declare @.dt datetime

select @.dt=getdate()-5
EXECUTE master.dbo.xp_delete_file 0,N'E:\Backups',N'BAK',@.dt,1

The variable is used to check the age of the backup-files. In this case, all backups older than 5 days are deleted. The last Number (=1) gives the number of subdirectories to be searched in for .bak-files. AFAIK a maximum of 5 subdirs is supported.

Then you can take it and put it into an "execute SQL"-Task, take the package and schedule it or directly schedule it in the Job Scheduler of Management Studio as SQL-Statement

|||

The workaround above may or may not work, depending on what the problem is.

To get to the bottom of the problem - what is the exact error that you are getting? We can then search if this is a known problem. There were number of issues with Cleanup task. A few were fixed in SP1, like Gops has mentioned, more were fixed in SP2 which is in the CTP release right now. If you can, please install SQL Server 2005 SP2 CTP December from here: http://www.microsoft.com/sql/ctp.mspx and let us know if the problem sitll exists.

Regards,

Maciek Sarnowicz

|||

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

Thanks,

-lance

|||

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

|||

-lance wrote:

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

You are running SQL Server 2005 Service Pack 2 (9.00.3054.00).

You are running Windows Server 2003 Service Pack 1.

Hope this clears up your confusion.

Paul A. Mestemaker II

Program Manager

Microsoft SQL Server Manageability

http://blogs.msdn.com/sqlrem/

|||

I was also having a similar issue. First the cleanup task would just not delete any files no matter where I pointed it to. I originally had put “.trn” in the file extension box. I then removed the . and everything deleted correctly. The problem we then ran into was that it would only delete from the top level folder that we pointed to. In another blog I read that I must check the Include first-level subfolders box to delete from these sub folders. The problem is that this checkbox is nowhere to be found on the maintenance cleanup task dialog box. We do have service pack 2 loaded and most of the updates but….?

I finally just got the T-SQL statement and created my own job.

This is the original statement:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18'

Is simply added a 1 to the end of the statement and made it:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18',1

This job runs great and deletes all the files on level below the top level folder. I did try adding a 2 to see if it would let me delete further levels but it errors out. Hope this helps somebody!

Maintenance Cleanup task not functioning properly?

Using SQL Server 2005 Management Studio and backing up databases. When I add the task Maintenance Cleanup to remove database backups older then 1 day the task fails?
What part of this TSQL code does SQL Server 2005 Management Studio not understand?

EXECUTE master.dbo.xp_delete_file 0,N'\\pdxsql03\SQL Backup\POSSQL_Server',N'.bak',N'05/15/2006 08:09:37'

The database file backup extension is .bak and the file is older than one day which was specified.
It is just not deleting the file.
We have deleted the maintenance task and recreated it with no effect and this has been happening for over a month.
Any help here would be greatly appreciated.

Carl
carlt@.gicw.org

I've been having the same problem for over three months now and keep checking back here to see if there's been a fix....

|||

http://blogs.msdn.com/sanchan/archive/2006/04/23/581640.aspx

This is addressed in SP1. Please look at the above blog for more information.

Gops Dwarak

|||

The trick is to replace .bak with *.*

It definitely works. :-)

|||

I tried to replace the extension "bak" with "*.*", "*" and ".*" I know this looks like the meeting of the disabled Smilie group, but you know what I mean. It definitely _DOESN′T_ delete any backups. However, when I execute the t-sql created by the maintenance Cleanup Task, it deletes the files.

Any suggestions?

|||Not working for me either. SP1 applied and all. Subdirectories for backups. .. trying to delete archived backups, in the form Filename.bak.7z. No worky worky!
Please advise? (Read: How hard is it to implement a functioning XSP?!)|||

My solution was to take the T-SQL created by the cleanup task and modifying it slightly:

declare @.dt datetime

select @.dt=getdate()-5
EXECUTE master.dbo.xp_delete_file 0,N'E:\Backups',N'BAK',@.dt,1

The variable is used to check the age of the backup-files. In this case, all backups older than 5 days are deleted. The last Number (=1) gives the number of subdirectories to be searched in for .bak-files. AFAIK a maximum of 5 subdirs is supported.

Then you can take it and put it into an "execute SQL"-Task, take the package and schedule it or directly schedule it in the Job Scheduler of Management Studio as SQL-Statement

|||

The workaround above may or may not work, depending on what the problem is.

To get to the bottom of the problem - what is the exact error that you are getting? We can then search if this is a known problem. There were number of issues with Cleanup task. A few were fixed in SP1, like Gops has mentioned, more were fixed in SP2 which is in the CTP release right now. If you can, please install SQL Server 2005 SP2 CTP December from here: http://www.microsoft.com/sql/ctp.mspx and let us know if the problem sitll exists.

Regards,

Maciek Sarnowicz

|||

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

Thanks,

-lance

|||

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

|||

-lance wrote:

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

You are running SQL Server 2005 Service Pack 2 (9.00.3054.00).

You are running Windows Server 2003 Service Pack 1.

Hope this clears up your confusion.

Paul A. Mestemaker II

Program Manager

Microsoft SQL Server Manageability

http://blogs.msdn.com/sqlrem/

|||

I was also having a similar issue. First the cleanup task would just not delete any files no matter where I pointed it to. I originally had put “.trn” in the file extension box. I then removed the . and everything deleted correctly. The problem we then ran into was that it would only delete from the top level folder that we pointed to. In another blog I read that I must check the Include first-level subfolders box to delete from these sub folders. The problem is that this checkbox is nowhere to be found on the maintenance cleanup task dialog box. We do have service pack 2 loaded and most of the updates but….?

I finally just got the T-SQL statement and created my own job.

This is the original statement:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18'

Is simply added a 1 to the end of the statement and made it:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18',1

This job runs great and deletes all the files on level below the top level folder. I did try adding a 2 to see if it would let me delete further levels but it errors out. Hope this helps somebody!

Maintenance Cleanup task not functioning properly?

Using SQL Server 2005 Management Studio and backing up databases. When I add the task Maintenance Cleanup to remove database backups older then 1 day the task fails?
What part of this TSQL code does SQL Server 2005 Management Studio not understand?

EXECUTE master.dbo.xp_delete_file 0,N'\\pdxsql03\SQL Backup\POSSQL_Server',N'.bak',N'05/15/2006 08:09:37'

The database file backup extension is .bak and the file is older than one day which was specified.
It is just not deleting the file.
We have deleted the maintenance task and recreated it with no effect and this has been happening for over a month.
Any help here would be greatly appreciated.

Carl
carlt@.gicw.org

I've been having the same problem for over three months now and keep checking back here to see if there's been a fix....

|||

http://blogs.msdn.com/sanchan/archive/2006/04/23/581640.aspx

This is addressed in SP1. Please look at the above blog for more information.

Gops Dwarak

|||

The trick is to replace .bak with *.*

It definitely works. :-)

|||

I tried to replace the extension "bak" with "*.*", "*" and ".*" I know this looks like the meeting of the disabled Smilie group, but you know what I mean. It definitely _DOESN′T_ delete any backups. However, when I execute the t-sql created by the maintenance Cleanup Task, it deletes the files.

Any suggestions?

|||Not working for me either. SP1 applied and all. Subdirectories for backups. .. trying to delete archived backups, in the form Filename.bak.7z. No worky worky!
Please advise? (Read: How hard is it to implement a functioning XSP?!)
|||

My solution was to take the T-SQL created by the cleanup task and modifying it slightly:

declare @.dt datetime

select @.dt=getdate()-5
EXECUTE master.dbo.xp_delete_file 0,N'E:\Backups',N'BAK',@.dt,1

The variable is used to check the age of the backup-files. In this case, all backups older than 5 days are deleted. The last Number (=1) gives the number of subdirectories to be searched in for .bak-files. AFAIK a maximum of 5 subdirs is supported.

Then you can take it and put it into an "execute SQL"-Task, take the package and schedule it or directly schedule it in the Job Scheduler of Management Studio as SQL-Statement

|||

The workaround above may or may not work, depending on what the problem is.

To get to the bottom of the problem - what is the exact error that you are getting? We can then search if this is a known problem. There were number of issues with Cleanup task. A few were fixed in SP1, like Gops has mentioned, more were fixed in SP2 which is in the CTP release right now. If you can, please install SQL Server 2005 SP2 CTP December from here: http://www.microsoft.com/sql/ctp.mspx and let us know if the problem sitll exists.

Regards,

Maciek Sarnowicz

|||

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

Thanks,

-lance

|||

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

|||

-lance wrote:

I tried to load up SP2 (thought I had already) to test this with it...

well, I show I am running SP1 and though I tried to update I could not get everything to update. Either it had a newer version (according to the updater) or I was told that components must be updated together.

SELECT SERVERPROPERTY('ProductVersion') = 9.00.3054.00

select @.@.version = Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) Mar 23 2007 16:28:52 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

So now the question is how do I even get it to upgrade to SP2?

You are running SQL Server 2005 Service Pack 2 (9.00.3054.00).

You are running Windows Server 2003 Service Pack 1.

Hope this clears up your confusion.

Paul A. Mestemaker II

Program Manager

Microsoft SQL Server Manageability

http://blogs.msdn.com/sqlrem/

|||

I was also having a similar issue. First the cleanup task would just not delete any files no matter where I pointed it to. I originally had put “.trn” in the file extension box. I then removed the . and everything deleted correctly. The problem we then ran into was that it would only delete from the top level folder that we pointed to. In another blog I read that I must check the Include first-level subfolders box to delete from these sub folders. The problem is that this checkbox is nowhere to be found on the maintenance cleanup task dialog box. We do have service pack 2 loaded and most of the updates but….?

I finally just got the T-SQL statement and created my own job.

This is the original statement:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18'

Is simply added a 1 to the end of the statement and made it:

EXECUTE master.dbo.xp_delete_file 0,N'D:\MSSQL\backup',N'trn',N'08/25/2007 13:49:18',1

This job runs great and deletes all the files on level below the top level folder. I did try adding a 2 to see if it would let me delete further levels but it errors out. Hope this helps somebody!

sql