Skip to content

Commit d476420

Browse files
committed
Update Trace Flag 3895 Demo
1 parent a333b1e commit d476420

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Scripts/Trace_Flag/Trace_Flag_3895.sql

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
/*
2-
https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database
2+
Trace Flag Demo: 3895
3+
!!! Undocumented trace flag !!!
4+
Function: In SQL Server 2019, when you enable the [Memory-Optimized TempDB Metadata](https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database) feature, this trace flag is automatically enabled after the next restart.
5+
When you disable that feature, the trace flag is automatically removed after the next restart.
6+
Also if you add race flag 3895 to startup parameters after restarting SQL Server option `IsTempdbMetadataMemoryOptimized` will be enabled.
7+
SQL Server Version: 2019
8+
Information link: https://github.com/ktaranov/sqlserver-kit/blob/master/SQL%20Server%20Trace%20Flag.md#3895
39
*/
410

511
/* Check is it session trace flag? */
612
DBCC TRACEON (3895);
713
GO
8-
/* Answer - no
14+
/* Answer - NO
915
Ignoring trace flag 3895. It is either an invalid trace flag or a trace flag that can only be specified during server startup.
1016
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
1117
*/
@@ -14,11 +20,13 @@ DBCC execution completed. If DBCC printed error messages, contact your system ad
1420
DBCC TRACESTATUS(-1);
1521
GO
1622

23+
/* https://docs.microsoft.com/en-us/sql/relational-databases/databases/tempdb-database */
1724
ALTER SERVER CONFIGURATION SET MEMORY_OPTIMIZED TEMPDB_METADATA = ON;
1825

1926
/* RESTART SQL SERVER */
2027
DBCC TRACESTATUS(-1);
2128
GO
29+
/* Return that 3895 trace flag is enabled */
2230

2331
SELECT SERVERPROPERTY('IsTempdbMetadataMemoryOptimized') AS IsTempdbMetadataMemoryOptimized;
2432
/* Return 1 (enabled) */

0 commit comments

Comments
 (0)