Steps to Create the SQL Server Trace
- Run SQL Server Management Studio (SSMS)
- Go to menu Tools -> SQL Server Profiler
- App launches, on "Trace Properties" window that opens up:
- Give the Trace Name something useful.
- Use the Template: Tuning
- Save the File. Save to Temp directory, name it something you will remember.
- Set maximum file size: 1000mb
- Enable File Rollover
- Enable trace stop time: Set it at least an hour in advance.
- Click 'Run'.
- After trace is finished, click SQL Server Profiler.
Using the SQL Server Profiler
- Back in SSMS, go to Tools -> Database Engine Tuning Advisor.
- On the application, in the main window, there will be a large tab with the server name and time/date.
- In 'General', name the session something useful.
- Workload: File. Select the FIRST file in the temp directory. *.trc file.
- The 'database for workload analysis' should be 'master'.
- Under 'Select databases and tables', select the database you want to analyze. Best to leave all tables selected.
- Moving to the 'Tuning Options' tab, turn off 'Limit tuning time' (more processes, better analysis).
- Leave all other settings as is. (Should have 'Indexes', 'No partitioning', and 'Keep all existing PDS' selected.)
- Click the "Start Analysis" button in the top toolbar.
Analyzing the Result Set
When it finishes, it will give a result set. Likely a large one. Typically, 99% of them will be 'Create Statistics', with one or two 'Create Indexes'.
You can save the entire output to a SQL file and then load the SQL file up into SSMS.
Generally, we manually remove the 'Create Index' statements, and just use the 'Create Statistics' ones. (Since they are by nature non-destructive and don't affect product upgrades)
If you decide to implement any of the Create Index statements, please record them down (e.g. in a SpiraTeam task) so that you can undo them before you try and upgrade your instance of SpiraTest, SpiraTeam, SpiraPlan or KronoDesk. This is because the indexes might block the installer changing some of the database tables (needed for a successful upgrade).