Using Database Engine Tuning Advisor – How to Generate Scripts for Recommendations

indexoptimizationsql serversql-server-2005statistics

I have run a server-side profile trace for over an hour to produce a .trc file with all activities in one of my databases.

I have then passed this .trc trace file as a parameter to the database engine tuning advisor.

enter image description here

After running the DTA I get the recommendations:

enter image description here
How do I script out the recommendations?

I am using SQL Server 2005, and I don't seem to find any other way than scripting them individually which is overly time consuming.

Best Answer

Check the View Tuning Output:

  1. If you want to save all of the Transact-SQL scripts that create or drop all database objects in this recommendation into one script file, click Save Recommendations on the Actions menu.

As always review and test the recommendations before blindly applying them to your PROD environment.

I would highly suggest to look at more sane tools like sp_BlitzIndex from folks at BrentOzar.com