Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

SQL Server Trace Flags - Complete list

$
0
0

Trace Flag: -1

Function: Sets trace flags for all client connections, rather than for a single client connection. Because trace flags set using the -T command-line option automatically apply to all connections, this trace flag is used only when setting trace flags using DBCC TRACEON and DBCC TRACEOFF.

Link: http://www.sql-server-performance.com/2002/traceflags/

Trace Flag: 101

Function: Verbose Merge Replication logging output for troubleshooting Merger repl performance

Link: http://support.microsoft.com/kb/2892633

Trace Flag: 102

Function: Verbose Merge Replication logging to msmerge_history table for troubleshooting Merger repl performance

Link: http://support.microsoft.com/kb/2892633

Trace Flag: 105

Function: Join more than 16 tables in SQL server 6.5

Link: http://www.databasejournal.com/features/mssql/article.php/1443351/SQL-Server-65-Some-Useful-Trace-Flags.htm

Trace Flag: 106

Function: This enables you to see the messages that are sent to and from the Publisher, if you are using Web Synchronization

Link: http://technet.microsoft.com/en-us/library/ms151872(v=sql.105).aspx

Trace Flag: 107

Function: SQL 6.5/7/8 Interprets numbers with a decimal point as float instead of decimal

Link: http://support.microsoft.com/kb/203787

Link: https://support.microsoft.com/en-us/kb/155714

Trace Flag: 110

Function: SQL 6.5 Turns off ANSI select characteristics

Link: https://support.microsoft.com/en-us/kb/152032

Trace Flag: 144

Function: Force server side bucketization. For legacy applications where change to client side code is not an option and when the application has queries that are improperly parameterized, this trace flag forces server side bucketization.

Link: http://blogs.msdn.microsoft.com/sqlprogrammability/2007/01/13/6-0-best-programming-practices

Trace Flag: 146

Function: Consider using when replaying against SQL 8.0, to avoid an attempt to set an encrypted connection.

Link: None

Trace Flag: 168

Function: Bugfix in ORDER BY

Link: http://support.microsoft.com/kb/926292

Trace Flag: 174

Function: Increases the SQL Server Database Engine plan cache bucket count from 40,009 to 160,001 on 64-bit systems.

Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

Link: https://support.microsoft.com/en-us/kb/3026083

Link: MSDN ms188396

Scope: global only

Trace Flag: 204

Function: SQL 6.5 Backward compatibility switch that enables non-ansi standard behavior. E.g. previously SQL server ignored trailing blanks in the like statement and allowed queries that contained aggregated functions to have items in the group by clause that were not in the select list.

Link: None

Trace Flag: 205

Function: Reports to the error log when a statistics-dependent stored procedure is being recompiled as a result of auto-update statistics.

Link: https://support.microsoft.com/en-us/kb/195565

Link: MSDN ms188396

Scope: global only

Trace Flag: 206

Function: SQL 6.5 Provides backward compatibility for the set user statement. KB 160732

Link: None

Trace Flag: 208

Function: SET QUOTED IDENTIFIER ON

Link: None

Trace Flag: 210

Function: SQL 9 Error when you run a query against a view: "An error occurred while executing batch"

Link: https://support.microsoft.com/en-us/kb/945892

Trace Flag: 212

Function: SQL 9 Query may run much slower when compared to SQL 8 when you use a cursor to run the query

Link: https://support.microsoft.com/en-us/kb/951184

Trace Flag: 237

Function: Tells SQL Server to use correlated sub-queries in Non-ANSI standard backward compatibility mode

Link: None

Trace Flag: 242

Function: Provides backward compatibility for correlated subqueries where non-ANSI-standard results are desired

Link: None

Trace Flag: 243

Function: Provides backward compatibility for nullability behavior. When set, SQL Server has the same nullability violation behavior as that of a ver 4.2: Processing of the entire batch is terminated if the nullability error (inserting NULL into a NOT NULL field) can be detected at compile time; Processing of offending row is skipped, but the command continues if the nullability violation is detected at run time.Behavior of SQL Server is now more consistent because nullability checks are made at run time and a nullability violation results in the command terminating and the batch or transaction process continuing.

Link: None

Trace Flag: 244

Function: Disables checking for allowed interim constraint violations. By default, SQL Server checks for and allows interim constraint violations. An interim constraint violation is caused by a change that removes the violation such that the constraint is met, all within a single statement and transaction. SQL Server checks for interim constraint violations for self-referencing DELETE statements, INSERT, and multi-row UPDATE statements. This checking requires more work tables. With this trace flag you can disallow interim constraint violations, thus requiring fewer work tables.

Link: None

Trace Flag: 246

Function: Derived or NULL columns must be explicitly named in a select…INTO or create view statement when not done they raise an error. This flag avoids that.

Link: None

Trace Flag: 253

Function: Prevents ad-hoc query plans to stay in cache

Link: http://www.sqlservercentral.com/Forums/Topic837613-146-1.aspx

Trace Flag: 257

Function: Will invoke a print algorithm on the XML output before returning it to make the XML result more readable

Link: None

Trace Flag: 260

Function: Prints versioning information about extended stored procedure dynamic-link libraries (DLLs). For more information about GetXpVersion(), see Creating Extended Stored Procedures .

Link: http://msdn.microsoft.com/en-us/library/ms164627.aspx

Link: MSDN ms188396

Scope: global or session

Trace Flag: 262

Function: SQL 7 Trailing spaces are no longer truncated from literal strings in CASE statements

Link: https://support.microsoft.com/en-us/kb/891116

Trace Flag: 272

Function: Generates a log record per identity increment. Can be users to convert SQL 2012 back to old style Identity behaviour

Link: http://www.big.info/2013/01/how-to-solve-sql-server-2012-identity.html

Link: https://connect.microsoft.com/SQLServer/feedback/details/739013/failover-or-restart-results-in-reseed-of-identity

Trace Flag: 302

Function: Output Index Selection info

Link: http://www.databasejournal.com/features/mssql/article.php/1443351/SQL-Server-65-Some-Useful-Trace-Flags.htm

Trace Flag: 310

Function: Outputs info about actual join order

Link: http://www.databasejournal.com/features/mssql/article.php/1443351/SQL-Server-65-Some-Useful-Trace-Flags.htm

Trace Flag: 320

Function: Disables join-order heuristics used in ANSI joins. To see join-order heuristics use flag 310. SQL Server uses join-order heuristics to reduce of permutations when using the best join order.

Link: None

Trace Flag: 323

Function: Outputs detailed info about updates

Link: http://www.databasejournal.com/features/mssql/article.php/1443351/SQL-Server-65-Some-Useful-Trace-Flags.htm

Trace Flag: 325

Function: Prints information about the cost of using a non-clustered index or a sort to process an ORDER BY clause

Link: None

Trace Flag: 326

Function: Prints information about estimated & actual costs of sorts. Instructs server to use arithmetic averaging when calculating density instead of a geometric weighted average when updating statistics. Useful for building better stats when an index has skew on the leading column. Use only for updating the stats of a table/index with known skewed data.

Link: None

Trace Flag: 330

Function: Enables full output when using the SET SHOWPLAN_ALL option, which gives detailed information about joins

Link: None

Trace Flag: 342

Function: Disables the costing of pseudo-merge joins, thus significantly reducing time spent on the parse for certain types of large, multi-table joins. One can also use SET FORCEPLAN ON to disable the costing of pseudo-merge joins because the query is forced to use the order specified in the FROM clause.

Link: None

Trace Flag: 345

Function: Changes join order selection logic in SQL Server 6.5

Link: http://www.databasejournal.com/features/mssql/article.php/1443351/SQL-Server-65-Some-Useful-Trace-Flags.htm

Trace Flag: 445

Function: Prints ”compile issued” message in the errorlog for each compiled statement, when used together with 3605

Link: None

Trace Flag: 506

Function: Enforces SQL-92 standards regarding null values for comparisons between variables and parameters. Any comparison of variables and parameters that contain a NULL always results in a NULL.

Link: None

Trace Flag: 610

Function: Controls minimally logged inserts into indexed tables.

Link: http://msdn.microsoft.com/en-us/library/dd425070%28v=SQL.100%29.aspx

Link: https://www.pythian.com/blog/minimally-logged-operations-data-loads/

Link: https://msdn.microsoft.com/library/dd425070.aspx

Link: MSDN ms188396

Scope: global or session

Trace Flag: 611

Function: SQL 9 When turned on, each lock escalation is recorded in the error log along with the SQL Server handle number. Aaron confirmed this still works in SQL 2014. Outputs info of the form: "Escalated locks - Reason: LOCK_THRESHOLD, Mode: S, Granularity: TABLE, Table: 222623836, HoBt: 150:256, HoBt Lock Count: 6248, Escalated Lock Count: 6249, Line Number: 1, Start Offset: 0, SQL Statement: select count(*) from dbo.BigTable"

Link: None

Trace Flag: 617

Function: SQL 9 When turned on, each lock escalation is recorded in the error log along with the SQL Server handle number. As long as there are no SCH_M lock requests waiting in the ‘lock wait list’, the ‘lock wait list’ will be bypassed by statements issued in uncommitted read transaction isolation level. If there is a SCH_M lock request in the ‘lock wait list’, a query in uncommitted read transaction isolation level will not bypass the ‘lock wait list’, but the SCH_S lock request will go into the ‘lock wait list’. In order behind the SCH_M lock waiting in the same list. As a result the grant of the SCH_S request for such a query is dependent on the grant and release of the SCH_M lock request entering the ‘lock wait list’ earlier.

Link: https://blogs.msdn.microsoft.com/saponsqlserver/2014/01/17/new-functionality-in-sql-server-2014-part-3-low-priority-wait/

Trace Flag: 634

Function: Disables the background columnstore compression task. SQL Server periodically runs the Tuple Mover background task that compresses columnstore index rowgroups with uncompressed data, one such rowgroup at a time. Columnstore compression improves query performance but also consumes system resources. You can control the timing of columnstore compression manually, by disabling the background compression task with trace flag 634, and then explicitly invoking ALTER INDEX REORGANIZE or ALTER INDEX REBUILD at the time of your choice.

Link: Niko Neugebauer Columnstore Indexes part 35

Link: MSDN ms188396

Scope: global only

Trace Flag: 646

Function: Serves for getting detailed information on which Columnstore were eliminated by the Query Optimiser right into the error log.

Link: Niko Neugebauer Columnstore Indexes part 35

Trace Flag: 647

Function: Avoids a new-in-SQL 2012 data check (done when adding a column to a table) that can cause ALTER TABLE... ADD operations to take a very long time. The KB has a useful query for determining the row size for a table.

Link: https://support.microsoft.com/en-us/help/2986423/fix-it-takes-a-long-time-to-add-new-columns-to-a-table-when-the-row-size-exceeds-the-maximum-allowed-size

Trace Flag: 652

Function: Disable page pre-fetching scans

Link: KB920093 ]

Link: MSDN ms188396

Scope: global only

Trace Flag: 653

Function: Disables read ahead for the current connection

Link: None

Trace Flag: 661

Function: Disables the ghost record removal process.

Link: KB920093

Link: MSDN ms188396

Scope: global only

Trace Flag: 662

Function: Prints detailed information about the work done by the ghost cleanup task when it runs next. Use TF 3605 to see the output in the errorlog

Link: http://blogs.msdn.com/b/sqljourney/archive/2012/07/28/an-in-depth-look-at-ghost-records-in-sql-server.aspx

Trace Flag: 669

Function: “...prevents user queries from queuing requests to the ghost cleanup process”. This flag is a workaround for stack dumps occurring right after SQL Server startup, where user queries (that queue pages for ghost cleanup) were running so quickly after SQL startup that they were queuing pages before the ghost cleanup process had actually initialized.

Link: https://support.microsoft.com/en-us/help/3027860/error-17066-or-17310-during-sql-server-startup

Trace Flag: 698

Function: SQL 9 Performance of INSERT operations against a table with an identity column may be slow when compared to SQL 8

Link: https://support.microsoft.com/en-gb/kb/940545

Trace Flag: 699

Function: Turn off transaction logging for the entire SQL dataserver

Link: None

Trace Flag: 670, 671

Function: Disables deferred deallocation. But note Paul White’s comment on the post! The flag # may actuall by 671.

Link: https://blogs.msdn.microsoft.com/psssql/2009/11/17/how-it-works-controlling-sql-server-memory-dumps/

Trace Flag: 715

Function: Enables table lock for bulk load operations into a heap with no non-clustered indexes. When this trace flag is enabled, bulk load operations acquire bulk update (BU) locks when bulk copying data into a table. Bulk update (BU) locks allow multiple threads to bulk load data concurrently into the same table, while preventing other processes that are not bulk loading data from accessing the table. The behavior is similar to when the user explicitly specifies TABLOCK hint while performing bulk load, or when the sp_tableoption table lock on bulk load is enabled for a given table. However, when this trace flag is enabled, this behavior becomes default without any query or database changes.

Link: MSDN ms188396

Scope: global or session

Trace Flag: 806

Function: Turn on Page Audit functionality, to verify page validity

Link: http://technet.microsoft.com/en-au/library/cc917726.aspx

Trace Flag: 809

Function: SQL 8 Limits the amount of Lazy write activity

Link: None

Trace Flag: 815

Function: SQL 8/9 Enables latch enforcement. SQL Server 8 (with service pack 4) and SQL Server 9 can perform latch enforcement for data pages found in the buffer pool cache. Latch enforcement changes the virtual memory protection state while database page status changes from "clean" to "dirty" ("dirty" means modified through INSERT, UPDATE or DELETE operation). If an attempt is made to modify a data page while latch enforcement is set, it causes an exception and creates a mini-dump in SQL Server installation's LOG directory. Microsoft support can examine the contents of such mini-dump to determine the cause of the exception. In order to modify the data page the connection must first acquire a modification latch. Once the data modification latch is acquired the page protection is changed to read-write. Once the modification latch is released the page protection changes back to read-only.

Link: None

Trace Flag: 818

Function: Turn on ringbuffer to store info about IO write operations. Used to troubleshoot IO problems

Link: http://support.microsoft.com/kb/826433

Trace Flag: 828

Function: SQL 8 - When enabled checkpoint ignores the recovery interval target and keeps steady I/O otherwise it uses recovery interval setting as a target for the length of time that checkpoint will take

Link: https://support.microsoft.com/en-gb/kb/906121 Link: https://blogs.msdn.microsoft.com/psssql/2008/04/11/how-it-works-sql-server-checkpoint-flushcache-outstanding-io-target/

Trace Flag: 830

Function: SQL 9 Disable the reporting of CPU Drift errors in the SQL Server errorlog like SQL Server has encountered 2 occurrence(s) of I/O requests taking longer than 15 seconds to complete

Link: https://support.microsoft.com/en-us/kb/897284 Link: https://technet.microsoft.com/en-us/library/aa175396(v=SQL.80).aspx

Trace Flag: 831

Function: Protect unchanged pages in the buffer pool to catch memory corruptions

Link: None

Trace Flag: 834

Function: Uses Microsoft windows large-page allocations for the buffer pool.

Note: If you are using the Columnstore Index feature of SQL Server 2012 to SQL Server 2016, we do not recommend turning on trace flag 834.

Link: https://support.microsoft.com/en-us/kb/920093

Link: https://support.microsoft.com/en-us/kb/3210239

Link: MSDN ms188396

Scope: global only

Trace Flag: 835

Function: SQL 9 / 10 On 64 bit SQL Server it turns off Lock pages in memory

Link: None

Trace Flag: 836

Function: Use the max server memory option for the buffer pool

Link: KB920093 Link: https://blogs.msdn.microsoft.com/psssql/2012/12/11/how-it-works-sql-server-32-bit-paeawe-on-sql-2005-2008-and-2008-r2-not-using-as-much-ram-as-expected/

Trace Flag: 839

Function: (Apparently) forces SQL Server to treate all NUMA memory as “flat”, as if it was SMP.

Link: https://blogs.msdn.microsoft.com/psssql/2010/04/02/how-it-works-soft-numa-io-completion-thread-lazy-writer-workers-and-memory-nodes

Trace Flag: 840

Function: SQL 9 When trace turned on, SQL Server can perform larger I/O extent reads to populate the buffer pool when SQL Server starts this populates the buffer pool faster. Additionally, the larger I/O extent reads improve the initial query compilation and the response time when SQL Server starts.

Link: https://blogs.msdn.microsoft.com/ialonso/2011/12/09/the-read-ahead-that-doesnt-count-as-read-ahead

Trace Flag: 842

Function: Use sys.dm_os_memory_node_access_stats to verify local vs. foreign memory under NUMA configurations after turning on this flag

Link: None

Trace Flag: 845

Function: Enable Lock pages in Memory on Standard Edition

Link: https://support.microsoft.com/en-gb/kb/970070 Link: https://support.microsoft.com/en-us/help/2708594/fix-locked-page-allocations-are-enabled-without-any-warning-after-you-upgrade-to-sql-server-2012

Trace Flag: 851

Function: According to Bob Ward’s PASS 2014 talk on SQL Server IO, “disable[s] BPE even if enabled via ALTER SERVER”

Link: None

Trace Flag: 902

Function: Bypasses execution of database upgrade script when installing a Cumulative Update or Service Pack. If you encounter an error during script upgrade mode, it is recommended to contact Microsoft SQL Customer Service and Support (CSS) for further guidance.

Warning: This trace flag is meant for troubleshooting of failed updates during script upgrade mode, and it is not supported to run it continuously in a production environment. Database upgrade scripts needs to execute successfully for a complete install of Cumulative Updates and Service Packs. Not doing so can cause unexpected issues with your SQL Server instance.

Link: https://support.microsoft.com/en-us/kb/2163980

Link: MSDN ms188396

Scope: global only

Trace Flag: 1106

Function: SQL 9 - Used space in tempdb increases continuously when you run a query that creates internal objects in tempdb

Link: https://support.microsoft.com/en-gb/kb/947204

Link: https://blogs.msdn.microsoft.com/arvindsh/2014/02/24/tracking-tempdb-internal-object-space-usage-in-sql-2012

Trace Flag: 1117

Function: When a file in the filegroup meets the autogrow threshold, all files in the filegroup grow.

Note: Beginning with SQL Server 2016 this behavior is controlled by the AUTOGROW_SINGLE_FILE and AUTOGROW_ALL_FILES option of ALTER DATABASE, and trace flag 1117 has no affect. For more information, see ALTER DATABASE File and Filegroup Options (Transact-SQL).

Link: https://www.littlekendra.com/2017/01/03/parallelism-and-tempdb-data-file-usage-in-sql-server/

Link: SQL Server 2016 : Getting tempdb a little more right

Link: MSDN ms188396

Link: http://www.sqlskills.com/blogs/paul/tempdb-configuration-survey-results-and-advice Link: https://blogs.msdn.microsoft.com/ialonso/2011/12/01/attempt-to-grow-all-files-in-one-filegroup-and-not-just-the-one-next-in-the-autogrowth-chain-using-trace-flag-1117 Link: http://sql-articles.com/articles/general/day-6trace-flag-1117-auto-grow-equally-in-all-data-file Scope: global only

Trace Flag: 1118

Function: Removes most single page allocations on the server, reducing contention on the SGAM page. When a new object is created, by default, the first eight pages are allocated from different extents (mixed extents). Afterwards, when more pages are needed, those are allocated from that same extent (uniform extent). The SGAM page is used to track these mixed extents, so can quickly become a bottleneck when numerous mixed page allocations are occurring. This trace flag allocates all eight pages from the same extent when creating new objects, minimizing the need to scan the SGAM page.

Note: Beginning with SQL Server 2016 this behavior is controlled by the SET MIXED_PAGE_ALLOCATION option of ALTER DATABASE, and trace flag 1118 has no affect. For more information, see ALTER DATABASE SET Options (Transact-SQL).

Link: http://blogs.msdn.com/b/psssql/archive/2008/12/17/sql-server-2005-and-2008-trace-flag-1118-t1118-usage.aspx

Link: http://www.sqlskills.com/blogs/paul/misconceptions-around-tf-1118/

Link: https://support.microsoft.com/en-us/kb/328551

Link: SQL Server 2016 : Getting tempdb a little more right

Link: MSDN ms188396

Link: https://chrisadkin.org/2015/04/14/well-known-and-not-so-well-known-sql-server-tuning-knobs-and-switches

Scope: global only

Trace Flag: 1119

Function: Turns of mixed extent allocation (Similar to 1118?)

Link: TECHNET List Of SQL Server Trace Flags

Trace Flag: 1124

Function: Unknown. Has been reportedly found turned on in some SQL Server instances running Dynamics AX. Also rumored to be invalid in public builds of SQL Server

Link: None

Trace Flag: 1140

Function: A workaround for a bug in SQL 2005 SP2, SP3, and SQL 2008, where mixed page allocations climb continually, due to a change in the way that mixed-page allocations are done.

Link: None

Trace Flag: 1165

Function: This presentation by Bob Ward says that this TF outputs the recalculated #’s (every 8192 allocations) for the proportional fill algorithm in database allocation when multiple files are present..

Link: None

Trace Flag: 1180

Function: SQL 7 - Forces allocation to use free pages for text or image data and maintain efficiency of storage. Helpful in case when DBCC SHRINKFILE and SHRINKDATABASE commands may not work because of sparsely populated text, ntext, or image columns.

Link: None

Trace Flag: 1197

Function: Applies only in the case of SQL 7 SP3, similar with trace flag 1180

Link: None

Trace Flag: 1200

Function: Prints detailed lock information as every request for a lock is made (the process ID and type of lock requested)

Link: TECHNET List Of SQL Server Trace Flags Link: https://blogs.msdn.microsoft.com/sqlserverstorageengine/2008/03/30/tempdb-table-variable-vs-local-temporary-table

Link: https://support.microsoft.com/en-us/help/169960/inf-analyzing-and-avoiding-deadlocks-in-sql-server

Trace Flag: 1202

Function: Insert blocked lock requests into syslocks

Link: None

Trace Flag: 1204

Function: Returns the resources and types of locks participating in a deadlock and also the current command affected.

Link: https://support.microsoft.com/en-us/kb/832524

Link: MSDN ms188396

Scope: global only

Trace Flag: 1205

Function: More detailed information about the command being executed at the time of a deadlock. Documented in SQL 7 BOL.

Link: https://support.microsoft.com/en-us/help/832524/sql-server-technical-bulletin---how-to-resolve-a-deadlock

Trace Flag: 1206

Function: Used to complement flag 1204 by displaying other locks held by deadlock parties

Link: https://support.microsoft.com/en-us/help/169960/inf-analyzing-and-avoiding-deadlocks-in-sql-server

Trace Flag: 1208

Function: KB: “Prints the host name and program name supplied by the client. This can help identify a client involved in a deadlock, assuming the client specifies a unique value for each connection.”

Link: https://support.microsoft.com/en-us/help/169960/inf-analyzing-and-avoiding-deadlocks-in-sql-server

Trace Flag: 1211

Function: Disables lock escalation based on memory pressure, or based on number of locks. The SQL Server Database Engine will not escalate row or page locks to table locks. Using this trace flag can generate excessive numbers of locks. This can slow the performance of the Database Engine, or cause 1204 errors (unable to allocate lock resource) because of insufficient memory. If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224. However, because trace flag 1211 prevents escalation in every case, even under memory pressure, we recommend that you use 1224. This helps avoid "out-of-locks" errors when many locks are being used.

Link: MSDN ms188396

Link: http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-2330-lock-escalation

Scope: global or session

Trace Flag: 1216

Function: SQL 7 - Disables Health reporting. Lock monitor when detects a (worker thread) resource level blocking scenario. If a SPID that owns a lock is currently queued to the scheduler, because all the assigned worker threads have been created and all the assigned worker threads are in an un-resolvable wait state, the following error message is written to the SQL Server error log: Error 1223: Process ID %d:%d cannot acquire lock "%s" on resource %s because a potential deadlock exists on Scheduler %d for the resource. Process ID %d:% d holds a lock "%h" on this resource.

Link: None

Trace Flag: 1222

Function: Returns the resources and types of locks that are participating in a deadlock and also the current command affected, in an XML format that does not comply with any XSD schema.

Link: MSDN ms188396

Scope: global only

Trace Flag: 1224

Function: Disables lock escalation based on the number of locks. However, memory pressure can still activate lock escalation. The Database Engine escalates row or page locks to table (or partition) locks if the amount of memory used by lock objects exceeds one of the following conditions:

Forty percent of the memory that is used by Database Engine. This is applicable only when the locks parameter of sp_configure is set to 0. Forty percent of the lock memory that is configured by using the locks parameter of sp_configure.

For more information, see Server Configuration Options (SQL Server) . If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224. However, because trace flag 1211 prevents escalation in every case, even under memory pressure, we recommend that you use 1224. This helps avoid "out-of-locks" errors when many locks are being used.

Note: Lock escalation to the table- or HoBT-level granularity can also be controlled by using the LOCK_ESCALATION option of the ALTER TABLE statement.

Link: MSDN ms188396

Scope: global or session

Trace Flag: 1228

Function: Enable lock partitioning. By default, lock partitioning is enabled when a server has 16 or more CPUs. Otherwise, lock partitioning is disabled. Trace flag 1228 enables lock partitioning for 2 or more CPUs. Trace flag 1229 disables lock partitioning. Trace flag 1229 overrides trace flag 1228 if trace flag 1228 is also set. Lock partitioning is useful on multiple-CPU servers where some tables have very high lock rates. You can turn on trace flag 1228 and trace flag 1229 only at startup.

Link: Trace Flag 1228 and 1229

Link: Microsoft SQL Server 2005 TPC-C Trace Flags

Trace Flag: 1229

Function: Enable lock partitioning. By default, lock partitioning is enabled when a server has 16 or more CPUs. Otherwise, lock partitioning is disabled. Trace flag 1228 enables lock partitioning for 2 or more CPUs. Trace flag 1229 disables lock partitioning. Trace flag 1229 overrides trace flag 1228 if trace flag 1228 is also set. Lock partitioning is useful on multiple-CPU servers where some tables have very high lock rates. You can turn on trace flag 1228 and trace flag 1229 only at startup.

Link: Trace Flag 1228 and 1229

Link: Microsoft SQL Server 2005 TPC-C Trace Flags

Trace Flag: 1236

Function: Enables database lock partitioning. Fixes performance problem in scenarios with high lock activity in SQL 2012 and SQL 2014.

Note: Beginning with SQL Server 2012 SP3 and SQL Server 2014 SP1 this behavior is controlled by the engine and trace flag 1236 has no effect.

Link: https://support.microsoft.com/en-us/kb/2926217

Link: MSDN ms188396

Scope: global only

Trace Flag: 1260

Function: Disabled mini-dump for non-yield condition. Disables mini-dump generation for "any of the 17883, 17884, 17887, or 17888 errors. The trace flag can be used in conjunction with trace flag T1262. For example, you could enable T1262 to get 10- and a 60-second interval reporting and also enable T1260 to avoid getting mini-dumps."

Link: A Topical Collection of SQL Server Flags v6

Link: How To Diagnose and Correct Errors 17883, 17884, 17887, and 17888

Link: MSDN ms188396

Scope: global only

Trace Flag: 1261

Function: SQL 8 - Disables Health reporting. Lock monitor when detects a (worker thread) resource level blocking scenario. If a SPID that owns a lock is currently queued to the scheduler, because all the assigned worker threads have been created and all the assigned worker threads are in an un-resolvable wait state, the following error message is written to the SQL Server error log: Error 1229: Process ID %d:%d owns resources that are blocking processes on scheduler %d.

Link: None

Trace Flag: 1262

Function: The default behavior (for 1788* errors) is for SQL to generate a mini-dump on the first occurrence, but never after. 1262 changes the behavior: “When T1262 is enabled, a mini-dump is generated when the non-yielding condition is declared (15 seconds) and at subsequent 60-second intervals for the same non-yield occurrence. A new nonDiagCorrect17883etc; yielding occurrence causes dump captures to occur again.” In SQL 2000 this was a startup-only flag; in 2005+ it can be enabled via TRACEON. Note that the flag is also covered in Khen2005, p400, but with no new information.

Link: A Topical Collection of SQL Server Flags v6

Link: How To Diagnose and Correct Errors 17883, 17884, 17887, and 17888

Trace Flag: 1264

Function: Collect process names in non-yielding scenario memory dumps

Link: A Topical Collection of SQL Server Flags v6

Link: http://support.microsoft.com/kb/2630458/en-us

Trace Flag: 1400

Function: SQL 9 RTM Enables creation of database mirroring endpoint, which is required for setting up and using database mirroring

Link: None

Trace Flag: 1439

Function: Trace database restart and failover messages to SQL Errorlog for mirrored databases

Link: Trace flags in sql server from trace flag 902 to trace flag 1462

Trace Flag: 1448

Function: Enables the replication log reader to move forward even if the async secondaries have not acknowledged the reception of a change. Even with this trace flag enabled the log reader always waits for the sync secondaries. The log reader will not go beyond the min ack of the sync secondaries. This trace flag applies to the instance of SQL Server, not just an availability group, an availability database, or a log reader instance. Takes effect immediately without a restart. This trace flag can be activated ahead of time or when an async secondary fails.

Link: https://support.microsoft.com/en-us/kb/937041

Link: MSDN ms188396

Scope: global only

Trace Flag: 1449

Function: When you use SNAC to connect to an instance of a principal server in a database mirroring session: "The connection attempted to fail over to a server that does not have a failover partner".

Link: https://support.microsoft.com/en-gb/kb/936179

Trace Flag: 1462

Function: Disables log stream compression for asynchronous availability groups. This feature is enabled by default on asynchronous availability groups in order to optimize network bandwidth.

Link: http://sqlcat.com/sqlcat/b/technicalnotes/archive/2007/09/17/database-mirroring-log-compression-in-sql-server-2008-improves-throughput.aspx

Link: MSDN mt736907

Link: MSDN ms188396

Scope: global only

Trace Flag: 1482

Function: Prints information to the Error Log (3605 is not necessary) for a variety of transaction log operations are done, including when the MinLSN value is reset, when a VLF is formatted, etc.

Link: None

Trace Flag: 1504

Function: Dynamic memory grant expansion can also help with parallel index build plans where the distribution of rows across threads is uneven. The amount of memory that can be consumed this way is not unlimited, however. SQL Server checks each time an expansion is needed to see if the request is reasonable given the resources available at that time. Some insight to this process can be obtained by enabling undocumented trace flag 1504, together with 3604 (for message output to the console) or 3605 (output to the SQL Server error log). If the index build plan is parallel, only 3605 is effective because parallel workers cannot send trace messages cross-thread to the console.

Link: Internals of the Seven SQL Server Sorts Part 1

Trace Flag: 1603

Function: Use standard disk I/O (i.e. turn off asynchronous I/O)

Link: None

Trace Flag: 1604

Function: Once enabled at start up makes SQL Server output information regarding memory allocation requests

Link: None

Trace Flag: 1609

Function: Turns on the unpacking and checking of RPC information in Open Data Services. Used only when applications depend on the old behavior.

Link: None

Trace Flag: 1610

Function: Boot the SQL dataserver with TCP_NODELAY enabled

Link: None

Trace Flag: 1611

Function: If possible, pin shared memory -- check errorlog for success/failure

Link: None

Trace Flag: 1613

Function: Set affinity of the SQL data server engine's onto particular CPUs -- usually pins engine 0 to processor 0, engine 1 to processor 1...

Link: None

Trace Flag: 1615

Function: Khen2005, page 385 (paraphrased): directs SQL to use threads instead of fiber even if the “lightweight pooling” config option is on. (Apparently, sometimes SQL wouldn’t start successfully when using lightweight pooling, and so this lets you get SQL up and running, so that you can turn the config option off)

Link: None

Trace Flag: 1704

Function: Prints information when a temporary table is created or dropped

Link: None

Trace Flag: 1717

Function: MSShipped bit will be set automatically at Create time when creating stored procedures

Link: None

Trace Flag: 1800

Function: Enables SQL Server optimization when disks of different sector sizes are used for primary and secondary replica log files, in SQL Server AG and Log Shipping environments.

Link: https://support.microsoft.com/en-us/kb/3009974

Link: MSDN ms188396

Scope: global only

Trace Flag: 1802

Function: SQL 9 - After detaching a database that resides on network-attached storage, you cannot reattach the SQL Server database

Link: https://support.microsoft.com/en-us/kb/922804

Trace Flag: 1806

Function: Disable Instant File Initialization

Link: http://technet.microsoft.com/en-au/library/cc917726.aspx Link: https://blogs.msdn.microsoft.com/sql_pfe_blog/2009/12/22/how-and-why-to-enable-instant-file-initialization Link: http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-330-instant-file-initialization-can-be-controlled-from-within-sql-server Link: https://support.microsoft.com/en-us/help/2574695/file-initialization-takes-a-long-time-for-sql-server-database-related-operations

Trace Flag: 1807

Function: Enable option to have database files on SMB share for SQL Server 2008 and 2008R2

Link: http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx Link: https://support.microsoft.com/en-us/help/304261/description-of-support-for-network-database-files-in-sql-server

Trace Flag: 1808

Function: Directs SQL Server to ignore auto-closing databases even if the Auto-close property is set to ON. Must be set globally. Present in Yukon forward

Link: https://blogs.msdn.microsoft.com/ialonso/2012/04/11/want-your-sql-server-to-simply-ignore-the-auto_close-setting-for-all-open-databases-for-which-it-has-been-enabled

Trace Flag: 1810

Function: Prints the file create/open/close timings

Link: None

Trace Flag: 1816

Function: Bob Ward briefly references this flag in his PASS 2014 SQL Server IO talk, saying that it “could provide more details around errors” that occur with IO done to SQL data files in Azure Storage.

Link: None

Trace Flag: 1903

Function: SQL 8 - When you capture a SQL Profiler trace in a file and then you try to import the trace files into tables by using the fn_trace_gettable function no rows may be returned

Link: https://support.microsoft.com/en-us/kb/911678

Trace Flag: 2301

Function: Enable advanced decision support optimizations

Link: KB920093

Link: MSDN ms188396

Scope: global and session and query

Trace Flag: 2312

Function: Enables you to set the query optimizer cardinality estimation model to the SQL Server 2014 through SQL Server 2016 versions, dependent of the compatibility level of the database.

Link: KB2801413

Link: New Features in SQL Server 2016 Service Pack 1

Link: MSDN ms188396

Scope: global or session or query

Trace Flag: 2328

Function: SQL 9+ - Makes cardinality estimates upon resulting selectivity. The reasoning for this is that one or more of the constants may be statement parameters, which would change from one execution of the statement to the next.

Link: None

Trace Flag: 2330

Function: Query performance decreases when sys.dm_db_index_usage_stats has large number of rows

Link: http://www.brentozar.com/archive/2015/11/trace-flag-2330-who-needs-missing-index-requests/ Link: https://chrisadkin.org/2015/04/14/well-known-and-not-so-well-known-sql-server-tuning-knobs-and-switches/

Trace Flag: 2335

Function: Causes SQL Server to assume a fixed amount of memory is available during query optimization. It does not limit the memory SQL Server grants to execute the query. The memory configured for SQL Server will still be used by data cache, query execution and other consumers.

Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

Link: https://support.microsoft.com/en-us/kb/2413549

Link: MSDN ms188396

Scope: global or session or query

Trace Flag: 2340

Function: Causes SQL Server not to use a sort operation (batch sort) for optimized nested loop joins when generating a plan. Beginning with SQL Server 2016 SP1, to accomplish this at the query level, add the USE HINT query hint instead of using this trace flag.

Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

Link: https://support.microsoft.com/en-us/kb/2009160

Link: New Features in SQL Server 2016 Service Pack 1

Link: MSDN ms188396

Scope: global or session or query

Trace Flag: 2363

Function: TF Selectivity

Link: Cardinality Estimation Framework 2014 First Look

Link: http://www.queryprocessor.com/ce-process/

Trace Flag: 2371

Function: Changes the fixed auto update statistics threshold to dynamic auto update statistics threshold.

Note: Beginning with SQL Server 2016 this behavior is controlled by the engine and trace flag 2371 has no effect.

Link: http://www.sqlservice.se/sv/start/blogg/sql-server--auto-update-stats-part-2.aspx

Link: https://support.microsoft.com/en-us/kb/2754171

Link: http://blogs.msdn.com/b/saponsqlserver/archive/2011/09/07/changes-to-automatic-update-statistics-in-sql-server-traceflag-2371.aspx

Link: MSDN ms188396

Scope: global only

Trace Flag: 2372

Function: Displays memory utilization during the optimization process. Memory for Phases.

Link: More Undocumented Query Optimizer Trace Flags

Link:

Viewing all articles
Browse latest Browse all 3160

Trending Articles