What is your guess? The install path? The default database location? The default fill factor. I would say a 1MB default autogrowth if you create a database with the GUI. I don’t know how many times I have seen 20, 50, 100GB with 1MB autogrowth when I know they started out at the other bad default of 2MB initial size. This can cause hundreds or thousands of file fragments.
Linchi has already shown that file fragmentation does matter too much on enterprise SAN’s but a lot of installations do not have that luxury.
Tonight, on this festive Friday night I decided to party so I have created a policy that you can run against your servers to see if they are in violation of this bad practice.
Here is the code:
DECLARE @object_set_id INTEXEC msdb.dbo.sp_syspolicy_add_object_set @object_set_name=N'AutoGrow Setting_ObjectSet_1', @facet=N'DataFile', @object_set_id=@object_set_id OUTPUTSELECT @object_set_idDECLARE @target_set_id INTEXEC msdb.dbo.sp_syspolicy_add_target_set @object_set_name=N'AutoGrow Setting_ObjectSet_1', @type_skeleton=N'Server/Database/FileGroup/File', @type=N'FILE', @enabled=True, @target_set_id=@target_set_id OUTPUTSELECT @target_set_idEXEC msdb.dbo.sp_syspolicy_add_target_set_level @target_set_id=@target_set_id, @type_skeleton=N'Server/Database/FileGroup/File', @level_name=N'File', @condition_name=N'', @target_set_level_id=0EXEC msdb.dbo.sp_syspolicy_add_target_set_level @target_set_id=@target_set_id, @type_skeleton=N'Server/DATABASE/FileGroup', @level_name=N'FileGroup', @condition_name=N'', @target_set_level_id=0EXEC msdb.dbo.sp_syspolicy_add_target_set_level @target_set_id=@target_set_id, @type_skeleton=N'Server/DATABASE', @level_name=N'DATABASE', @condition_name=N'', @target_set_level_id=0GODeclare @policy_id intEXEC msdb.dbo.sp_syspolicy_add_policy @name=N'AutoGrow Setting', @condition_name=N'dbfile', @policy_category=N'', @description=N'', @help_text=N'', @help_link=N'', @schedule_uid=N'00000000-0000-0000-0000-000000000000', @execution_mode=0, @is_enabled=False, @policy_id=@policy_id OUTPUT, @root_condition_name=N'', @object_set=N'AutoGrow Setting_ObjectSet_1'Select @policy_idGO
Edit: As Chris pointed out, the condition is needed as well. Here it is:
DECLARE @condition_id INT EXEC msdb.dbo.sp_syspolicy_add_condition @name=N'dbfile' , @description=N'' , @facet=N'DataFile' , @expression=N'<Operator> <TypeClass>Bool</TypeClass> <OpType>GT</OpType> <COUNT>2</COUNT> <Attribute> <TypeClass>Numeric</TypeClass> <Name>Growth</Name> </Attribute> <Constant> <TypeClass>Numeric</TypeClass> <ObjType>System.DOUBLE</ObjType> <Value>1024</Value> </Constant> </Operator>', @is_name_condition=0, @obj_name=N'', @condition_id=@condition_id OUTPUT Select @condition_id GO '
posted @ Saturday, January 17, 2009 2:10 AM by scott herbert
posted @ Saturday, January 17, 2009 4:25 AM by Chris Leonard
posted @ Saturday, January 17, 2009 4:55 AM by Mike Walsh
posted @ Saturday, January 17, 2009 8:06 AM by K. Brian Kelley
posted @ Saturday, January 17, 2009 9:00 AM by JasonMassie
posted @ Saturday, January 17, 2009 9:45 AM by JasonMassie
posted @ Monday, January 19, 2009 12:04 PM by Kevin3NF
posted @ Wednesday, January 21, 2009 2:04 AM by Ludovico Caldara
posted @ Friday, January 23, 2009 6:36 AM
Name (required)
Email (required)
Website
Notify me of followup comments via e-mail