|
1 | 1 |
|
2 | 2 | -- SQL Server 2012 Diagnostic Information Queries |
3 | 3 | -- Glenn Berry |
4 | | --- Last Modified: October 7, 2017 |
| 4 | +-- Last Modified: December 1, 2017 |
5 | 5 | -- https://www.sqlskills.com/blogs/glenn/ |
6 | 6 | -- http://sqlserverperformance.wordpress.com/ |
7 | 7 | -- Twitter: GlennAlanBerry |
@@ -88,6 +88,9 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In |
88 | 88 | -- 11.0.6607 SP3 CU10 8/8/2017 |
89 | 89 | -- 11.0.7001 SP4 RTM 10/3/2017 |
90 | 90 |
|
| 91 | +-- SQL Server 2012 Service Pack 4 (SP4) Released! |
| 92 | +-- https://blogs.msdn.microsoft.com/sqlreleaseservices/sql-server-2012-service-pack-4-sp4-released/ |
| 93 | + |
91 | 94 | -- How to determine the version, edition and update level of SQL Server and its components |
92 | 95 | -- https://support.microsoft.com/en-us/kb/321185 |
93 | 96 |
|
@@ -124,19 +127,26 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In |
124 | 127 | -- Announcing updates to the SQL Server Incremental Servicing Model (ISM) |
125 | 128 | -- https://blogs.msdn.microsoft.com/sqlreleaseservices/announcing-updates-to-the-sql-server-incremental-servicing-model-ism/ |
126 | 129 |
|
| 130 | +-- Update Center for Microsoft SQL Server |
| 131 | +-- http://bit.ly/2pZptuQ |
| 132 | + |
127 | 133 | -- Download SQL Server Management Studio (SSMS) |
128 | 134 | -- https://msdn.microsoft.com/en-us/library/mt238290.aspx |
129 | 135 |
|
| 136 | +-- Download and install Microsoft SQL Operations Studio |
| 137 | +-- https://docs.microsoft.com/en-us/sql/sql-operations-studio/download |
| 138 | + |
130 | 139 |
|
131 | 140 | -- Get socket, physical core and logical core count from the SQL Server Error log. (Query 2) (Core Counts) |
132 | | --- This query might take a few seconds if you have not recycled your error log recently |
| 141 | +-- This query might take a few seconds depending on the size of your error log |
133 | 142 | EXEC sys.xp_readerrorlog 0, 1, N'detected', N'socket'; |
134 | 143 | ------ |
135 | 144 |
|
| 145 | +-- New in SQL Server 2012 SP4 |
136 | 146 | -- This can help you determine the exact core counts used by SQL Server and whether HT is enabled or not |
137 | 147 | -- It can also help you confirm your SQL Server licensing model |
138 | | --- Be on the lookout for this message "using 20 logical processors based on SQL Server licensing" |
139 | | --- (when you have more than 20 logical cores) which means grandfathered Server/CAL licensing |
| 148 | +-- Be on the lookout for this message "using 40 logical processors based on SQL Server licensing" |
| 149 | +-- (when you have more than 40 logical cores) which means grandfathered Server/CAL licensing |
140 | 150 | -- This query will return no results if your error log has been recycled since the instance was last started |
141 | 151 |
|
142 | 152 |
|
@@ -203,27 +213,36 @@ DBCC TRACESTATUS (-1); |
203 | 213 |
|
204 | 214 | -- Common trace flags that should be enabled in most cases |
205 | 215 | -- TF 1117 - When growing a data file, grow all files at the same time so they remain the same size, reducing allocation contention points |
206 | | --- http://support2.microsoft.com/kb/2154845 |
| 216 | +-- https://support2.microsoft.com/kb/2154845 |
207 | 217 | -- |
208 | 218 | -- TF 1118 - Helps alleviate allocation contention in tempdb, SQL Server allocates full extents to each database object, |
209 | 219 | -- thereby eliminating the contention on SGAM pages (more important with older versions of SQL Server) |
210 | 220 | -- Recommendations to reduce allocation contention in SQL Server tempdb database |
211 | | --- http://support2.microsoft.com/kb/2154845 |
| 221 | +-- https://support2.microsoft.com/kb/2154845 |
| 222 | + |
| 223 | +-- TF 2371 - Lowers auto update statistics threshold for large tables (on tables with more than 25,000 rows) |
| 224 | +-- https://blogs.msdn.com/b/saponsqlserver/archive/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371.aspx |
212 | 225 |
|
213 | | --- TF 2371 - Lowers auto update statistics threshold for large tables |
214 | | --- http://blogs.msdn.com/b/saponsqlserver/archive/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371.aspx |
| 226 | +-- TF 3023 - Enables backup checksum default |
| 227 | +-- https://support.microsoft.com/en-us/help/2656988/how-to-enable-the-checksum-option-if-backup-utilities-do-not-expose-th |
215 | 228 |
|
216 | 229 | -- TF 3226 - Supresses logging of successful database backup messages to the SQL Server Error Log |
217 | 230 | -- https://www.sqlskills.com/blogs/paul/fed-up-with-backup-success-messages-bloating-your-error-logs/ |
218 | 231 |
|
| 232 | +-- TF 3449 - Enables use of dirty page manager (SQL Server 2012 SP3 CU3 and later) |
| 233 | +-- https://blogs.msdn.microsoft.com/psssql/2017/06/29/sql-server-large-ram-and-db-checkpointing/ |
| 234 | + |
219 | 235 | -- TF 6533 - Spatial performance improvements in SQL Server 2012 and 2014 |
220 | 236 | -- https://support.microsoft.com/en-us/kb/3107399 |
221 | 237 |
|
222 | 238 | -- TF 6534 - Enables use of native code to improve performance with spatial data |
223 | 239 | -- https://blogs.msdn.microsoft.com/bobsql/2016/06/03/sql-2016-it-just-runs-faster-native-spatial-implementations/ |
224 | 240 |
|
225 | | --- SQL Server query optimizer hotfix trace flag 4199 servicing model |
226 | | --- https://support.microsoft.com/en-us/kb/974006 |
| 241 | +-- TF 8079 - Enables automatic soft-NUMA on systems with eight or more physical cores per NUMA node (with SQL Server 2012 SP4) |
| 242 | +-- https://blogs.msdn.microsoft.com/sqlreleaseservices/sql-server-2012-service-pack-4-sp4-released/ |
| 243 | + |
| 244 | +--- DBCC TRACEON - Trace Flags (Transact-SQL) |
| 245 | +-- https://docs.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql |
227 | 246 |
|
228 | 247 |
|
229 | 248 |
|
@@ -794,18 +813,19 @@ AS (SELECT wait_type, wait_time_ms/ 1000.0 AS [WaitS], |
794 | 813 | AND waiting_tasks_count > 0) |
795 | 814 | SELECT |
796 | 815 | MAX (W1.wait_type) AS [WaitType], |
| 816 | + CAST (MAX (W1.Percentage) AS DECIMAL (5,2)) AS [Wait Percentage], |
| 817 | + CAST ((MAX (W1.WaitS) / MAX (W1.WaitCount)) AS DECIMAL (16,4)) AS [AvgWait_Sec], |
| 818 | + CAST ((MAX (W1.ResourceS) / MAX (W1.WaitCount)) AS DECIMAL (16,4)) AS [AvgRes_Sec], |
| 819 | + CAST ((MAX (W1.SignalS) / MAX (W1.WaitCount)) AS DECIMAL (16,4)) AS [AvgSig_Sec], |
797 | 820 | CAST (MAX (W1.WaitS) AS DECIMAL (16,2)) AS [Wait_Sec], |
798 | 821 | CAST (MAX (W1.ResourceS) AS DECIMAL (16,2)) AS [Resource_Sec], |
799 | 822 | CAST (MAX (W1.SignalS) AS DECIMAL (16,2)) AS [Signal_Sec], |
800 | 823 | MAX (W1.WaitCount) AS [Wait Count], |
801 | | - CAST (MAX (W1.Percentage) AS DECIMAL (5,2)) AS [Wait Percentage], |
802 | | - CAST ((MAX (W1.WaitS) / MAX (W1.WaitCount)) AS DECIMAL (16,4)) AS [AvgWait_Sec], |
803 | | - CAST ((MAX (W1.ResourceS) / MAX (W1.WaitCount)) AS DECIMAL (16,4)) AS [AvgRes_Sec], |
804 | | - CAST ((MAX (W1.SignalS) / MAX (W1.WaitCount)) AS DECIMAL (16,4)) AS [AvgSig_Sec] |
| 824 | + CAST (N'https://www.sqlskills.com/help/waits/' + W1.wait_type AS XML) AS [Help/Info URL] |
805 | 825 | FROM Waits AS W1 |
806 | 826 | INNER JOIN Waits AS W2 |
807 | 827 | ON W2.RowNum <= W1.RowNum |
808 | | -GROUP BY W1.RowNum |
| 828 | +GROUP BY W1.RowNum, W1.wait_type |
809 | 829 | HAVING SUM (W2.Percentage) - MAX (W1.Percentage) < 99 -- percentage threshold |
810 | 830 | OPTION (RECOMPILE); |
811 | 831 | ------ |
|
0 commit comments