Index rebuilding increasing log size

Posted on 2007-04-02
Last Modified: 2012-05-05
Very rarely  do much SQL Server 2k maintenance and am feeling rather dense about this ...

Have set up a weekly job to rebuild the indices in several databases (OK indexes if you'd rather!), but the log size grows rapidly during this rebuild.  Questions are:
1. Does this matter (it's not growing to the extent that there's any concern over HDD space)?
2. If it matters can I just schedule a database shrink (or should that be a log shrink?) immediately after the rebuild?
Question by:looper8
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 11

Expert Comment

by:Ved Prakash Agrawal
ID: 18835020
1. Does this matter (it's not growing to the extent that there's any concern over HDD space)?

Rebuild process to fill log file means  , you should concern about HDD space.

2. If it matters can I just schedule a database shrink (or should that be a log shrink?) immediately after the rebuild?

you should shrnik the log file because it will be the fast rather than shrinking the complete database.

Expert Comment

ID: 18835076
I would suggest using indexdefrag for it will do things online, or if you are doing maintenance out of work hours use dbreindex.
Backup your transaction log before the job start and truncate Log after each index rebuild.
This way you  will be having smallest transaction log possible used by your database. I wont suggest shinking the transaction log however, as it will grow again as and when sql server required it again.
Please let me know if you need any more assistance.


Author Comment

ID: 18880785

I can see why shrinking the log isn't worth doing, but confused about truncation.  Looking at Books Online I come up with this about Log truncation:

"Important  The Truncate method allows reuse of the space allocated to the operating system file(s) maintaining a transaction log. Log truncation is part of normal transaction log backup. If log backup is part of a database backup strategy, the Truncate method should never be called."

Seeing as I've got log backups going every hour during office hours is it necessary to do this?  In other words do I just leave the log as it is after the index rebuild (Sunday afternoon) and it will then get sorted with a log backup Monday morning?


Accepted Solution

abhijit_k earned 500 total points
ID: 19418001
If u dont wish to Generate Trans Log while Reindexing the Put the Database into Bulk_logged before doing Reindexing and change the status once completed

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question