DBCC TRACEON - 跟踪标志 (Transact-SQL)DBCC TRACEON - Trace Flags (Transact-SQL)

适用对象:是SQL Server 是Azure SQL 数据库(仅限托管实例)否Azure Synapse Analytics (SQL DW) 否并行数据仓库 APPLIES TO: yesSQL Server yesAzure SQL Database (Managed Instance only) noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

跟踪标志用于设置特定服务器特征或更改特定行为。Trace flags are used to set specific server characteristics or to alter a particular behavior. 例如,跟踪标志 3226 是一种常用的启动跟踪标志,可取消显示错误日志中的成功备份消息。For example, trace flag 3226 is a commonly used startup trace flag which suppresses successful backup messages in the error log. 跟踪标志经常用于诊断性能问题或调试存储过程或复杂的计算机系统,但 Microsoft 支持部门还可能建议将它们用于解决会对特定工作负载产生负面影响的行为。Trace flags are frequently used to diagnose performance issues or to debug stored procedures or complex computer systems, but they may also be recommended by Microsoft Support to address behavior that is negatively impacting a specific workload. 当按照指示使用时,所有记录的跟踪标志和 Microsoft 支持部门推荐的跟踪标志在生产环境中都完全受支持。All documented trace flags and those recommended by Microsoft Support are fully supported in a production environment when used as directed. 请注意,此列表中的跟踪标志在其特定用途方面可能会有一些其他注意事项,因此建议仔细查看此处和/或支持工程师提供的所有建议。Note that trace flags in this list may have additional considerations regarding their particular usage, so it is advisable to carefully review all the recommendations given here and/or by your support engineer. 此外,与 SQL Server 中的任何配置更改一样,最好在部署标志之前在非生产环境中全面测试该标志。Also, as with any configuration change in SQL Server, it is always best to thoroughly test the flag in a non-production environment before deploying.

RemarksRemarks

SQL ServerSQL Server 中,有三种跟踪标志:查询、会话和全局。In SQL ServerSQL Server, there are three types of trace flags: query, session and global. 查询跟踪标志在特定查询的上下文中处于活动状态。Query trace flags are active for the context of a specific query. 会话跟踪标志对某个连接有效,且只对该连接可见。Session trace flags are active for a connection and are visible only to that connection. 全局跟踪标志在服务器级别上进行设置,对服务器上的每一个连接都可见。Global trace flags are set at the server level and are visible to every connection on the server. 某些标志只能作为全局标志启用,而某些标志在全局或会话作用域都可以启用。Some flags can only be enabled as global, and some can be enabled at either global or session scope.

下列规则适用:The following rules apply:

  • 全局跟踪标志必须全局启用。A global trace flag must be enabled globally. 否则,跟踪标志无效。Otherwise, the trace flag has no effect. 建议在启动时通过使用 -T 命令行选项来启用全局跟踪标志。We recommend that you enable global trace flags at startup, by using the -T command line option. 这样可确保跟踪标志在服务器重新启动后保持活动状态。This ensures the trace flag remains active after a server restart. 若要让跟踪标志生效,请重启 SQL Server。Restart SQL Server for the trace flag to take effect.
  • 如果跟踪标志有全局、会话或查询作用域,则可以用合适的作用域来启用它。If a trace flag has either global, session or query scope, it can be enabled with the appropriate scope. 在会话级别启用的跟踪标志永远不会影响另一个会话,并且当打开会话的 SPID 注销时,该跟踪标志将失效。A trace flag that is enabled at the session level never affects another session, and the effect of the trace flag is lost when the SPID that opened the session logs out.

使用以下方法之一可将跟踪标志设置为开或关:Trace flags are set on or off by using either of the following methods:

  • 使用 DBCC TRACEON 和 DBCC TRACEOFF 命令。Using the DBCC TRACEON and DBCC TRACEOFF commands.
    例如,若要全局启用 2528 跟踪标志,请在使用 DBCC TRACEON 时使用 -1 参数:DBCC TRACEON (2528, -1)For example, to enable the 2528 trace flag globally, use DBCC TRACEON with the -1 argument: DBCC TRACEON (2528, -1). 重新启动服务器时,使用 DBCC TRACEON 启用全局跟踪标志的方法将失效。The effect of enabling a global trace flag with DBCC TRACEON is lost on server restart. 若要关闭全局跟踪标志,请在使用 DBCC TRACEOFF 时使用 -1 参数。To turn off a global trace flag, use DBCC TRACEOFF with the -1 argument.
  • 使用 -T 启动选项可以指定跟踪标志在启动期间设置为开。Using the -T startup option to specify that the trace flag be set on during startup.
    -T 启动选项会全局启用跟踪标志。The -T startup option enables a trace flag globally. 使用启动选项无法启动会话级别的跟踪标志。You cannot enable a session-level trace flag by using a startup option. 这样可确保跟踪标志在服务器重新启动后保持活动状态。This ensures the trace flag remains active after a server restart. 有关启动选项的详细信息,请参阅 数据库引擎服务启动选项For more information about startup options, see Database Engine Service Startup Options.
  • 在查询级别,通过使用 QUERYTRACEON 查询提示At the query level, by using the QUERYTRACEON query hint. QUERYTRACEON 选项只能用于上表中所述的查询优化器跟踪标志。The QUERYTRACEON option is only supported for Query Optimizer trace flags documented in the table above.

使用 DBCC TRACESTATUS 命令确定哪些跟踪标志当前是活动的。Use the DBCC TRACESTATUS command to determine which trace flags are currently active.

跟踪标志Trace flags

下表列出了 SQL ServerSQL Server 中可用的跟踪标志,并进行了说明。The following table lists and describes the trace flags that are available in SQL ServerSQL Server.

备注

Azure SQL 数据库托管实例支持以下全局跟踪标志:460、2301、2389、2390、2453、2467、7471、8207、9389、10316 和 11024。Azure SQL Database Managed Instance supports the following global Trace Flags: 460, 2301, 2389, 2390, 2453, 2467, 7471, 8207, 9389,1 0316, and 11024. 托管实例尚不支持会话跟踪标志。Session trace-flags are not yet supported in Managed Instance.

备注

特定的 SQL ServerSQL Server 版本中引入了一些跟踪标志。Some trace flags were introduced in specific SQL ServerSQL Server versions. 有关适用版本的详细信息,请参阅与特定跟踪标志关联的 Microsoft 支持文章。For more information on the applicable version, see the Microsoft Support article associated with a specific trace flag.

重要

SQL ServerSQL Server 的未来版本可能不支持跟踪标志行为。Trace flag behavior may not be supported in future releases of SQL ServerSQL Server.

跟踪标志Trace flag 描述Description
139139 当在兼容性级别较低的数据库上,针对特定数据类型分析兼容性级别 130 中引入的改进型精度和转换逻辑时,在 DBCC CHECKDBDBCC CHECKTABLEDBCC CHECKCONSTRAINTS 等 DBCC 检查命令的作用域中强制执行正确的转换语义。Forces correct conversion semantics in the scope of DBCC check commands like DBCC CHECKDB, DBCC CHECKTABLE and DBCC CHECKCONSTRAINTS, when analyzing the improved precision and conversion logic introduced with compatibility level 130 for specific data types, on a database that has a lower compatibility level. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) RTM CU3、SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) RTM CU3, SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 and higher builds.

警告 :不应在生产环境中连续启用跟踪标志 139,该标志只能用于执行此 Microsoft 支持文章中所述的数据库验证检查。WARNING: Trace flag 139 is not meant to be enabled continuously in a production environment, and should be used for the sole purpose of performing database validation checks described in this Microsoft Support article. 应在完成验证检查后立即禁用它。It should be immediately disabled after validation checks are completed.

作用域:仅全局Scope: global only
174174 在 64 位系统上将 SQL Server 数据库引擎SQL Server Database Engine计划缓存桶计数从 40,009 增加到 160,001。Increases the SQL Server 数据库引擎SQL Server Database Engine plan cache bucket count from 40,009 to 160,001 on 64-bit systems. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:仅全局Scope: global only
176176 在为包含已计算分区依据列的表联机重新生成分区时,启用修复以解决错误。Enables a fix to address errors when rebuilding partitions online for tables that contain a computed partitioning column. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局或会话Scope: global or session
205205 当由于自动更新统计信息而重新编译依赖于统计信息的存储过程时,向错误日志提交报告。Reports to the error log when a statistics-dependent stored procedure is being recompiled as a result of auto-update statistics. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
260260 打印有关扩展存储过程动态链接库 (DLL) 的版本控制信息。Prints versioning information about extended stored procedure dynamic-link libraries (DLLs). 有关 GetXpVersion() 的详细信息,请参阅创建扩展存储过程For more information about GetXpVersion(), see Creating Extended Stored Procedures.

作用域: 全局或会话Scope: global or session
272272 在服务器意外重新启动或故障转移到辅助服务器的情况下,禁用标识预分配以避免标识列的值出现差异。Disables identity pre-allocation to avoid gaps in the values of an identity column in cases where the server restarts unexpectedly or fails over to a secondary server. 请注意,标识缓存用于提高具有标识列的表的 INSERT 性能。Note that identity caching is used to improve INSERT performance on tables with identity columns.

注意: 从 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 开始,若要在数据库级别完成此操作,请参阅 ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) 中的 IDENTITY_CACHE 选项。Note: Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x), to accomplish this at the database level, see the IDENTITY_CACHE option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).

作用域:仅全局Scope: global only
460460 将数据截断消息 ID 8152 替换为消息 ID 2628Replaces data truncation message ID 8152 with message ID 2628. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2019 (15.x)SQL Server 2019 (15.x) CTP 2.4 起,若要在数据库级别完成此操作,请参阅 ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) 中的 VERBOSE_TRUNCATION_WARNINGS 选项。Starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x) CTP 2.4, to accomplish this at the database level, see the VERBOSE_TRUNCATION_WARNINGS option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).

注意: 此跟踪标志适用于 SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU12 及更高内部版本。Note: This trace flag applies to SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU12 and higher builds.

注意: 从数据库兼容性级别 150 开始,消息 ID 2628 为默认设置,此跟踪标志无效。Note: Starting with database compatibility level 150, message ID 2628 is the default and this trace flag has no effect.

作用域:全局或会话Scope: global or session
610610 控制对索引表进行的以最低限度记录的插入。Controls minimally logged inserts into indexed tables. 从 SQL Server 2016 开始,不需要此跟踪标志,因为对索引表默认启用了最低限度记录。This trace flag is not required starting SQL Server 2016 as minimal logging is turned on by default for indexed tables. 在 SQL Server 2016 中,当大容量加载操作导致分配一个新页面时,如果符合最低限度记录的其他所有先决条件,则会以最低限度记录按顺序填充该新页面的所有行。In SQL Server 2016, when the bulk load operation causes a new page to be allocated, all of the rows sequentially filling that new page are minimally logged if all the other pre-requisites for minimal logging are met. 为了维护索引顺序而插入到现有页面中的行(不分配新页面)仍以完整方式记录,这与在加载过程中由于页面拆分而移动的行一样。Rows inserted into existing pages (no new page allocation) to maintain index order are still fully logged, as are rows that are moved as a result of page splits during the load. 为索引启用 ALLOW_PAGE_LOCKS(默认启用)以便让最低限度记录操作正常工作也很重要,因为在分配期间会获取页锁,从而仅记录页面或盘区分配。有关详细信息,请参阅数据加载性能指南It is also important to have ALLOW_PAGE_LOCKS turned ON for indexes (which is ON by default) for minimal logging operation to work as page locks are acquired during allocation and thereby only page or extent allocations are logged.For more information, see Data Loading Performance Guide.

作用域:全局或会话Scope: global or session
634634 禁用背景列存储压缩任务。Disables the background columnstore compression task. SQL ServerSQL 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. 通过用跟踪标志 634 禁用后台压缩任务,然后随时显式调用 ALTER INDEX...REORGANIZE 或 ALTER INDEX...REBUILD,可以手动控制列存储压缩计时。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.

作用域: 仅全局Scope: global only
652652 禁用页面预提取扫描。Disables page pre-fetching scans. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局或会话Scope: global or session
661661 禁用虚影记录删除进程。Disables the ghost record removal process. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
692692 将数据大容量加载到堆或聚集索引时禁用快速插入。Disables fast inserts while bulk loading data into heap or clustered index. SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,默认情况下会启用快速插入,以便在数据库处于简单或大容量日志恢复模式时,利用最低限度记录来优化插入新页面的记录的插入性能。Starting SQL Server 2016 (13.x)SQL Server 2016 (13.x), fast inserts is enabled by default leveraging minimal logging when database is in simple or bulk logged recovery model to optimize insert performance for records inserted into new pages. 启用快速插入后,每个大容量加载批次都会绕过现有盘区的分配查找获得新盘区,从而提供可用空间来优化插入性能。With fast inserts, each bulk load batch acquires new extent(s) bypassing the allocation lookup for existing extent with available free space to optimize insert performance.

启用快速插入后,批次较小的大容量加载会导致对象占用的未用空间增加,因此建议每次都使用较大的批次,以便完全填充盘区。With fast inserts, bulk loads with small batch sizes can lead to increased unused space consumed by objects hence it is recommended to use large batchsize for each batch to fill the extent completely. 如果增加批次大小不可行,此跟踪标志可以帮助减少以性能为代价保留的未用空间。If increasing batchsize is not feasible, this trace flag can help reduce unused space reserved at the expense of performance.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) RTM 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) RTM and higher builds.

作用域:全局或会话Scope: global or session
715715 为没有非聚集索引的堆中的大容量加载操作启用表锁。Enables table lock for bulk load operations into a heap with no nonclustered indexes. 启用此跟踪标志时,大容量加载操作会在将数据大容量复制到表中时获取大容量更新锁(BU 锁)。When this trace flag is enabled, bulk load operations acquire bulk update (BU) locks when bulk copying data into a table. 大容量更新锁(BU 锁)允许多个线程将数据并发地大容量加载到同一表中,同时防止其他不进行数据大容量加载的进程访问该表。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.

该行为与以下行为类似:用户在执行大容量加载时显式指定 TABLOCK 提示,或为给定表启用大容量加载的 sp_tableoption 表锁。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.

作用域: 全局或会话Scope: global or session
834834 对缓冲池、列存储和内存中表使用大型页分配。Uses large-page allocations for the buffer pool, columnstore, and in-memory tables. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 启用时,大型页内存模型会在实例启动时预分配所有 SQLOS 内存,并且不会将该内存返回到操作系统。Note: When enabled, the large-page memory model pre-allocates all SQLOS memory at instance startup and does not return that memory to the OS.

注意: 如果正在使用 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL ServerSQL Server 的列存储索引功能,则不建议启用跟踪标志 834。Note: If you are using the Columnstore Index feature of SQL Server 2012 (11.x)SQL Server 2012 (11.x) to SQL ServerSQL Server, we do not recommend turning on trace flag 834.

作用域:仅全局Scope: global only
845845 SQL ServerSQL Server 的服务帐户启用了“锁定内存页”特权时,启用 SQL ServerSQL Server 标准 SKU 上的锁定页。Enables locked pages on Standard SKUs of SQL ServerSQL Server, when the service account for SQL ServerSQL Server has the Lock Pages in Memory privilege enabled. 有关详细信息,请参阅此 Microsoft 支持文章以及“服务器内存”服务器配置选项文档页。For more information, see this Microsoft Support article and the documentation page on Server Memory Server Configuration Options.

注意: 从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 开始,将为标准 SKU 默认启用此行为,并且不得使用跟踪标志 845。Note: Starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x) this behavior is enabled by default for Standard SKUs, and trace flag 845 must not be used.

作用域:仅全局Scope: global only
902902 安装累积更新或 Service Pack 时不执行数据库升级脚本。Bypasses execution of database upgrade script when installing a Cumulative Update or Service Pack. 如果在脚本升级模式下遇到错误,建议联系 Microsoft SQL 客户服务和支持 (CSS) 获取进一步指导。If you encounter an error during script upgrade mode, it is recommended to contact Microsoft SQL Customer Service and Support (CSS) for further guidance. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

警告 :此跟踪标志用于在脚本升级模式下对失败更新进行故障排除,不支持在生产环境中连续运行该标志。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. 需要成功执行数据库升级脚本才能完整安装累积更新和 Service Pack。Database upgrade scripts needs to execute successfully for a complete install of Cumulative Updates and Service Packs. 不这样做可能会导致 SQL ServerSQL Server 实例出现意外问题。Not doing so can cause unexpected issues with your SQL ServerSQL Server instance.

作用域:仅全局Scope: global only
11171117 当文件组中的某个文件达到自动增长阈值时,文件组中的所有文件都会增长。When a file in the filegroup meets the autogrow threshold, all files in the filegroup grow. 此跟踪标志将影响所有数据库,建议仅在每个数据库都可以安全地将文件组中的所有文件增大相同量时才使用。This trace flag affects all databases and is recommended only if every database is safe to be grow all files in a filegroup by the same amount.

注意:SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由 ALTER DATABASE 的 AUTOGROW_SINGLE_FILE 和 AUTOGROW_ALL_FILES 选项控制,跟踪标志 1117 不再有效。Note: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the AUTOGROW_SINGLE_FILE and AUTOGROW_ALL_FILES option of ALTER DATABASE, and trace flag 1117 has no effect. 有关详细信息,请参阅 ALTER DATABASE 文件和文件组选项 (Transact-SQL)For more information, see ALTER DATABASE File and Filegroup Options (Transact-SQL).

作用域: 仅全局Scope: global only
11181118 强制在统一区而不是混合区分配页,以减少 SGAM 页的争用。Forces page allocations on uniform extents instead of mixed extents, reducing contention on the SGAM page. 创建新对象后,默认情况下,将从不同的盘区(混合区)分配前 8 页。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). SGAM 页用于跟踪这些混合区,因此发生大量混合页分配时,可能会很快成为瓶颈。The SGAM page is used to track these mixed extents, so can quickly become a bottleneck when numerous mixed page allocations are occurring. 创建新对象时,此跟踪标志从相同的片区分配所有 8 页,以最大限度降低扫描 SGAM 页的需求。This trace flag allocates all eight pages from the same extent when creating new objects, minimizing the need to scan the SGAM page. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由 ALTER DATABASE 的 SET MIXED_PAGE_ALLOCATION 选项控制,跟踪标志 1118 不再有效。Note: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the SET MIXED_PAGE_ALLOCATION option of ALTER DATABASE, and trace flag 1118 has no effect. 有关详细信息,请参阅 ALTER DATABASE SET 选项 (Transact-SQL)For more information, see ALTER DATABASE SET Options (Transact-SQL).

作用域: 仅全局Scope: global only
12041204 返回参与死锁的锁的资源和类型,以及受影响的当前命令。Returns the resources and types of locks participating in a deadlock and also the current command affected. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域: 仅全局Scope: global only
12111211 基于内存不足或基于锁数禁用锁升级。Disables lock escalation based on memory pressure, or based on number of locks. SQL Server 数据库引擎SQL Server Database Engine不会将行锁或页锁升级到表锁。The SQL Server 数据库引擎SQL Server Database Engine will not escalate row or page locks to table locks.

使用此跟踪标志可能会生成过多的锁,如果锁内存增长得足够大,则尝试为任何查询分配其他锁可能会失败。Using this trace flag can generate excessive number of locks and if the lock memory grows large enough, attempts to allocate additional locks for any query may fail. 这样会降低数据库引擎Database Engine的性能,或因为内存不足而导致 1204 错误(无法分配锁资源)。This can slow the performance of the 数据库引擎Database Engine, or cause 1204 errors (unable to allocate lock resource) because of insufficient memory.

如果同时设置了跟踪标志 1211 和 1224,则 1211 优先于 1224。If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224. 但是,由于在所有情况下(甚至在内存紧张的情况下)跟踪标志 1211 都禁止升级,因此建议改用 1224。However, because trace flag 1211 prevents escalation in every case, even under memory pressure, we recommend that you use 1224 instead. 这有助于在使用多个锁时避免“锁不足”错误。This helps avoid "out-of-locks" errors when many locks are being used.

有关如何解决 SQL ServerSQL Server 中的锁升级导致的阻塞问题的详细信息,请参阅此 Microsoft 支持文章For more information on how to resolve blocking problems that are caused by lock escalation in SQL ServerSQL Server, see this Microsoft Support Article.

作用域:全局或会话Scope: global or session
12221222 以不符合任何 XSD 架构的 XML 格式,返回参与死锁的锁的资源和类型,以及受影响的当前命令。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.

作用域:仅全局Scope: global only
12241224 基于锁数禁用锁升级。Disables lock escalation based on the number of locks. 但是,内存不足仍可激活锁升级。However, memory pressure can still activate lock escalation. 如果锁对象使用的内存量超出下列条件之一,数据库引擎Database Engine会将行锁或页锁升级为表(或分区)锁: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:
  • 数据库引擎Database Engine占用的 40% 的内存。Forty percent of the memory that is used by 数据库引擎Database Engine. 只有在 sp_configure 的 locks 参数设置为 0 时,这才适用。This is applicable only when the locks parameter of sp_configure is set to 0.
  • 使用 sp_configure 的 locks 参数配置的锁内存的 40% 。Forty percent of the lock memory that is configured by using the locks parameter of sp_configure. 有关详细信息,请参阅 服务器配置选项 (SQL Server)版本的组合自动配置的最大工作线程数。For more information, see Server Configuration Options (SQL Server).

如果同时设置了跟踪标志 1211 和 1224,则 1211 优先于 1224。If both trace flag 1211 and 1224 are set, 1211 takes precedence over 1224. 但是,由于在所有情况下(甚至在内存紧张的情况下)跟踪标志 1211 都禁止升级,因此建议使用 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.

注意: 也可以使用 ALTER TABLE 语句的 LOCK_ESCALATION 选项控制到表级或 HoBT 级粒度的锁升级。Note: Lock escalation to the table-level or HoBT-level granularity can also be controlled by using the LOCK_ESCALATION option of the ALTER TABLE statement.

有关如何解决 SQL ServerSQL Server 中的锁升级导致的阻塞问题的详细信息,请参阅此 Microsoft 支持文章For more information on how to resolve blocking problems that are caused by lock escalation in SQL ServerSQL Server, see this Microsoft Support Article

作用域: 全局或会话Scope: global or session
1229 1229 禁用所有锁定分区,而不管 CPU 数如何。Disables all lock partitioning regardless of the number of CPUs. 默认情况下,SQL ServerSQL Server 在服务器具有 16 个或更多 CPU 时启用锁定分区,以提高较大系统的可伸缩性特征。By default, SQL ServerSQL Server enables lock partitioning when a server has 16 or more CPUs, to improve the scalability characteristics of larger systems. 有关锁定分区的详细信息,请参阅事务锁定和行版本控制指南For more information on lock partitioning, see the Transaction Locking and Row Versioning Guide.

警告 :转换分区时,跟踪标志 1229 会导致旋转锁争用和性能不佳或意外行为。WARNING: Trace flag 1229 can cause spinlock contention and poor performance, or unexpected behaviors when switching partitions.

作用域:仅全局Scope: global only
12361236 启用数据库锁分区。Enables database lock partitioning. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) SP3 和 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 开始,此行为由引擎控制,跟踪标志 1236 不再有效。Note: Starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x) SP3 and SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 this behavior is controlled by the engine and trace flag 1236 has no effect.

作用域:仅全局Scope: global only
12371237 允许 ALTER PARTITION FUNCTION 语句遵从用户定义的当前会话死锁优先级,而不是成为默认情况下可能的死锁牺牲品。Allows the ALTER PARTITION FUNCTION statement to honor the current user-defined session deadlock priority instead of being the likely deadlock victim by default. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 和数据库兼容性级别 140 开始,该行为变成默认行为,跟踪标志 1237 不再有效。Note: Starting with SQL Server 2017 (14.x)SQL Server 2017 (14.x) and database compatibility level 140 this is the default behavior and trace flag 1237 has no effect.

作用域:全局、会话或查询Scope: global or session or query
12601260 禁用计划程序监视器转储。Disable scheduler monitor dumps.

作用域:仅全局Scope: global only
14481448 甚至在异步辅助数据库不确认接受更改的情况下,也使复制日志读取器前移。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. 此跟踪标志应用于 SQL ServerSQL Server 的实例,而不仅是可用性组、可用性数据库或日志读取器实例。This trace flag applies to the instance of SQL ServerSQL 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. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
14621462 对异步可用性组禁用日志流压缩。Disables log stream compression for asynchronous availability groups. 默认情况下,对异步可用性组启用此功能,以优化网络带宽。This feature is enabled by default on asynchronous availability groups in order to optimize network bandwidth. 有关详细信息,请参阅 Tune compression for availability group(调整可用性组的压缩)。For more information, see Tune compression for availability group.

作用域:仅全局Scope: global only
18001800 SQL ServerSQL Server Always On 和日志传送环境中,当主副本和次要副本日志文件使用扇区大小不同的磁盘时,启用 SQL ServerSQL Server 优化。Enables SQL ServerSQL Server optimization when disks of different sector sizes are used for primary and secondary replica log files, in SQL ServerSQL Server Always On and Log Shipping environments. 只需在符合以下条件的 SQL Server 实例上启用此跟踪标志:事务日志文件驻留在扇区大小为 512 字节的磁盘上。This trace flag is only required to be enabled on SQL Server instances with transaction log file residing on disk with sector size of 512 bytes. 需在扇区大小为 4k 的磁盘上启用。It is not required to be enabled on disk with 4k sector sizes. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域: 仅全局Scope: global only
23012301 启用高级决策支持优化。Enable advanced decision support optimizations. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局、会话和查询Scope: global and session and query
23122312 将查询优化器基数估计模型设置为 SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL ServerSQL Server 版本,而不考虑数据库兼容性级别。Sets the query optimizer cardinality estimation model to the SQL Server 2014 (12.x)SQL Server 2014 (12.x) through SQL ServerSQL Server versions, dependent of the compatibility level of the database.

注意: 如果数据库兼容性级别低于 120,则启用跟踪标志 2312 将使用基数估计模型 SQL Server 2014 (12.x)SQL Server 2014 (12.x) (120)。Note: If the database compatibility level is lower than 120, enabling trace flag 2312 uses the cardinality estimation model of SQL Server 2014 (12.x)SQL Server 2014 (12.x) (120). 有关详细信息,请参阅 Microsoft 支持文章For more information, see Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT FORCE_DEFAULT_CARDINALITY_ESTIMATION 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'FORCE_DEFAULT_CARDINALITY_ESTIMATION' query hint instead of using this trace flag.

作用域:全局、会话或查询Scope: global or session or query
23352335 导致 SQL ServerSQL Server 在查询优化期间假定有固定数量的内存可用。Causes SQL ServerSQL Server to assume a fixed amount of memory is available during query optimization. 它不限制 SQL ServerSQL Server 授予用来执行查询的内存。It does not limit the memory SQL ServerSQL Server grants to execute the query. SQL ServerSQL Server 配置的内存仍将由数据缓存、查询执行和其他使用者使用。The memory configured for SQL ServerSQL Server will still be used by data cache, query execution and other consumers. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局、会话或查询Scope: global or session or query
23402340 导致 SQL ServerSQL Server 在生成计划时不对优化的嵌套循环联接使用排序操作(批排序)。Causes SQL ServerSQL Server not to use a sort operation (batch sort) for optimized Nested Loops joins when generating a plan. 默认情况下,在查询优化器断定很有可能不需要排序,但在基数或成本估算不正确的情况下仍有可能时,SQL ServerSQL Server 可使用经过优化的嵌套循环联接,而不是使用完全扫描或显式排序的嵌套循环联接。By default, SQL ServerSQL Server can use an optimized Nested Loops join instead of a full scan or a Nested Loops join with an explicit Sort, when the Query Optimizer concludes that a sort is most likely not required, but still a possibility in the event that the cardinality or cost estimates are incorrect. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT DISABLE_OPTIMIZED_NESTED_LOOP 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'DISABLE_OPTIMIZED_NESTED_LOOP' query hint instead of using this trace flag.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局、会话或查询Scope: global or session or query
23712371 将固定更新统计信息阈值更改为线性更新统计信息阈值。Changes the fixed update statistics threshold to a linear update statistics threshold. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意:SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,在数据库兼容性级别 130 或更高版本下,此行为由引擎控制,跟踪标志 2371 不再有效。Note: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) and under the database compatibility level 130 or above, this behavior is controlled by the engine and trace flag 2371 has no effect.

作用域:仅全局Scope: global only
23892389 为升序键启用自动生成的快速统计信息(直方图修正)。Enable automatically generated quick statistics for ascending keys (histogram amendment). 如果设置了跟踪标志 2389,并且将前导统计信息列标记为升序,则会在查询编译时调整用于估计基数的直方图。If trace flag 2389 is set, and a leading statistics column is marked as ascending, then the histogram used to estimate cardinality will be adjusted at query compile time. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

注意: 此跟踪标志不适用于 CE 版本 120 或更高版本。Note: This trace flag does not apply to CE version 120 or above. 请改用跟踪标志 4139。Use trace flag 4139 instead.

作用域:全局、会话或查询Scope: global or session or query
23902390 为升序键或未知键启用自动生成的快速统计信息(直方图修正)。Enable automatically generated quick statistics for ascending or unknown keys (histogram amendment). 如果设置了跟踪标志 2390,并且将前导统计信息列标记为升序或未知,则会在查询编译时调整用于估计基数的直方图。If trace flag 2390 is set, and a leading statistics column is marked as ascending or unknown, then the histogram used to estimate cardinality will be adjusted at query compile time. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

注意: 此跟踪标志不适用于 CE 版本 120 或更高版本。Note: This trace flag does not apply to CE version 120 or above. 请改用跟踪标志 4139。Use trace flag 4139 instead.

作用域:全局、会话或查询Scope: global or session or query
24222422 当超过 Resource Governor REQUEST_MAX_CPU_TIME_SEC 配置设置的最长时间时,允许 SQL Server 数据库引擎SQL Server Database Engine中止请求。Enables the SQL Server 数据库引擎SQL Server Database Engine to abort a request when the maximum time set by Resource Governor REQUEST_MAX_CPU_TIME_SEC configuration is exceeded. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2、SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2, SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3, and higher builds.

作用域:全局Scope: global
24302430 启用备用锁类清除。Enables alternate lock class cleanup. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
24512451 在 sys.dm_exec_query_plan_stats 中启用最后一个实际执行计划的等效项。Enables the equivalent of the last actual execution plan in sys.dm_exec_query_plan_stats.

注意: 此跟踪标志适用于 SQL Server 2019 (15.x)SQL Server 2019 (15.x) CTP 2.4 及更高版本。Note: This trace flag applies to SQL Server 2019 (15.x)SQL Server 2019 (15.x) CTP 2.4 and higher builds.

注意:SQL Server 2019 (15.x)SQL Server 2019 (15.x) CTP 2.5 起,若要在数据库级别完成此操作,请参阅 ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) 中的 LAST_QUERY_PLAN_STATS 选项。Note: Starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x) CTP 2.5, to accomplish this at the database level, see the LAST_QUERY_PLAN_STATS option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).

作用域:仅全局Scope: global only
24532453 当足够数量的行发生更改时,允许表变量触发重新编译。Allows a table variable to trigger recompile when enough number of rows are changed. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局、会话或查询Scope: global or session or query
24672467 启用备用并行工作线程分配策略(基于哪个节点具有最少分配的线程)。Enables an alternate parallel worker thread allocation policy, based on which node has the least allocated threads. 有关详细信息,请参阅并行查询处理For more information, see Parallel Query Processing. 请参阅配置最大工作线程服务器配置选项,了解有关配置最大工作线程服务器选项的信息。Refer to Configure the max worker threads Server Configuration Option for information on configuring the max worker threads server option.

注意: 并行查询度 (DOP) 必须适用于要使用的此备用策略的单个节点,或改为使用默认线程分配策略。Note: Query degree of parallelism (DOP) has to fit into a single node for this alternate policy to be used, or the default thread allocation policy is used instead. 使用跟踪标志时,不建议执行指定 DOP 多于单个节点中的计划程序数的查询,因为这会干扰指定 DOP 低于或等于单个节点中的计划程序数的查询。Using this trace flag, it is not recommended to execute queries specifying a DOP over the number of schedulers in a single node, as this could interfere with queries specifying a DOP below or equal to the number of schedulers in a single node.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:仅全局Scope: global only
24692469 为已分区列存储索引中的 INSERT INTO ... SELECT 启用备用 Exchange。Enables alternate exchange for INSERT INTO ... SELECT into a partitioned columnstore index. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局、会话或查询Scope: global or session or query
25282528 禁用 DBCC CHECKDB、DBCC CHECKFILEGROUP 和 DBCC CHECKTABLE 执行的对象并行检查。Disables parallel checking of objects by DBCC CHECKDB, DBCC CHECKFILEGROUP, and DBCC CHECKTABLE. 默认情况下,并行度由查询处理器自动确定。By default, the degree of parallelism is automatically determined by the query processor. 最大并行度的配置就像并行查询的最大并行度一样。The maximum degree of parallelism is configured just like that of parallel queries. 有关详细信息,请参阅 配置 max degree of parallelism 服务器配置选项For more information, see Configure the max degree of parallelism Server Configuration Option.

注意: 通常应启用(默认设置)并行 DBCC 检查。Note: Parallel DBCC checks should typically be enabled (default). 查询处理器会对 DBCC CHECKDB 检查的每个表或每批表重新求值并自动调整并行度。The query processor reevaluates and automatically adjusts parallelism for each table or batch of tables checked by DBCC CHECKDB.

典型的使用场景为:系统管理员知道在 DBCC CHECKDB 完成之前服务器负载会增加,因此选择手动减少或禁用并行操作,以便增加与其他用户工作负载的并发。The typical use scenario is when a system administrator knows that server load will increase before DBCC CHECKDB completes, and so chooses to manually decrease or disable parallelism, in order to increase concurrency with other user workload. 但是,禁用 DBCC CHECKDB 中的并行检查会延长其完成时间。However, disabling parallel checks in DBCC CHECKDB can cause it to take longer to complete.

注意: 如果使用 TABLOCK 选项执行 DBCC CHECKDB 并禁用并行操作,则可能会将表锁定较长时间。Note: If DBCC CHECKDB is executed using the TABLOCK option and parallelism is disabled, tables may be locked for longer periods of time.

注意:SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 开始,可以在 DBCC 语句中使用 MAXDOP 选项来替代 sp_configure 的 max degree of parallelism 配置选项。Note: Starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2, a MAXDOP option is available to override the max degree of parallelism configuration option of sp_configure for the DBCC statements.

作用域:全局或会话Scope: global or session
25492549 强制 DBCC CHECKDB 命令假设每个数据库文件位于唯一的磁盘驱动器上,但将不同物理文件视为一个逻辑文件。Forces the DBCC CHECKDB command to assume each database file is on a unique disk drive but treating different physical files as one logical file. DBCC CHECKDB 命令根据唯一磁盘驱动器跨所有数据库文件生成一个待读取页面内部列表。DBCC CHECKDB command builds an internal list of pages to read per unique disk drive across all database files. 此逻辑根据每个文件的物理文件名的驱动器号确定唯一磁盘驱动器。This logic determines unique disk drives based on the drive letter of the physical file name of each file.

注意: 除非知道每个文件都基于唯一的物理磁盘,否则不要使用此跟踪标志。Note: Do not use this trace flag unless you know that each file is based on a unique physical disk.

注意: 尽管此跟踪标志改进了以使用 PHYSICAL_ONLY 选项为目标的 DBCC CHECKDB 命令的性能,但一些用户可能还是看不到性能有任何改进。Note: Although this trace flag improve the performance of the DBCC CHECKDB commands which target usage of the PHYSICAL_ONLY option, some users may not see any improvement in performance. 虽然此跟踪标志可以改善磁盘 I/O 资源的使用情况,但磁盘资源的基本性能可能会限制 DBCC CHECKDB 命令的整体性能。While this trace flag improves disk I/O resources usage, the underlying performance of disk resources may limit the overall performance of the DBCC CHECKDB command. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
25622562 无论数据库中有多少个索引,都以单个“批次”运行 DBCC CHECKDB 命令。Runs the DBCC CHECKDB command in a single "batch" regardless of the number of indexes in the database. 默认情况下,DBCC CHECKDB 命令会尝试通过以下方式最大限度地减少 TempDB 资源:限制使用“批次”概念生成的索引或“事实”的数量。By default, the DBCC CHECKDB command tries to minimize TempDB resources by limiting the number of indexes or "facts" that it generates by using a "batches" concept. 但此跟踪标志强制在一个批次中执行所有处理。But this trace flag forces all processing into one batch.

使用此跟踪标志的一个效果是 TempDB 的空间需求可能会增加。One effect of using this trace flag is that the space requirements for TempDB may increase. TempDB 可能会增长到 DBCC CHECKDB 命令正在处理的用户数据库的 5% 或更多。TempDB may grow to as much as 5% or more of the user database that is being processed by the DBCC CHECKDB command.

注意: 尽管此跟踪标志改进了以使用 PHYSICAL_ONLY 选项为目标的 DBCC CHECKDB 命令的性能,但一些用户可能还是看不到性能有任何改进。Note: Although this trace flag improve the performance of the DBCC CHECKDB commands which target usage of the PHYSICAL_ONLY option, some users may not see any improvement in performance. 虽然此跟踪标志可以改善磁盘 I/O 资源的使用情况,但磁盘资源的基本性能可能会限制 DBCC CHECKDB 命令的整体性能。While this trace flag improves disk I/O resources usage, the underlying performance of disk resources may limit the overall performance of the DBCC CHECKDB command. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
25662566 在未指定 DATA_PURITY 选项的情况下,运行 DBCC CHECKDB 命令而不检查数据纯度。Runs the DBCC CHECKDB command without data purity check unless the DATA_PURITY option is specified.

注意: 默认情况下将启用列值完整性检查,并且不需要使用 DATA_PURITY 选项。Note: Column-value integrity checks are enabled by default and do not require the DATA_PURITY option. 对于从 SQL Server 的早期版本升级的数据库,默认情况下不启用列值检查,直到 DBCC CHECKDB WITH DATA_PURITY 已在数据库中正确运行至少一次为止。For databases upgraded from earlier versions of SQL Server, column-value checks are not enabled by default until DBCC CHECKDB WITH DATA_PURITY has been run error free on the database at least once. 然后,DBCC CHECKDB 将默认检查列值完整性。After this, DBCC CHECKDB checks column-value integrity by default. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
25922592 与跟踪标志 3656 结合使用时,如果安装了适用于 Windows 的调试工具,在堆栈转储上启用符号解析。When used in conjunction with trace flag 3656, enables symbol resolution on stack dumps when the Debugging Tools for Windows are installed. 有关详细信息,请参阅 Microsoft 白皮书For more information, see this Microsoft Whitepaper.

警告 :这是调试跟踪标志,不用于生产环境。WARNING: This is a debugging trace flag and not meant for production environment use.

注意: 此跟踪标志适用于 SQL Server 2019 (15.x)SQL Server 2019 (15.x) 及更高内部版本。Note: This trace flag applies to SQL Server 2019 (15.x)SQL Server 2019 (15.x) and higher builds.

作用域:全局和会话Scope: global and session
30233023 启用 CHECKSUM 选项作为 BACKUP 命令的默认选项。Enables CHECKSUM option as default for BACKUP command. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2014 (12.x)SQL Server 2014 (12.x) 开始,可通过设置 backup checksum default 配置选项来控制此行为 。Note: Starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x) this behavior is controlled by setting the backup checksum default configuration option. 有关详细信息,请参阅 服务器配置选项 (SQL Server)版本的组合自动配置的最大工作线程数。For more information, see Server Configuration Options (SQL Server).

作用域:全局和会话Scope: global and session
30423042 绕过默认的备份压缩预先分配算法,以便允许备份文件仅根据需要增长以达到其最终大小。Bypasses the default backup compression pre-allocation algorithm to allow the backup file to grow only as needed to reach its final size. 如果您需要仅分配压缩的备份所需的实际大小以便节约空间,则此跟踪标志将很有用。This trace flag is useful if you need to save on space by allocating only the actual size required for the compressed backup. 使用此跟踪标志可能会导致轻微的性能损失(在备份操作期间损失可能会增加)。Using this trace flag might cause a slight performance penalty (a possible increase in the duration of the backup operation). 有关预先分配算法的详细信息,请参阅备份压缩 (SQL Server)For more information about the pre-allocation algorithm, see Backup Compression (SQL Server).

作用域:仅全局Scope: global only
30513051 允许将“SQL Server 备份到 URL”记录到特定的错误日志文件中。Enables SQL Server Backup to URL logging to a specific error log file. 有关详细信息,请参阅 SQL Server 备份到 URL 最佳实践和故障排除For more information, see SQL Server Backup to URL Best Practices and Troubleshooting.

作用域:仅全局Scope: global only
32053205 默认情况下,如果磁带机支持硬件压缩,则 DUMP 或 BACKUP 语句会使用该功能。By default, if a tape drive supports hardware compression, either the DUMP or BACKUP statement uses it. 利用此跟踪标志,可以禁用磁带机的硬件压缩。With this trace flag, you can disable hardware compression for tape drivers. 此选项在您需要与不支持压缩的其他站点或磁带机交换磁带时很有用。This is useful when you want to exchange tapes with other sites or tape drives that do not support compression.

作用域:全局或会话Scope: global or session
32263226 默认情况下,每个成功的备份操作都会在 SQL ServerSQL Server 错误日志和系统事件日志中添加一个条目。By default, every successful backup operation adds an entry in the SQL ServerSQL Server error log and in the system event log. 如果非常频繁地创建日志备份,这些成功消息会迅速累积,从而产生一个巨大的错误日志,使查找其他消息变得非常困难。If you create very frequent log backups, these success messages accumulate quickly, resulting in huge error logs in which finding other messages is problematic.

使用这一跟踪标志,可以取消这些日志条目。With this trace flag, you can suppress these log entries. 如果您频繁地运行日志备份,并且没有任何脚本依赖于这些条目,则这种做法非常有用。This is useful if you are running frequent log backups and if none of your scripts depend on those entries.

作用域:仅全局Scope: global only
34273427 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 中,如果多个将数据插入临时表的连续事务占用的 CPU 比在 SQL Server 2014 (12.x)SQL Server 2014 (12.x) 中时更多,则启用修复来解决问题。Enables fix for issue when many consecutive transactions insert data into temp tables in SQL Server 2016 (13.x)SQL Server 2016 (13.x) where this operation consumes more CPU than in SQL Server 2014 (12.x)SQL Server 2014 (12.x). 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 CU2 到 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2 CU2。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 CU2 through SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2 CU2. SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2 CU3 和 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 开始,此跟踪标志不再有效。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2 CU3 and SQL Server 2017 (14.x)SQL Server 2017 (14.x), this trace flag has no effect.

作用域:仅全局Scope: global only
34593459 禁用并行重做。Disables parallel redo. 有关详细信息,请参阅此 Microsoft 支持文章Microsoft 支持文章For more information, see this Microsoft Support article and Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x)SQL Server 2017 (14.x)SQL Server 2017 (14.x) 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x), SQL Server 2017 (14.x)SQL Server 2017 (14.x), and higher builds.

作用域:仅全局Scope: global only
34683468 禁用 TempDB 上的间接检查点Disables indirect checkpoints on TempDB.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 CU5、SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU1 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 CU5, SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU1 and higher builds.

作用域:仅全局Scope: global only
36083608 禁止 SQL ServerSQL Server 自动启动和恢复除 master 数据库之外的任何数据库。Prevents SQL ServerSQL Server from automatically starting and recovering any database except the master database. 如果已启动要求使用 TempDB 的活动,则会恢复 model,并创建 TempDB 。If activities that require TempDB are initiated, then model is recovered and TempDB is created. 在访问数据库时将启动并恢复其他数据库。Other databases will be started and recovered when accessed. 可能无法运行某些功能,如快照隔离和读提交快照。Some features, such as snapshot isolation and read committed snapshot, might not work. 用于移动系统数据库移动用户数据库.Use for Move System Databases and Move User Databases.

注意: 请不要在正常操作中使用。Note: Do not use during normal operation.

作用域:仅全局Scope: global only
36253625 通过使用“******”屏蔽某些错误消息的参数,限制返回给不是 sysadmin 固定服务器角色成员的用户的信息量。Limits the amount of information returned to users who are not members of the sysadmin fixed server role, by masking the parameters of some error messages using '******'. 这可以帮助阻止披露敏感信息。This can help prevent disclosure of sensitive information.

作用域:仅全局Scope: global only
36563656 若安装了适用于 Windows 的调试工具,在堆栈转储上启用符号解析。Enables symbol resolution on stack dumps when the Debugging Tools for Windows are installed. 有关详细信息,请参阅 Microsoft 白皮书For more information, see this Microsoft Whitepaper.

警告 :这是调试跟踪标志,不用于生产环境。WARNING: This is a debugging trace flag and not meant for production environment use.

注意:SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始,必须与跟踪标志 3656 一起启用跟踪标志 2592 才能启用符号解析。Note: Starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x), trace flag 2592 must be enabled in conjunction with trace flag 3656 to enable symbol resolution.

作用域:全局和会话Scope: global and session
41364136 除非使用 OPTION(RECOMPILE)、WITH RECOMPILE 或 OPTIMIZE FOR <value>,否则禁用参数探查。Disables parameter sniffing unless OPTION(RECOMPILE), WITH RECOMPILE or OPTIMIZE FOR <value> is used. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,若要在数据库级别完成此操作,请参阅 ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) 中的 PARAMETER_SNIFFING 选项。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x), to accomplish this at the database level, see the PARAMETER_SNIFFING option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).

若要在查询级别实现相同结果,请添加 OPTIMIZE FOR UNKNOWN 查询提示To accomplish the same result at the query level, add the OPTIMIZE FOR UNKNOWN query hint. OPTIMIZE FOR UNKNOWN 提示不会禁用参数探查机制,但会有效地绕过它以实现相同的预期结果。The OPTIMIZE FOR UNKNOWN hint doesn't disable the parameter sniffing mechanism, but effectively bypasses it to achieve the same intended result.
SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,在查询级别完成此操作的另一种方法是添加 USE HINT 'DISABLE_PARAMETER_SNIFFING' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, a second option to accomplish this at the query level is to add the USE HINT 'DISABLE_PARAMETER_SNIFFING' query hint instead of using this trace flag.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局或会话Scope: global or session
41374137 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 和更早版本 (70) 的查询优化器基数估计模型下估计筛选器的 AND 谓词以说明部分相关性而不是独立性时,导致 SQL ServerSQL Server 使用最小选择性生成一个计划。Causes SQL ServerSQL Server to generate a plan using minimum selectivity when estimating AND predicates for filters to account for partial correlation instead of independence, under the query optimizer cardinality estimation model of SQL Server 2012 (11.x)SQL Server 2012 (11.x) and earlier versions (70). 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请在使用 CE 70 时添加 USE HINT 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' query hint instead of using this trace flag when using the CE 70.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

注意: 此跟踪标志不适用于 CE 版本 120 或更高版本。Note: This trace flag does not apply to CE version 120 or above. 请改用跟踪标志 9471。Use trace flag 9471 instead.

作用域:全局、会话或查询Scope: global or session or query
41384138 导致 SQL ServerSQL Server 生成一个计划,该计划不对包含 TOP、OPTION (FAST N)、IN 或 EXISTS 关键字的查询使用行目标调整。Causes SQL ServerSQL Server to generate a plan that does not use row goal adjustments with queries that contain TOP, OPTION (FAST N), IN, or EXISTS keywords. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT 'DISABLE_OPTIMIZER_ROWGOAL' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'DISABLE_OPTIMIZER_ROWGOAL' query hint instead of using this trace flag.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局、会话或查询Scope: global or session or query
41394139 无论键列处于什么状态,均启用自动生成的快速统计信息(直方图修正)。Enable automatically generated quick statistics (histogram amendment) regardless of key column status. 如果设置了跟踪标志 4139,则无论前导统计信息列处于什么状态(升序、降序或静止),都会在查询编译时调整用于估计基数的直方图。If trace flag 4139 is set, regardless of the leading statistics column status (ascending, descending, or stationary), the histogram used to estimate cardinality will be adjusted at query compile time. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT 'ENABLE_HIST_AMENDMENT_FOR_ASC_KEYS' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ENABLE_HIST_AMENDMENT_FOR_ASC_KEYS' query hint instead of using this trace flag.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

注意: 此跟踪标志不适用于 CE 版本 70。Note: This trace flag does not apply to CE version 70. 请改用跟踪标志 2389 和 2390。Use trace flags 2389 and 2390 instead.

作用域:全局、会话或查询Scope: global or session or query
41994199 启用在 SQL ServerSQL Server 累积更新和 Service Pack 中发布的查询优化器 (QO) 修补程序。Enables Query Optimizer (QO) fixes released in SQL ServerSQL Server Cumulative Updates and Service Packs.

默认情况下会在给定产品版本的最新数据库兼容性级别下启用对早期版本的 SQL ServerSQL Server 所做的 QO 更改,但不启用跟踪标志 4199。QO changes that are made to previous releases of SQL ServerSQL Server are enabled by default under the latest database compatibility level in a given product release, without trace flag 4199 being enabled.

下表总结了使用特定数据库兼容性级别和跟踪标志 4199 时的行为。The following table summarizes the behavior when using specific database compatibility levels and trace flag 4199. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

数据库引擎 (DE) 版本Database Engine (DE) version数据库兼容性级别Database Compatibility LevelTF 4199TF 4199来自所有以前的数据库兼容性级别的 QO 更改QO changes from all previous Database Compatibility LevelsDE 版本后期 RTM 的 QO 更改QO changes for DE version post-RTM
13 (SQL Server 2016 (13.x)SQL Server 2016 (13.x))13 (SQL Server 2016 (13.x)SQL Server 2016 (13.x))100 至 120100 to 120OffOff禁用Disabled禁用Disabled
OnOn已启用Enabled已启用Enabled
130(默认值) 130 (Default)OffOff已启用Enabled禁用Disabled
OnOn已启用Enabled已启用Enabled
14 (SQL Server 2017 (14.x)SQL Server 2017 (14.x))14 (SQL Server 2017 (14.x)SQL Server 2017 (14.x))100 至 120100 to 120OffOff禁用Disabled禁用Disabled
OnOn已启用Enabled已启用Enabled
130130OffOff已启用Enabled禁用Disabled
OnOn已启用Enabled已启用Enabled
140(默认值1140 (Default 1)OffOff已启用Enabled禁用Disabled
OnOn已启用Enabled已启用Enabled
15 (SQL Server 2019 (15.x)SQL Server 2019 (15.x)) 和 12 (Azure SQL DatabaseAzure SQL Database)15 (SQL Server 2019 (15.x)SQL Server 2019 (15.x)) and 12 (Azure SQL DatabaseAzure SQL Database)100 至 120100 to 120OffOff禁用Disabled禁用Disabled
OnOn已启用Enabled已启用Enabled
130 至 140 130 to 140OffOff已启用Enabled禁用Disabled
OnOn已启用Enabled已启用Enabled
150(默认值2150 (Default 2)OffOff已启用Enabled禁用Disabled
OnOn已启用Enabled已启用Enabled

1 适用对象:Azure SQL DatabaseAzure SQL Database 1 Applies to: Azure SQL DatabaseAzure SQL Database
2 适用对象:SQL Server 2019 (15.x)SQL Server 2019 (15.x) 2 Applies to: SQL Server 2019 (15.x)SQL Server 2019 (15.x)

SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,若要在查询级别完成此操作,请参阅 ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) 中的 QUERY_OPTIMIZER_HOTFIXES 选项。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x), to accomplish this at the database level, see the QUERY_OPTIMIZER_HOTFIXES option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT 'ENABLE_QUERY_OPTIMIZER_HOTFIXES' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ENABLE_QUERY_OPTIMIZER_HOTFIXES' query hint instead of using this trace flag.

重要提示: 跟踪标志 4199 未启用解决错误结果或访问冲突错误的查询优化器修补程序。Important: Query Optimizer fixes that address wrong results or access violation errors are not enabled by trace flag 4199. 这些修补程序被视为不可选,并且在安装更新程序包后默认启用。Those fixes are not considered optional and become enabled by default once the update package is installed.

作用域:全局、会话或查询Scope: global or session or query
46104610 将存储缓存条目的哈希表的大小增加 8 倍。Increases the size of the hash table that stores the cache entries by a factor of 8. 与跟踪标志 4618 一起使用时,TokenAndPermUserStore 缓存存储中的条目数增加到 8,192 个。When used together with trace flag 4618 increases the number of entries in the TokenAndPermUserStore cache store to 8,192. 有关详细信息,请参阅此 Microsoft 支持文章和此 Microsoft 支持文章For more information, see this Microsoft Support article and this Microsoft Support article.

作用域: 仅全局Scope: global only
46164616 使应用程序角色可以看到服务器级元数据。Makes server-level metadata visible to application roles. SQL ServerSQL Server 中,应用程序角色无法访问自身数据库以外的元数据,因为应用程序角色与服务器级别主体不相关联。In SQL ServerSQL Server, an application role cannot access metadata outside its own database because application roles are not associated with a server-level principal. 这是对早期版本的 SQL ServerSQL Server的行为的更改。This is a change of behavior from earlier versions of SQL ServerSQL Server. 设置此全局标志将禁用新的限制,并允许应用程序角色访问服务器级元数据。Setting this global flag disables the new restrictions, and allows for application roles to access server-level metadata.

作用域:仅全局Scope: global only
46184618 将 TokenAndPermUserStore 缓存存储中的条目数限制为 1,024 个。Limits the number of entries in the TokenAndPermUserStore cache store to 1,024. 与跟踪标志 4610 一起使用时,TokenAndPermUserStore 缓存存储中的条目数增加到 8,192 个。When used together with trace flag 4610 increases the number of entries in the TokenAndPermUserStore cache store to 8,192. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域: 仅全局Scope: global only
4621 4621 将 TokenAndPermUserStore 缓存存储中的条目数限制为用户在注册表项中指定的数目。Limits the number of entries in the TokenAndPermUserStore cache store to the number specified by the user in a registry key. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域: 仅全局Scope: global only
50045004 暂停 TDE 加密扫描,并导致加密扫描工作线程退出而不执行任何操作。Pauses TDE encryption scan and causes encryption scan worker to exit without doing any work. 数据库将继续处于加密状态(正在加密)。The database will continue to be in encrypting state (encryption in progress). 若要恢复重新加密扫描,请禁用跟踪标志 5004 并运行 ALTER DATABASE <database_name> SET ENCRYPTION ON。To resume re-encryption scan, disable trace flag 5004 and run ALTER DATABASE <database_name> SET ENCRYPTION ON.

作用域: 仅全局Scope: global only
64986498 当有足够的可用内存时,允许多个大型查询编译访问大型网关。Enables more than one large query compilation to gain access to the big gateway when there is sufficient memory available. 此跟踪标志可用于保存控制下的传入查询的编译的内存使用情况,避免并发大型查询的编译等待。This trace flag can be used to keep memory usage for the compilation of incoming queries under control, avoiding compilation waits for concurrent large queries. 它基于 80% 的 SQL Server 目标内存,并且允许每 25 GB 内存有一个大型查询编译。It is based on the 80 percentage of SQL Server Target Memory, and it allows for one large query compilation per 25 gigabytes (GB) of memory. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 和 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由引擎控制,跟踪标志 6498 不再有效。Note: Starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 and SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the engine and trace flag 6498 has no effect.

作用域:仅全局Scope: global only
65276527 禁止在 CLR 集成中第一次发生内存不足异常时生成内存转储。Disables generation of a memory dump on the first occurrence of an out-of-memory exception in CLR integration. 默认情况下,SQL ServerSQL Server 在 CLR 中第一次发生内存不足异常时会生成小内存转储。By default, SQL ServerSQL Server generates a small memory dump on the first occurrence of an out-of-memory exception in the CLR. 该跟踪标志的行为如下所示:The behavior of the trace flag is as follows:
  • 如果用作一个启动跟踪标志,则永远不生成内存转储。If this is used as a startup trace flag, a memory dump is never generated. 但是,如果使用了其他跟踪标志,则可能会生成内存转储。However, a memory dump may be generated if other trace flags are used.
  • 如果在正在运行的服务器上启用此跟踪标志,则从此时开始不会自动生成内存转储。If this trace flag is enabled on a running server, a memory dump will not be automatically generated from that point on. 但是,如果已经由于 CLR 中的内存不足异常生成了内存转储,则此跟踪标志将没有任何效果。However, if a memory dump has already been generated due to an out-of-memory exception in the CLR, this trace flag will have no effect.

作用域:仅全局Scope: global only
65326532 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2014 (12.x)SQL Server 2014 (12.x) 中,针对空间数据类型提高查询操作的性能。Enables performance improvement of query operations with spatial data types in SQL Server 2012 (11.x)SQL Server 2012 (11.x) and SQL Server 2014 (12.x)SQL Server 2014 (12.x). 根据配置、查询类型和对象的不同,性能提升程度将有所不同。The performance gain will vary, depending on the configuration, the types of queries, and the objects. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由引擎控制,跟踪标志 6532 不再有效。Note: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the engine and trace flag 6532 has no effect.

作用域:全局和会话Scope: global and session
65336533 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2014 (12.x)SQL Server 2014 (12.x) 中,针对空间数据类型提高查询操作的性能。Enables performance improvement of query operations with spatial data types in SQL Server 2012 (11.x)SQL Server 2012 (11.x) and SQL Server 2014 (12.x)SQL Server 2014 (12.x). 根据配置、查询类型和对象的不同,性能提升程度将有所不同。The performance gain will vary, depending on the configuration, the types of queries, and the objects. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由引擎控制,跟踪标志 6533 不再有效。Note: Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the engine and trace flag 6533 has no effect.

作用域:全局和会话Scope: global and session
65346534 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL Server 2016 (13.x)SQL Server 2016 (13.x) 中,针对空间数据类型提高查询操作的性能。Enables performance improvement of query operations with spatial data types in SQL Server 2012 (11.x)SQL Server 2012 (11.x), SQL Server 2014 (12.x)SQL Server 2014 (12.x) and SQL Server 2016 (13.x)SQL Server 2016 (13.x). 根据配置、查询类型和对象的不同,性能提升程度将有所不同。The performance gain will vary, depending on the configuration, the types of queries, and the objects. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
73147314 使用 OLE DB 提供程序将精度/确定位数未知的 NUMBER 值强制视为双精度值。Forces NUMBER values with unknown precision/scale to be treated as double values with OLE DB provider. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局和会话Scope: global and session
74127412 启用轻型查询执行统计信息分析基础结构。Enables the lightweight query execution statistics profiling infrastructure. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 and higher builds. SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始,此跟踪标志将不起作用,因为默认情况下启用轻量分析。Starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x) this trace flag has no effect because lightweight profiling is enabled by default.

作用域:仅全局Scope: global only
74717471 为单个表上的不同统计信息启用多个 UPDATE STATISTICS 并发运行。Enables running multiple UPDATE STATISTICS for different statistics on a single table concurrently. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 及更高内部版本。Note: This trace flag applies to SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 and higher builds.

作用域:仅全局Scope: global only
77457745 强制查询存储在数据库关闭时不将数据刷新到磁盘。Forces Query Store to not flush data to disk on database shutdown.

注意: 使用此跟踪可能会导致先前未刷新到磁盘的查询存储数据在关闭时丢失。Note: Using this trace may cause Query Store data not previously flushed to disk to be lost in case of shutdown. 关闭 SQL ServerSQL Server 时,可以使用 SHUTDOWN WITH NOWAIT 命令强制立即关闭,而不是使用此跟踪标志。For a SQL ServerSQL Server shutdown, the command SHUTDOWN WITH NOWAIT can be used instead of this trace flag to force an immediate shutdown.

作用域:仅全局Scope: global only
77527752 启用查询存储的异步加载。Enables asynchronous load of Query Store.

注意: 如果 SQL ServerSQL Server 遇到大量与查询存储同步加载(数据库恢复期间的默认行为)相关的 QDS_LOADDB 等待,则使用此跟踪标志。Note: Use this trace flag if SQL ServerSQL Server is experiencing high number of QDS_LOADDB waits related to Query Store synchronous load (default behavior during database recovery).

注意:SQL Server 2019 (15.x)SQL Server 2019 (15.x) 开始,此行为由引擎控制,跟踪标志 7752 不再有效。Note: Starting with SQL Server 2019 (15.x)SQL Server 2019 (15.x) this behavior is controlled by the engine and trace flag 7752 has no effect.

作用域:仅全局Scope: global only
78067806 SQL Server ExpressSQL Server Express上启用专用管理员连接 (DAC)。Enables a dedicated administrator connection (DAC) on SQL Server ExpressSQL Server Express. 默认情况下,在 SQL Server ExpressSQL Server Express 上不保留 DAC 资源。By default, no DAC resources are reserved on SQL Server ExpressSQL Server Express. 有关详细信息,请参阅 用于数据库管理员的诊断连接For more information, see Diagnostic Connection for Database Administrators.

作用域:仅全局Scope: global only
80118011 为资源监视器禁用环形缓冲区。Disable the ring buffer for Resource Monitor. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局和会话Scope: global and session
80128012 为计划程序禁用环形缓冲区。Disable the ring buffer for schedulers. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
80158015 禁用自动检测和 NUMA 设置。Disable auto-detection and NUMA setup. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
80188018 禁用异常环形缓冲区。Disable the exception ring buffer. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
80198019 为异常环形缓冲区禁用堆栈集合。Disable stack collection for the exception ring buffer. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
80208020 禁用工作集监视。Disable working set monitoring. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
80328032 将缓存限制参数还原为 SQL Server 2005 (9.x)SQL Server 2005 (9.x)RTM 设置,此设置通常允许更大的缓存。Reverts the cache limit parameters to the SQL Server 2005 (9.x)SQL Server 2005 (9.x) RTM setting which in general allows caches to be larger. 当频繁重复使用的缓存条目不适合缓存时,以及当 “针对即席工作负荷进行优化”服务器配置选项 未能解决与计划缓存相关的问题时,请使用此设置。Use this setting when frequently reused cache entries do not fit into the cache and when the optimize for ad hoc workloads Server Configuration Option has failed to resolve the problem with plan cache.

警告 :如果大缓存使较少的内存可用于其他内存消耗者(如缓冲池),则跟踪标志 8032 可能导致性能较差。WARNING: Trace flag 8032 can cause poor performance if large caches make less memory available for other memory consumers, such as the buffer pool.

作用域:仅全局Scope: global only
80488048 将 NUMA 分区内存对象转换为 CPU 分区内存对象。Converts NUMA partitioned memory objects into CPU partitioned. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意:SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 和 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为是动态的,由引擎控制。Note: Starting with SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 and SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is dynamic and controlled by the engine.

作用域:仅全局Scope: global only
80758075 在 64 位 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2014 (12.x)SQL Server 2014 (12.x) 上收到内存页分配错误时,减少 VAS 片段。Reduces VAS fragmentation when you receive memory page allocation errors on a 64-bit SQL Server 2012 (11.x)SQL Server 2012 (11.x) or SQL Server 2014 (12.x)SQL Server 2014 (12.x). 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2014 (12.x)SQL Server 2014 (12.x) RTM CU10 和 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 CU3。Note: This trace flag applies to SQL Server 2012 (11.x)SQL Server 2012 (11.x), SQL Server 2014 (12.x)SQL Server 2014 (12.x) RTM CU10, and SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 CU3. SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由引擎控制,跟踪标志 8075 不再有效。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the engine and trace flag 8075 has no effect.

作用域:仅全局Scope: global only
80798079 允许 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 询问硬件布局,并在报告每个 NUMA 节点 8 个或更多 CPU 的系统上自动配置 Soft-NUMA。Allows SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2 to interrogate the hardware layout and automatically configure Soft-NUMA on systems reporting 8 or more CPUs per NUMA node. 自动 Soft-NUMA 行为可识别超线程(HT/逻辑处理器)。The automatic Soft-NUMA behavior is Hyperthread (HT/logical processor) aware. 通过提高侦听器数、缩放和网络与加密功能,其他节点的分区和创建会缩放后台处理。The partitioning and creation of additional nodes scales background processing by increasing the number of listeners, scaling and network and encryption capabilities.

注意: 此跟踪标志适用于 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2。Note: This trace flag applies to SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP2. SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,此行为由引擎控制,跟踪标志 8079 不再有效。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) this behavior is controlled by the engine and trace flag 8079 has no effect.

作用域:仅全局Scope: global only
82078207 允许事务复制和 CDC 的 singleton 更新。Enables singleton updates for Transactional Replication and CDC. 对订阅服务器的更新可以作为 DELETE 和 INSERT 对复制。Updates to subscribers can be replicated as a DELETE and INSERT pair. 这可能不符合业务规则的要求,如激发 UPDATE 触发器。This might not meet business rules, such as firing an UPDATE trigger. 使用跟踪标志 8207 时,对只影响一行的唯一列的更新(单一实例更新)将作为 UPDATE 而非作为 DELETE 或 INSERT 对进行复制。With trace flag 8207, an update to a unique column that affects only one row (a singleton update) is replicated as an UPDATE and not as a DELETE or INSERT pair. 如果该更新影响具有唯一约束的列或影响多个行,则仍将该更新作为 DELETE 或 INSERT 对进行复制。If the update affects a column on which a unique constraint exists, or if the update affects multiple rows, the update is still replicated as a DELETE or INSERT pair. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
87218721 在执行自动更新统计信息时向错误日志提交报告。Reports to the error log when auto-update statistics executes. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
87448744 为嵌套循环运算符禁用预提取。Disable pre-fetching for the Nested Loop operator. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

警告 :当 SQL ServerSQL Server 执行包含嵌套循环运算符的计划时,错误地使用此跟踪标志可能会导致额外的物理读取。WARNING: Incorrect use of this trace flag may cause additional physical reads when SQL ServerSQL Server executes plans that contain the Nested Loops operator.

作用域:全局和会话Scope: global and session
90249024 将全局日志池内存对象转换为 NUMA 节点分区内存对象。Converts a global log pool memory object into NUMA node partitioned memory object. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 从 SQL Server 2012 (11.x)SQL Server 2012 (11.x) SP3 和 SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 开始,此行为由引擎控制,跟踪标志 9024 不再有效。Note: Starting with SQL Server 2012 (11.x)SQL Server 2012 (11.x) SP3 and SQL Server 2014 (12.x)SQL Server 2014 (12.x) SP1 this behavior is controlled by the engine and trace flag 9024 has no effect.

作用域:仅全局Scope: global only
93479347 禁用 Sort 运算符的批处理模式。Disables batch mode for sort operator. SQL Server 2016 (13.x)SQL Server 2016 (13.x) 引入了新的批处理模式 Sort 运算符,可以提高许多分析查询的性能。introduced a new batch mode sort operator that boosts performance for many analytical queries. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局、会话或查询Scope: global or session or query
93499349 禁用 Top N Sort 运算符的批处理模式。Disables batch mode for top N sort operator. SQL Server 2016 (13.x)SQL Server 2016 (13.x) 引入了新的批处理模式 top sort 运算符,可以提高许多分析查询的性能。introduced a new batch mode top sort operator that boosts performance for many analytical queries.

作用域:全局、会话或查询Scope: global or session or query
93899389 为批处理模式运算符启用额外动态内存授予。Enables additional dynamic memory grant for batch mode operators. 如果查询未获取所需的所有内存,则会将数据溢出到 TempDB,从而导致额外的 I/O 并可能影响查询性能。If a query does not get all the memory it needs, it spills data to TempDB, incurring additional I/O and potentially impacting query performance. 如果启用动态内存授予跟踪标志,批处理模式运算符可能会要求提供更多内存,如果有更多内存可用,则会避免溢出到 TempDB。If the dynamic memory grant trace flag is enabled, a batch mode operator may ask for additional memory and avoid spilling to TempDB if additional memory is available. 有关详细信息,请参阅内存管理体系结构指南中的“min memory per query 的影响”部分 。For more information, see the Effects of min memory per query section of the Memory Management Architecture Guide.

作用域:全局或会话Scope: global or session
93989398 禁用自适应联接运算符,在扫描第一个输入后可延迟选择哈希联接或嵌套循环联接方法,如 SQL Server 2017 (14.x)SQL Server 2017 (14.x) 中引入的那样。Disables Adaptive Join operator that enables the choice of a Hash join or Nested Loops join method to be deferred until the after the first input has been scanned, as introduced in SQL Server 2017 (14.x)SQL Server 2017 (14.x). 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局、会话和查询Scope: global and session and query
94539453 禁用批处理模式执行。Disables batch mode execution. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域: 全局、会话和查询Scope: global and session and query
94719471 SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL ServerSQL Server 版本的查询优化器基数估计模型下,导致 SQL ServerSQL Server 使用最小选择性为单表筛选器生成一个计划。Causes SQL ServerSQL Server to generate a plan using minimum selectivity for single-table filters, under the query optimizer cardinality estimation model of SQL Server 2014 (12.x)SQL Server 2014 (12.x) through SQL ServerSQL Server versions.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ASSUME_MIN_SELECTIVITY_FOR_FILTER_ESTIMATES' query hint instead of using this trace flag.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

注意: 此跟踪标志不适用于 CE 版本 70。Note: This trace flag does not apply to CE version 70. 请改用跟踪标志 4137。Use trace flag 4137 instead.

作用域:全局、会话或查询Scope: global or session or query
94769476 SQL Server 2014 (12.x)SQL Server 2014 (12.x)SQL ServerSQL Server 版本的查询优化器基数估计模型下,导致 SQL ServerSQL Server 使用简单包含假设而非默认的基本包含假设来生成计划。Causes SQL ServerSQL Server to generate a plan using the Simple Containment assumption instead of the default Base Containment assumption, under the query optimizer cardinality estimation model of SQL Server 2014 (12.x)SQL Server 2014 (12.x) through SQL ServerSQL Server versions. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT 'ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'ASSUME_JOIN_PREDICATE_DEPENDS_ON_FILTERS' query hint instead of using this trace flag.

注意: 请确保在将此选项引入生产环境之前,先对其进行全面测试。Note: Please ensure that you thoroughly test this option, before rolling it into a production environment.

作用域:全局、会话或查询Scope: global or session or query
94819481 允许将查询优化器基数估计模型设置为 SQL Server 2012 (11.x)SQL Server 2012 (11.x) 及更早版本,而不考虑数据库兼容性级别。Enables you to set the query optimizer cardinality estimation model to the SQL Server 2012 (11.x)SQL Server 2012 (11.x) and earlier versions, irrespective of the compatibility level of the database. 有关详细信息,请参阅 Microsoft 支持文章For more information, see Microsoft Support article.

SQL Server 2016 (13.x)SQL Server 2016 (13.x) 开始,若要在数据库级别完成此操作,请参阅 ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL) 中的 LEGACY_CARDINALITY_ESTIMATION 选项。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x), to accomplish this at the database level, see the LEGACY_CARDINALITY_ESTIMATION option in ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL).

SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1 开始,若要在查询级别完成此操作,请添加 USE HINT 'FORCE_LEGACY_CARDINALITY_ESTIMATION' 查询提示,而不是使用此跟踪标志。Starting with SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP1, to accomplish this at the query level, add the USE HINT 'FORCE_LEGACY_CARDINALITY_ESTIMATION' query hint instead of using this trace flag.

作用域:全局、会话或查询Scope: global or session or query
94859485 对 DBCC SHOW_STATISTICS 禁用 SELECT 权限。Disables SELECT permission for DBCC SHOW_STATISTICS.

作用域:仅全局Scope: global only
94889488 当使用 SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL ServerSQL Server 版本的查询优化器基数估计模型时,将表值函数的固定估计值设置为默认值 1(对应于 SQL Server 2008 R2SQL Server 2008 R2 及更早版本的查询优化器基数估计模型下的默认值)。Sets the fixed estimation for Table Valued Functions to the default of 1 (corresponding to the default under the query optimizer cardinality estimation model of SQL Server 2008 R2SQL Server 2008 R2 and earlier versions), when using the query optimizer cardinality estimation model of SQL Server 2012 (11.x)SQL Server 2012 (11.x) through SQL ServerSQL Server versions.

作用域:全局、会话或查询Scope: global or session or query
94959495 在 INSERT...SELECT 操作的插入过程中禁用并行,它适用于用户表和临时表。Disables parallelism during insertion for INSERT...SELECT operations and it applies to both user and temporary tables. 有关详细信息,请参阅 Microsoft 支持文章For more information, see Microsoft Support article

作用域:全局或会话Scope: global or session
95679567 对自动种子设定过程中的 Always On 可用性组启用数据流压缩。Enables compression of the data stream for Always On Availability Groups during automatic seeding. 在自动种子设定过程中,压缩可大幅缩短传输时间,并且将增加处理器上的负载。Compression can significantly reduce the transfer time during automatic seeding and will increase the load on the processor. 有关详细信息,请参阅自动初始化 Always On 可用性组调整可用性组的压缩For more information, see Automatically initialize Always On availability group and Tune compression for availability group.

作用域:全局或会话Scope: global or session
95719571 禁用可用性组自动设定种子到默认数据库路径。Disables Availability Groups Auto seeding to the default database path. 有关详细信息,请参阅磁盘布局For more information see Disk Layout.

作用域:全局或会话Scope: global or session
95919591 在 Always On 可用性组中禁用日志块压缩。Disables log block compression in Always On Availability Groups. SQL Server 2012 (11.x)SQL Server 2012 (11.x)SQL Server 2014 (12.x)SQL Server 2014 (12.x) 中,日志块压缩是用于同步副本和异步副本的默认行为。Log block compression is the default behavior used with both synchronous and asynchronous replicas in SQL Server 2012 (11.x)SQL Server 2012 (11.x) and SQL Server 2014 (12.x)SQL Server 2014 (12.x). SQL Server 2016 (13.x)SQL Server 2016 (13.x) 中,压缩仅用于异步副本。In SQL Server 2016 (13.x)SQL Server 2016 (13.x), compression is only used with asynchronous replica.

作用域:全局或会话Scope: global or session
95929592 对同步可用性组启用日志流压缩。Enables log stream compression for synchronous availability groups. 默认情况下,对同步可用性组禁用此功能,因为压缩会增加延迟。This feature is disabled by default on synchronous availability groups because compression adds latency. 有关详细信息,请参阅 Tune compression for availability group(调整可用性组的压缩)。For more information, see Tune compression for availability group.

作用域:全局或会话Scope: global or session
99299929 将每个内存中检查点文件都缩减为 1 MB。Reduces the In-Memory checkpoint files to 1 MB each. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:仅全局Scope: global only
99399939 SQL Server 2016 (13.x)SQL Server 2016 (13.x) 中,允许在引用内存优化表或表变量的 DML 操作中并行计划和并行扫描内存优化表和表变量,前提是它们不是 DML 操作的目标。Enables parallel plans and parallel scan of memory-optimized tables and table variables in DML operations that reference memory-optimized tables or table variables, as long as they are not the target of the DML operation in SQL Server 2016 (13.x)SQL Server 2016 (13.x). 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 如果还显式启用了跟踪标志 4199,则不需要使用跟踪标志 9939。Note: Trace flag 9939 is not needed if trace flag 4199 is also explicitly enabled.

作用域:全局、会话或查询Scope: global or session or query
1020410204 在列存储索引重组期间禁用合并/重新压缩。Disables merge/recompress during columnstore index reorganization. SQL Server 2016 (13.x)SQL Server 2016 (13.x) 中,当重组列存储索引时,会有一个新功能将所有小型压缩行组自动合并为较大的压缩行组,并重新压缩具有大量已删除行的所有行组。In SQL Server 2016 (13.x)SQL Server 2016 (13.x), when a columnstore index is reorganized, there is new functionality to automatically merge any small compressed rowgroups into larger compressed rowgroups, as well as recompressing any rowgroups that have a large number of deleted rows.

注意: 跟踪标志 10204 不适用于对内存优化表创建的列存储索引。Note: Trace flag 10204 does not apply to columnstore indexes which are created on memory-optimized tables.

作用域:全局或会话Scope: global or session
1031610316 允许对内部内存优化暂存时态表创建除默认索引之外的附加索引。Enables creation of additional indexes on internal memory-optimized staging temporal table, beside the default one. 如果有特定的查询模式,其中包含未被默认索引覆盖的列,则可以考虑添加附加索引。If you have specific query pattern that includes columns which are not covered by the default index you may consider adding additional ones.

注意: 内存优化表的经系统版本控制的时态表旨在提供较高的事务吞吐量。Note: System-versioned temporal tables for Memory-Optimized Tables are designed to provide high transactional throughput. 请注意,创建附加索引可能会为更新或删除当前表中的行的 DML 操作带来开销。Please be aware that creating additional indexes may introduce overhead for DML operations that update or delete rows in the current table. 如果使用附加索引,应力求在时态查询的性能和额外的 DML 开销之间找到适当的平衡点。With the additional indexes you should aim to find the right balance between performance of temporal queries and additional DML overhead.

作用域:全局或会话Scope: global or session
1102311023 对于未将采样率显式指定为 UPDATE STATISTICS 语句一部分的所有后续统计信息更新,禁止使用上一个持续采样率。Disables the use of the last persisted sample rate for all subsequent statistics update, where a sample rate is not specified explicitly as part of the UPDATE STATISTICS statement. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

作用域:全局或会话Scope: global or session
1102411024 当任何分区的修改计数超过本地阈值时,允许触发统计信息的自动更新。Enables triggering the auto update of statistics when the modification count of any partition exceeds the local threshold. 有关详细信息,请参阅此 Microsoft 支持文章For more information, see this Microsoft Support article.

注意: 此跟踪标志适用于 SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2、SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3 及更高内部版本。Note: This trace flag applies to SQL Server 2016 (13.x)SQL Server 2016 (13.x) SP2, SQL Server 2017 (14.x)SQL Server 2017 (14.x) CU3, and higher builds.

作用域:全局或会话Scope: global or session

示例Examples

以下示例使用 DBCC TRACEON 针对服务器级别的所有会话将跟踪标志 3205 设置为开。The following example sets trace flag 3205 on for all sessions at the server level by using DBCC TRACEON.

DBCC TRACEON (3205,-1);  

对于特定查询,可以启用由跟踪标志 4199 和 4137 控制的所有影响计划的修补程序。You can enable all plan-affecting hotfixes controlled by trace flags 4199 and 4137 for a particular query.

SELECT x FROM correlated WHERE f1 = 0 AND f2 = 1 OPTION (QUERYTRACEON 4199, QUERYTRACEON 4137)

另请参阅See Also

数据类型 (Transact-SQL)Data Types (Transact-SQL)
DBCC INPUTBUFFER (Transact-SQL)DBCC INPUTBUFFER (Transact-SQL)
DBCC OUTPUTBUFFER (Transact-SQL)DBCC OUTPUTBUFFER (Transact-SQL)
DBCC TRACEOFF (Transact-SQL)DBCC TRACEOFF (Transact-SQL)
DBCC TRACEON (Transact-SQL)DBCC TRACEON (Transact-SQL)
DBCC TRACESTATUS (Transact-SQL)DBCC TRACESTATUS (Transact-SQL)
EXECUTE (Transact-SQL)EXECUTE (Transact-SQL)
SELECT (Transact-SQL)SELECT (Transact-SQL)
SET NOCOUNT (Transact-SQL)SET NOCOUNT (Transact-SQL)
ALTER DATABASE SET 选项 (Transact-SQL)ALTER DATABASE SET Options (Transact-SQL)
ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL)ALTER DATABASE SCOPED CONFIGURATION (Transact-SQL)
查询提示 (Transact-SQL)Query Hints (Transact-SQL)