By: Ashish Kumar Mehta | Comments (2) | Related: > Policy Based Management
Problem
There is an easy way to quickly enable transactional log file growth for all the databases in SQL Server 2008. In this tip we cover the step by step process for setting up a policy to enable transactional log file growth for all the databases using Policy Based Management.
Solution
Database Administrators can use Policy Based Management (PBM) to quickly enable transactional log file growth for all databases. You can follow the below steps to create and evaluate the policy. It's a best practice to make sure the DBA has enabled transaction log file growth to a satisfactory percentage to avoid the transaction log file from running out of space. If you are not familiar with Policy Based Management (PBM) then you can start with the following tip: Using Policy-Based Management in SQL Server 2008.
Following are the steps to create the policy.
1. Connect to a SQL Server 2008 Instance using SQL Server 2008 Management Studio and expand Management Node -> Policy Management Node and then right click Policies and select New Policy... as shown in the snippet below.
2. In Create New Policy window provide the name of the policy as Enable Transactional Log File Growth for all the Databases. In Check Condition you need to click the New Condition.... option to open up Create New Condition window.
3. In Create New Condition window you need to provide the name of the condition as "Transactional Log File Growth for all the Databases" and then select the Facet "Log File". Under Expression select Field value as @GrowthType and choose Operator value as ' = ' and then value as Percent. Next add one more clause by selecting @Growth in Field and choose Operator value as ' = ' and then value as 10 as shown in the below snippet. Click OK to save the condition and to return to the parent Create New Policy window.
- Use @GrowthType to get or set the growth type for the data file in kilobytes or percent.
- Use @Growth to get or set the growth increment for the data file in kilobytes or percent.
4. In Create New Policy, by default "Every Database" option under "Against targets" will be checked as shown in the below snippet. Click OK to create the policy.
5. Once your policy is created, the next step will be to evaluate the policy. Right click the policy and select the Evaluate option from the drop down list as shown in the below snippet.
6. The below snippet shows the result set returned by the policy. (Click on the image to see a bigger image) We can see that for most of the databases the policy has failed.
7. When you click a "View..." link under Details, you will be able to see detailed results for the AdventureWorks database. The expected value for @Growth is 10 and @GrowthType was Percent. However, the actual value configured is None as Growth Type for the transaction log file of AdventureWorks database. Next step will be to apply the policy, so that all the transaction log files of all the databases are set to grow at 10 percent.
8. To enable the data file growth for all the databases select the target databases and click the Apply button. This action will pop up a Policy Evaluation Warning as shown in the below snippet. Click Yes to apply the policy.
9. Once the policy suggestion is applied you will be able to see the below screen that shows all databases are in compliance now. (Click on the image to see a bigger image) Click Close to exit.
Next Steps
- This is just an example of how you can use PBM to set the autogrow values. In this example we used 10%, but this does not mean that you should set a value of 10% across the board for all of your transactional log files.
- Review Using Policy-Based Management in SQL Server 2008
- Read more tips on Policy Based Management
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips