News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

Log File Growth and DBCC DBREINDEX

Started by Sunite, October 02, 2007, 07:18:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sunite

Log File Growth and DBCC

DBREINDEX


Q

I have

a 30 gigabyte (GB) database, and I use the Full

recovery model. Whenever I use the database

consistency checker (DBCC) statement DBCC

DBREINDEX to reindex certain large tables

periodically, I change the recovery model to

Bulk_Logged, then return it to Full after the

reindexing is complete. I expected that this

change would help me avoid huge transaction log

file growth, but the subsequent log file backup

is always enormousâ€"around 15 GB. Logically, the

data in the database is the same as before the

reindexing, except that the indexes are

reorganized, so why is the log file so large?

And how can I avoid such significant growth?

/>
 

A



/>Yes, the data is the same, but the indexes are

on completely new pages. When you perform a DBCC

DBREINDEX, SQL Server logs only extent

allocation (eight-page units) instead of each

row or page that has been changed. This type of

logging avoids physical file corruption in the

event of system failure and it minimizes the

impact that more detailed logging would have on

throughput.

When you back up the log,

SQL Server has to back up the pages allocated in

those extents so that they can retain database

backup and log backup consistency. If SQL Server

didn't back up those pages, you

wouldn't be able to switch back to the Full

recovery model until you did a complete database

backup. You have to be able to restore the

database from the last full backup and any

differential backups, as well as any later

transaction log backups.




/>