Home All Groups Group Topic Archive Search About

Sql transaction log size because of reindexing



Author
22 Jun 2009 3:33 PM
db
SQL server 2000 SP4

I have a database (size 13 GB) in full recovery mode. We take transaction
log backups once everyday in late evening. Everynight I update the statistics
and only on the weekend I do a complete reindexing.

On the weekend after reindexing the database log size becomes about 10 GB.
If I do not shrink it, It usually remains at that level for weeks. If space
is not a issue is that ok?

If database log size should be reduced after every reindexing on the
weekend.. what is the best way of doing it? 

dbdba
--
ontario, canada

Author
22 Jun 2009 4:07 PM
Aaron Bertrand [SQL Server MVP]
If you are going to bump it up to 10GB every weekend, what is the point of
shrinking it in the meantime?




On 6/22/09 11:33 AM, in article
695412A5-A414-44A5-81C1-18B5DB731***@microsoft.com, "db"
<d*@discussions.microsoft.com> wrote:

Show quoteHide quote
> SQL server 2000 SP4
>
> I have a database (size 13 GB) in full recovery mode. We take transaction
> log backups once everyday in late evening. Everynight I update the statistics
> and only on the weekend I do a complete reindexing.
>
> On the weekend after reindexing the database log size becomes about 10 GB.
> If I do not shrink it, It usually remains at that level for weeks. If space
> is not a issue is that ok?
>
> If database log size should be reduced after every reindexing on the
> weekend.. what is the best way of doing it?
>
> dbdba
Are all your drivers up to date? click for free checkup

Author
22 Jun 2009 4:13 PM
Tibor Karaszi
I agree: http://www.karaszi.com/SQLServer/info_dont_shrink.asp

Show quoteHide quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in
message news:C6652486.1D922%ten.xoc@dnartreb.noraa...
> If you are going to bump it up to 10GB every weekend, what is the
> point of
> shrinking it in the meantime?
>
>
>
>
> On 6/22/09 11:33 AM, in article
> 695412A5-A414-44A5-81C1-18B5DB731***@microsoft.com, "db"
> <d*@discussions.microsoft.com> wrote:
>
>> SQL server 2000 SP4
>>
>> I have a database (size 13 GB) in full recovery mode. We take
>> transaction
>> log backups once everyday in late evening. Everynight I update the
>> statistics
>> and only on the weekend I do a complete reindexing.
>>
>> On the weekend after reindexing the database log size becomes about
>> 10 GB.
>> If I do not shrink it, It usually remains at that level for weeks.
>> If space
>> is not a issue is that ok?
>>
>> If database log size should be reduced after every reindexing on
>> the
>> weekend.. what is the best way of doing it?
>>
>> dbdba
>
Author
22 Jun 2009 5:02 PM
Linchi Shea
Perhaps for non-technical reasons such as when a ticket is generated because
a space usage threshold is crossed and action needs to be taken to close the
ticket. I know in that case threshold should be reset to a higher value. I'm
not saying this is good practice. It's just something I've seen in the real
world.

Linchi

Show quoteHide quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> If you are going to bump it up to 10GB every weekend, what is the point of
> shrinking it in the meantime?
>
>
>
>
> On 6/22/09 11:33 AM, in article
> 695412A5-A414-44A5-81C1-18B5DB731***@microsoft.com, "db"
> <d*@discussions.microsoft.com> wrote:
>
> > SQL server 2000 SP4
> >
> > I have a database (size 13 GB) in full recovery mode. We take transaction
> > log backups once everyday in late evening. Everynight I update the statistics
> > and only on the weekend I do a complete reindexing.
> >
> > On the weekend after reindexing the database log size becomes about 10 GB.
> > If I do not shrink it, It usually remains at that level for weeks. If space
> > is not a issue is that ok?
> >
> > If database log size should be reduced after every reindexing on the
> > weekend.. what is the best way of doing it?
> >
> > dbdba
>
>
Author
22 Jun 2009 5:15 PM
Aaron Bertrand [SQL Server MVP]
> Perhaps for non-technical reasons such as when a ticket is generated because
> a space usage threshold is crossed and action needs to be taken to close the
> ticket. I know in that case threshold should be reset to a higher value. I'm
> not saying this is good practice. It's just something I've seen in the real
> world.

Seems silly to me, to keep manually shrinking every week, when you can leave
the file the same size (saving performance as well), and/or change the
threshold (or get a bigger disk), solving the problem for good.
Author
22 Jun 2009 5:36 PM
Linchi Shea
Sure it's silly. Many behvaiors driven by organizational dynamics are silly.

Linchi

Show quoteHide quote
"Aaron Bertrand [SQL Server MVP]" wrote:

> > Perhaps for non-technical reasons such as when a ticket is generated because
> > a space usage threshold is crossed and action needs to be taken to close the
> > ticket. I know in that case threshold should be reset to a higher value. I'm
> > not saying this is good practice. It's just something I've seen in the real
> > world.
>
> Seems silly to me, to keep manually shrinking every week, when you can leave
> the file the same size (saving performance as well), and/or change the
> threshold (or get a bigger disk), solving the problem for good.
>
>
Author
22 Jun 2009 4:18 PM
db
Correction: I am "reorganize data and index pages" not complete reindexing.
--
ontario, canada


Show quoteHide quote
"db" wrote:

> SQL server 2000 SP4
>
> I have a database (size 13 GB) in full recovery mode. We take transaction
> log backups once everyday in late evening. Everynight I update the statistics
> and only on the weekend I do a ("reorganize data and index pages" not reindexing).
>
> On the weekend after reindexing the database log size becomes about 10 GB.
> If I do not shrink it, It usually remains at that level for weeks. If space
> is not a issue is that ok?
>
> If database log size should be reduced after every reindexing on the
> weekend.. what is the best way of doing it? 
>
> dbdba
> --
> ontario, canada
Author
22 Jun 2009 4:23 PM
db
I use option: reorganize data and index pages in maintenance plan
(Optimization)

When should this option be used??
--
ontario, canada


Show quoteHide quote
"db" wrote:

> Correction: I am "reorganize data and index pages" not complete reindexing.
> --
> ontario, canada
>
>
> "db" wrote:
>
> > SQL server 2000 SP4
> >
> > I have a database (size 13 GB) in full recovery mode. We take transaction
> > log backups once everyday in late evening. Everynight I update the statistics
> > and only on the weekend I do a ("reorganize data and index pages" not reindexing).
> >
> > On the weekend after reindexing the database log size becomes about 10 GB.
> > If I do not shrink it, It usually remains at that level for weeks. If space
> > is not a issue is that ok?
> >
> > If database log size should be reduced after every reindexing on the
> > weekend.. what is the best way of doing it? 
> >
> > dbdba
> > --
> > ontario, canada
Author
22 Jun 2009 4:44 PM
Aaron Bertrand [SQL Server MVP]
IMHO: never.  Why don't you grab Ola's or Michelle's scripts?

http://tr.im/p5qu





On 6/22/09 12:23 PM, in article
72DFEBEC-3AE1-42C4-9497-CFC0E02F8***@microsoft.com, "db"
<d*@discussions.microsoft.com> wrote:

Show quoteHide quote
> I use option: reorganize data and index pages in maintenance plan
> (Optimization)
>
> When should this option be used??
Author
22 Jun 2009 4:31 PM
Chris Wood
dbdba,

Using the expand and then shrink log that you are doing I would be wary of
the number of VLF's. Run a DBCC LOGINFO on the database and see how many
VLF's there are? (It would be the number of rows produced by the query). If
you have lots then you would be best to offload the log, shring it, offload
the log again and then expand the log to the maximum size that you need.
This should reduce the number of VLF's. We run regular log backups as well
as have an alert to run the backup if the log gets fuller than 65%. In your
case you might want that lower.

HTH

Chris
Show quoteHide quote
"db" <d*@discussions.microsoft.com> wrote in message
news:695412A5-A414-44A5-81C1-18B5DB731F49@microsoft.com...
> SQL server 2000 SP4
>
> I have a database (size 13 GB) in full recovery mode. We take transaction
> log backups once everyday in late evening. Everynight I update the
> statistics
> and only on the weekend I do a complete reindexing.
>
> On the weekend after reindexing the database log size becomes about 10 GB.
> If I do not shrink it, It usually remains at that level for weeks. If
> space
> is not a issue is that ok?
>
> If database log size should be reduced after every reindexing on the
> weekend.. what is the best way of doing it?
>
> dbdba
> --
> ontario, canada
Author
22 Jun 2009 7:39 PM
db
Hi

I had number of VLF.  switched database recovery mode to simple and try to
shrink the database (Both transaction log by selecting file and also complete
database) through enterprise manager. It showed successful in both cases, but
it did not shrink the tlog file. I have done this before. The overall
database says 50.4 % used or space available almost 50%.
--
ontario, canada


Show quoteHide quote
"Chris Wood" wrote:

> dbdba,
>
> Using the expand and then shrink log that you are doing I would be wary of
> the number of VLF's. Run a DBCC LOGINFO on the database and see how many
> VLF's there are? (It would be the number of rows produced by the query). If
> you have lots then you would be best to offload the log, shring it, offload
> the log again and then expand the log to the maximum size that you need.
> This should reduce the number of VLF's. We run regular log backups as well
> as have an alert to run the backup if the log gets fuller than 65%. In your
> case you might want that lower.
>
> HTH
>
> Chris
> "db" <d*@discussions.microsoft.com> wrote in message
> news:695412A5-A414-44A5-81C1-18B5DB731F49@microsoft.com...
> > SQL server 2000 SP4
> >
> > I have a database (size 13 GB) in full recovery mode. We take transaction
> > log backups once everyday in late evening. Everynight I update the
> > statistics
> > and only on the weekend I do a complete reindexing.
> >
> > On the weekend after reindexing the database log size becomes about 10 GB.
> > If I do not shrink it, It usually remains at that level for weeks. If
> > space
> > is not a issue is that ok?
> >
> > If database log size should be reduced after every reindexing on the
> > weekend.. what is the best way of doing it?
> >
> > dbdba
> > --
> > ontario, canada
>
>
>
Author
22 Jun 2009 7:43 PM
Aaron Bertrand [SQL Server MVP]
> I had number of VLF.  switched database recovery mode to simple and try to
> shrink the database (Both transaction log by selecting file and also complete
> database) through enterprise manager.

Don't use the UI for this.

BACKUP LOG database_name WITH TRUNCATE_ONLY;
GO
DBCC SHRINKFILE(database_name_log, 1);
GO

However please, please, please read these:

http://tr.im/pfk0

http://tr.im/StopShrinking
Author
23 Jun 2009 7:40 AM
Tibor Karaszi
.... especially the pert about the VLF, and if you have active VLFs at
the end.

Show quoteHide quote
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in
message news:C6655721.1D9BC%ten.xoc@dnartreb.noraa...
>> I had number of VLF.  switched database recovery mode to simple and
>> try to
>> shrink the database (Both transaction log by selecting file and
>> also complete
>> database) through enterprise manager.
>
> Don't use the UI for this.
>
> BACKUP LOG database_name WITH TRUNCATE_ONLY;
> GO
> DBCC SHRINKFILE(database_name_log, 1);
> GO
>
> However please, please, please read these:
>
> http://tr.im/pfk0
>
> http://tr.im/StopShrinking
>

Bookmark and Share