Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Doubt about Shrinking process , Rebiulding index and fragmenatation Expand / Collapse
Author
Message
Posted Tuesday, March 19, 2013 1:25 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, June 26, 2014 1:18 AM
Points: 90, Visits: 135
hi i know that shrinking data base increase fragmentation , so logically shrinking data files would two result in fragmentation but does shrinking log file increases fragmentation. i hope answer is NO.

Second question is rebuilding an index reduces fragmentation but it increase size of database.I have seen increase in size of log file but does data file size to increases . Again i hope ans is No.

Plz correct me on this
Post #1432873
Posted Tuesday, March 19, 2013 1:48 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Today @ 6:40 PM
Points: 399, Visits: 2,458
anoop.mig29 (3/19/2013)
hi i know that shrinking data base increase fragmentation , so logically shrinking data files would two result in fragmentation but does shrinking log file increases fragmentation. i hope answer is NO.

Shrinking log file does not create any fragmentation.

Second question is rebuilding an index reduces fragmentation but it increase size of database.I have seen increase in size of log file but does data file size to increases . Again i hope ans is No.

Plz correct me on this


rebuilding/re-organizing index is a fully logged operation, therefore your log will be growing during the time of rebuild/re-organize.

SueTons.


Regards,
SQLisAwe5oMe.
Post #1432883
Posted Tuesday, March 19, 2013 1:48 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, August 11, 2014 12:41 PM
Points: 541, Visits: 1,045
Why are you shrinking the log file? If your backup method is Full then the logfile will truncate on backup.
Post #1432884
Posted Tuesday, March 19, 2013 2:06 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:09 PM
Points: 23,218, Visits: 31,905
Erin Ramsay (3/19/2013)
Why are you shrinking the log file? If your backup method is Full then the logfile will truncate on backup.


Full and Differential backups do not truncate (mark VLFs as reusable) the t-log. Only transaction log backups accomplish this when a database is using the BULK_LOGGED or FULL recovery models.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1432894
Posted Tuesday, March 19, 2013 2:13 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:51 PM
Points: 42,756, Visits: 35,850
anoop.mig29 (3/19/2013)
hi i know that shrinking data base increase fragmentation , so logically shrinking data files would two result in fragmentation but does shrinking log file increases fragmentation. i hope answer is NO.


Index fragmentation, no. However, lots of shrink/grow/shrink/grow will cause log fragmentation. You shouldn't be regularly shrinking your logs. Once off, yes. Regular, no.
Please read through this - Managing Transaction Logs

Second question is rebuilding an index reduces fragmentation but it increase size of database.I have seen increase in size of log file but does data file size to increases .


Yes it can. If there's not enough space in the database for the new index, the data file will grow.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1432895
Posted Tuesday, March 19, 2013 3:06 PM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Monday, August 11, 2014 12:41 PM
Points: 541, Visits: 1,045
Lynn Pettis (3/19/2013)
Erin Ramsay (3/19/2013)
Why are you shrinking the log file? If your backup method is Full then the logfile will truncate on backup.


Full and Differential backups do not truncate (mark VLFs as reusable) the t-log. Only transaction log backups accomplish this when a database is using the BULK_LOGGED or FULL recovery models.


Learn something new every day...thank you, sir!
Post #1432908
Posted Wednesday, March 20, 2013 9:23 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, June 26, 2014 1:18 AM
Points: 90, Visits: 135
GilaMonster (3/19/2013)
anoop.mig29 (3/19/2013)
hi i know that shrinking data base increase fragmentation , so logically shrinking data files would two result in fragmentation but does shrinking log file increases fragmentation. i hope answer is NO.


Index fragmentation, no. However, lots of shrink/grow/shrink/grow will cause log fragmentation. You shouldn't be regularly shrinking your logs. Once off, yes. Regular, no.
Please read through this - Managing Transaction Logs

Second question is rebuilding an index reduces fragmentation but it increase size of database.I have seen increase in size of log file but does data file size to increases .


Yes it can. If there's not enough space in the database for the new index, the data file will grow.


Hi Gail thanks for reply but whats log fragmentation is it hramfull??
Post #1433569
Posted Thursday, March 21, 2013 3:17 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 2:51 PM
Points: 42,756, Visits: 35,850
Log fragmentation is described in the article I referred you to.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1433650
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse