Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Index rebuilding increasing log size

Posted on 2007-04-02
4
Medium Priority
?
1,167 Views
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?
0
Comment
Question by:looper8
4 Comments
 
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.
0
 
LVL 2

Expert Comment

by:rattu976
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.

Regards,
Rehan
0
 
LVL 1

Author Comment

by:looper8
ID: 18880785
Thanks.  

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?

0
 
LVL 3

Accepted Solution

by:
abhijit_k earned 1500 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
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

926 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