Trace flags are used to temporarily change SQL Server's behavior for debugging or diagnosing issues. This document discusses several trace flags including:
TF 652, 661, 834, 836 which disable certain SQL Server processes or enable large page allocations.
TF 1211, 1224 which avoid lock escalation. TF 1117 forces data files to auto grow equally. TF 1204, 1205, 1222 provide more information on deadlocks.
TF 1118 addresses tempdb contention. TFs 3226, 3014, 3004 provide more backup/restore details. TF 4199 enables query processor fixes. TF 3502 prints checkpoint messages.
The document provides explanations of these trace flags
This presentation is an overview of things all IT management team needs to consider before upgrading to Oracle Database 12c and were presented in a webinar: bit.ly/1yzSdsd
Oracle ACE Director Dan Morgan was a 12c beta tester and is intimately familiar with changes in architecture and how they will impact existing infrastructure and planning and budgeting considerations.
In 2015, most organizations will begin to migrate to the latest version of Oracle Database 12c, but few are aware of the challenges to management, planning and budgeting that need to be addressed before executing such a project. Dan Morgan presents what needs to be considered and shares a few tips about 12c new features.
If you have any questions regarding your future Oracle migrations and upgrades, feel free to visit Performance Tuning Corporation at www.perftuning.com
This presentation is an overview of things all IT management team needs to consider before upgrading to Oracle Database 12c and were presented in a webinar: bit.ly/1yzSdsd
Oracle ACE Director Dan Morgan was a 12c beta tester and is intimately familiar with changes in architecture and how they will impact existing infrastructure and planning and budgeting considerations.
In 2015, most organizations will begin to migrate to the latest version of Oracle Database 12c, but few are aware of the challenges to management, planning and budgeting that need to be addressed before executing such a project. Dan Morgan presents what needs to be considered and shares a few tips about 12c new features.
If you have any questions regarding your future Oracle migrations and upgrades, feel free to visit Performance Tuning Corporation at www.perftuning.com
This is a recording of my Advanced Oracle Troubleshooting seminar preparation session - where I showed how I set up my command line environment and some of the main performance scripts I use!
The presentation in Oracle Technical Carnival China 2016, this is the second presentation about Oracle sharding function that will release in 12.2. In this presentation, described in real case how Oracle construct the sharding table and duplicated table.
12cR2 Single-Tenant: Multitenant Features for All EditionsFranck Pachot
Multitenant architecture is available even without Oracle's multitenant option. In this session take a look at the overhead and the 12.2 new features so that you can choose among single-tenant or non-container databases. These features include agility in data movement, easy flashback, and fast upgrade.
So, you know how to deploy your code, what about your database? This talk will go through deploying your database with LiquiBase and DBDeploy a non-framework based approach to handling migrations of DDL and DML.
This is a recording of my Advanced Oracle Troubleshooting seminar preparation session - where I showed how I set up my command line environment and some of the main performance scripts I use!
The presentation in Oracle Technical Carnival China 2016, this is the second presentation about Oracle sharding function that will release in 12.2. In this presentation, described in real case how Oracle construct the sharding table and duplicated table.
12cR2 Single-Tenant: Multitenant Features for All EditionsFranck Pachot
Multitenant architecture is available even without Oracle's multitenant option. In this session take a look at the overhead and the 12.2 new features so that you can choose among single-tenant or non-container databases. These features include agility in data movement, easy flashback, and fast upgrade.
So, you know how to deploy your code, what about your database? This talk will go through deploying your database with LiquiBase and DBDeploy a non-framework based approach to handling migrations of DDL and DML.
The current trends to work in Agile and DevOps are challenging for database developers. Source control is a standard for non-database code but it’s a challenge for databases. This talk has an ambition to change that situation and help developers and DBA take over control of source code and data.
Tungsten Use Case: How Gittigidiyor (a subsidiary of eBay) Replicates Data In...Continuent
Learn how Gittigidiyor (a subsidiary of eBay) replicates data in real time from MySQL to Oracle with Continuent Tungsten. Gittigidiyor consolidates reporting data in a single MySQL server. Transactions arriving on this server must be replicated in real time to an Oracle instance.
Levent Kurt, Site Operations Manager at Gittigidiyor, describes how Gittigidiyor solved their problems of handling large tables in MySQL by replicating 20 GB of binlog data/day from MySQL 5.5 Community Edition to Oracle Enterprise Edition 11G with Continuent Tungsten, in a hosted VMware ESX environment.
SharePoint is from Mars, SQL Server is from Venus (SQL Server for SharePoint ...Mark Broadbent
The SQL Server Database Engine is a prerequisite and fundamental part of any SharePoint deployment but the downside to all of this is the Database Server usually brings a Database Administrator with it. In this session we will explain how to configure SQL Server correctly with SharePoint deployments in mind, how the underlying architecture and mechanisms of SQL Server work and why you need to do all this! By the end of this session you will have learnt how to talk to your DBA to explain that they are doing it wrong!
Top 5 things to know about sql azure for developersIke Ellis
Databases in the cloud are a brave new world. This presentation will show up the issues with migrating your application to SQL Azure and how to address them.
Introducing 3 FREE Smart solutions for SQL Server (Adi Sapir, Docco Labs)
As Database experts, we work with SQL Server Databases on a daily basis. We face the same problems every SQL Administrator and/or developer does. And – we spend our time writing solutions for these problems! In this session Adi will introduce the following 3, totally FREE solutions:
· ClipTable – A revolutionary new *anything* to SQL Table importer
· Database File Explorer – a much easier way to explore our database->filegroups->files->storage mapping
· Log Table Viewer – a complete client/server logger solution for SQL Server
Big Data and New Challenges for DBAs (Michael Naumov, LivePerson)
Hadoop has become a popular platform for managing large datasets of structured and unstructured data. It does not replace existing infrastructures, but instead augments them. Most companies will still use relational databases for transactional processing and low-latency queries, but can benefit from Hadoop for reporting, machine learning or ETL. This session will cover:
What is Hadoop and why do I care?
What do people do with Hadoop?
How can SQL Server DBAs add Hadoop to their architecture?
Common Errors That Effect Performance (Adi Cohen, Naya-Tech)
There are a few common errors that have a negative effect on performance. In this session we will review some of them, see why they impact performance and provide alternative solutions. Among the issues we will cover are:
· Misunderstanding of the query plan when using procedures
· Query plan differences between procedures and ad-hoc batches
· The differences between a temporary table and a table variable
· And many more…
Who is afraid of Columnstore Indexes? (Michael Zilberstein, DB-Art)
This talk describes new SQL Server 2012 feature called "columnstore index". In this session we will learn about the differences between columnstore indexes and B-Tree indexes we are used to work with. We will see when it is best to use and when not to use this new index. We will cover limitations that columnstore index imposes on the tables that use it and how to live with those limitations. Like in all my sessions, I won't let you go without some internals – how columnstore index is organized on a physical level and how Query Processor works this new type of index. And of course Demos, Demos, Demos…
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
3. documented and undocumented
• Documented
• support
• Books Online
• Microsoft Knowledgebase
• Whitepapers
• Undocumented
• unsupported & risky
• Blog
• internet
• user group presentations
• do not expect me (or Microsoft) to help you with any issue
caused by running any unsupported piece of code on your SQL
Server!
8. Trace Flags
• Trace flags are used to temporarily set specific server
characteristics or to switch off a particular behavior. For
example, if trace flag 3205 is set when an instance of SQL Server
starts, hardware compression for tape drivers is disabled. Trace
flags are frequently used to diagnose performance issues or to
debug stored procedures or complex computer systems.
BOL:
ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/b971b540-1ac2-
435b-b191-24399eb88265.htm
9. Trace Flags vs. DBCC
Trace Flags:
• Trace Flags are numbers
• Toggle on/off to change in SQL Server‟s behavior
• Trace Flags toggle by DBCC (DBCC TRACEON / TRACEOFF)
• Result is change in SQL Server‟s behavior
• Could be just to enable a hotfix (multi HF in the same build)
DBCCs
• DBCCs are text command
• Result is a report as messages uotput
10. DBCC TRACEON
• --switching on trace flag 3205. This flag is switched on only for
the current connection
• DBCC TRACEON (3205);
• GO
• --switches on trace flag 3205 globally
• DBCC TRACEON (3205, -1);
• GO
• --switches on trace flags 3205, and 260 globally
• DBCC TRACEON (3205, 260, -1);
• GO
11. DBCC TRACEOFF
• --disables trace flag 3205
• DBCC TRACEOFF (3205);
• GO
• --disables trace flag 3205 globally
• DBCC TRACEOFF (3205, -1);
• GO
• --sdisables trace flags 3205 and 260 globally.
• DBCC TRACEOFF (3205, 260, -1);
• GO
12. DBCC TRACESTATUS
• Status - Indicates whether the trace flag is set ON of OFF, either
globally or for the session.
1 = ON / 0 = OFF
• Global - Indicates whether the trace flag is set globally.
1 = True / 0 = False
• Session - Indicates whether the trace flag is set for the session
1 = True / 0 = False
13. DBCC TRACESTATUS
--displays the status of all trace flags that are currently enabled
globally.
DBCC TRACESTATUS(-1);
GO
--displays the status of trace flags 2528 and 3205.
DBCC TRACESTATUS (2528, 3205);
GO
--displays whether trace flag 3205 is enabled globally.
DBCC TRACESTATUS (3205, -1);
GO
--lists all the trace flags that are enabled for the current session.
DBCC TRACESTATUS();
GO
14. Startup parameters
• http://msdn.microsoft.com/en-us/library/ms345416.aspx How to:
Configure Server Startup Options (SQL Server Configuration
Manager)
•
On a cluster, changes must be made on the active server while SQL Server is
online, and will take effect when the Database Engine is restarted. The registry
update of the startup options on the other node will occur upon the next
failover.
18. And if the IT is not your friend?
• sp_procoption - Sets stored procedure for autoexecution. A
stored procedure that is set to autoexecution runs every time an
instance of SQL Server is started.
CREATE PROC TraceOnAtBoot
AS
DBCC TRACEON (1234,-1);
DBCC TRACEON (5678,-1);
GO
• EXEC sp_procoption „TraceOnAtBoot‟, 'autostart', 'TRUE'
19. Note
•Trace flag behavior may not
be supported in future
releases of SQL Server
• BOL & http://msdn.microsoft.com/en-us/library/ms188396.aspx
20. My Application
• 8,640,000 up to 60,480,000 rows in single table
• 500-3,000 new rows per secund
• Each row around 120K (20 MetaData + 100K image)
• From 300 TB through 1 PB up to 4 PB
• http://support.microsoft.com/kb/920093
Tuning options for SQL Server 2005 and SQL Server 2008 when
running in high performance workloads
21. 652: Disable page pre-fetching scans
• SQL Server no longer brings database pages into the buffer pool
before these database pages are consumed by the scans.
• Queries that benefit from the page pre-fetching feature exhibit
low performance.
23. 661: Disable the ghost record removal process
• A ghost record is the result of a delete
operation.
After deleting the deleted record is kept as a
ghost record.
Later, the deleted record is purged by the
ghost record removal process.
24. 834: Use Microsoft Windows large-page
allocations for the buffer pool (SQL 2005)
• Page memory size may be from 2 MB to 16 MB.
• Trace flag 834 causes SQL Server to use Microsoft
Windows large-page allocations for the memory that is
allocated for the buffer pool.
• applies only to 64-bit versions of SQL Server.
• May prevent the server from starting if memory is
fragmented and if large pages cannot be allocated.
Therefore, trace flag 834 is best suited for servers that
are dedicated to SQL Server.
• Automatically in SQL 2008
25. 836: Use the max server memory option for the
buffer pool
• Causes SQL Server to size the buffer pool at
startup based on the value of the max server
memory option instead of based on the total
physical memory.
• Trace flag 836 applies only to 32-bit versions
of SQL Server that have the AWE allocation
enabled. You can turn on trace flag 836 only at
startup.
26.
27. TF in this doc (is it really help me?)
• Trace flag 652: Disable page pre-fetching scans
• Trace flag 661: Disable the ghost record removal process
• Trace flag 834: Use Microsoft Windows large-page allocations for the
buffer pool
• Trace flag 836: Use the max server memory option for the buffer pool
• Trace flag 2301: Enable advanced decision support optimizations
• Trace flags that disable various ring buffers
• Trace flag 8011: Disable the ring buffer for Resource Monitor
• Trace flag 8012: Disable the ring buffer for schedulers
• Trace flag 8018: Disable the exception ring bufferTrace flag 8019: Disable
stack collection for the exception ring buffer
• Trace flag 8020: Disable working set monitoring
• Trace flag 8744: Disable pre-fetching for ranges
28. Still need to
• How to Load Lots of Data?
• Avoid Lock Escalation
• Partitions Tables
• Auto Grow Equally in all Data file
• Deadlocks
• TempDB
• BackUP
• Query processor
29. How to Load Lots of Data?
• http://msdn.microsoft.com/en-
us/library/dd425070(v=sql.100).aspx The Data
Loading Performance Guide (Thomas Kejser, Peter
Carlin and Stuart Ozer )
• SQL Server 2008 introduces trace flag 610, which
controls minimally logged inserts into indexed tables
• http://blogs.msdn.com/b/sqlserverstorageengine/archi
ve/2008/10/24/new-update-on-minimal-logging-for-sql-
server-2008.aspx MSDN Blogs > SQL Server Storage
Engine > New update on minimal logging for SQL
Server 2008
30. 1211: Avoid Lock Escalation
• Lock escalation to table level may occur as the number of row-
level exclusive (X) locks rises above a threshold. If this
happens, concurrency will drop to single threaded inserts. It is
possible to prevent this escalation from happening; the technique
depends on the SQL Server version:
• For SQL Server 2005, lock escalation generally
occurs at 5000 locked allocated. There are
exceptions. See this
• Setting a BATCHSIZE to a number lower than this will disable
escalation
• Alternatively, you can use trace flag 1211 to completely
disable lock escalation on the server.
• For SQL Server 2008, it is also possible to completely
disable lock escalation on a table level.
31. 1224: Avoid Lock Escalation
• Similar to trace flag 1211 with one key
difference. It enables lock escalation when
lock manager acquires 40% of the statically
allocated memory or (40%) non-AWE(32-
bit)/regular(64-bit) dynamically allocated
memory
• If this memory cannot be allocated due to
other components taking up more
memory, the lock escalation can be triggered
earlier.
• If both trace flags (1211 and 1224) are set at
the same time, the trace flag 1211 takes
precedence.
32. 1117: Auto Grow Equally in all Data file
• From Performance aspect all data file should be in
same size.
• Otherwise, SQL Server will utilize the data file which
is largest in size, assume you have auto growth option
enabled then obviously that file will grow and SQL
Server will keep on using the data file which is largest
in size.
• TF 1117 Attempt to grow all files in one filegroup
and not just the one next in the autogrowth chain .
•
Read more: http://sql-
articles.com/articles/general/day-6trace-flag-1117-
auto-grow-equally-in-all-data-file/#ixzz1lRHA9AZ7
34. 1204, 1205, 1222: Deadlock
• Scope: global only
• TF1204 Returns the resources and types of locks
participating in a deadlock and also the current
command affected
• TF1205 (undocumented) startup parameter collects
information every time that the deadlock algorithm
checks for a deadlock, not when a deadlock is
encountered, was documented in SQL Server 7.0
BOL, but is not documented in SQL Server 2008.
• TF 1222 formats deadlock information, first by
processes and then by resources. It is possible to
enable 1204 and 12222 trace flags to obtain two
representations of the same deadlock event.
35. 1204 Note
• In SQL Server 2000, a simple DBCC TRACEON (1204) is
enough to enable deadlock reporting to the error log.
• In SQL Server 2008, you must enable the flag globally because
the session-level flag is not visible to the deadlock monitor
thread.
37. 1118: TempDB
• “Nothing Is Not More Permanent Than The
Temporary” - Wonder TempDB , Dubi Lebel ISUG
Nov 09
• Slide 38, KB 328551 , TF 1118 reduce the allocation
resource contention for tempdb that is experiencing
heavy usage.
• directs SQL Server to allocate full extents to each
tempdb objects (instead of mixed extents)
• http://technet.microsoft.com/en-us/library/cc966545.aspx ,
38. 3226: prevents successful back
operations from being logged
• By default, every successful backup operation adds
an entry in the SQL 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.
39. 3014: More information on Backup
• undocumented
• returns more information to the ERRORLOG about
BACKUP.
40. 3004: More More information on Backup
• undocumented
• returns more information to the ERRORLOG about
BACKUP include Creation the backup file or
Padding to the backup file.
41. All about backup
•“It's just simple being in simplicity or
It's not folly to be in full”
ISUG Dubi Lebel ISUG May 12
43. 4199 : Query processor
• KB 974006
• added in Cumulative Update 6 for SQL Server 2005 Service
Pack 3 (SP3), Cumulative Update package 7 for SQL Server
2008, Cumulative Update 7 for SQL Server 2008 Service Pack
1 (SP1), and SQL Server 2008 R2.
• Because of the policy change to put query processor fixes under
a trace flag, even if you are running with the latest hotfix or
cumulative update installed, you are not necessarily running SQL
Server with all the latest query processor fixes enabled.
• TF 4199 enable all the fixes that were previously made for the
query processor under many trace flags. In addition, all future
query processor fixes will be controlled by using this trace flag.
44. 3502: Prints a message to the log at
the start and end of each checkpoint.
47. more
• Trace flag 2528 disables parallel checking of objects during
DBCC CHECKDB, DBCC CHECKFILEGROUP and DBCC
CHECKTABL
48. More Important UDTF
• 8602 Ignore index hints that are spe-cified in query/procedure.
• 8722 Dis-able all other types of hints. This includes the OPTION
clause.
• 8755 Dis-able any lock-ing hints like READONLY. By set-ting
this, you allow SQL Server to dynam-ic-ally select the best
lock-ing hint for the query.
"DBCC documented and undocumented, useful or un-useful"There are a lot of undocumented DBCC in SQL Server, some of them for developer debugging, other for testing small set are for Support engineers but... Many of them could be useful for DBAs and many of them are dangerous…in part 1- 'the introduction' we will try to answer: how to find those DBCCs? how to find minimal official documented? and how to use them?part 2-'when and what undocumented should I use' will deal with DBCC that can help us like the DBCC CORRUPT(dbname|dbid)
--SET NOCOUNT ON--GO--IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[test]') AND type in (N'U'))--DROP TABLE [dbo].[test]--GO--CREATE TABLE [dbo].[test](-- [i] [int] NOT NULL,-- [j] [int] NOT NULL,-- [d] [datetime2](7) NULL,-- [FFU_FHR] [char](5000) DEFAULT 'some default st' NOT NULL--) ON [PRIMARY]--GO--CREATE CLUSTERED INDEX [cix_test] ON [dbo].[test] --(-- [i] ASC)--GO--DECLARE @i INT = 0--WHILE @i < 20000--BEGIN-- INSERT test(i, j, d) -- SELECT @i, -- CASE WHEN @i % 2 = 0 THEN @i ELSE 2000000 - @i END,-- SYSDATETIME()--END--GODBCC TRACESTATUS GOSET STATISTICS IO ONGOselect 'Starting', cast (SYSDATETIME() as time)GODBCC DROPCLEANBUFFERS; GO SELECT MAX(d) FROM test;GOselect 'Without TF ', cast (SYSDATETIME() as time)GODBCC TRACEON(-1, 652) DBCC DROPCLEANBUFFERS; GO SELECT MAX(d) FROM test;GODBCC TRACEOFF (-1, 652) GOselect 'with TF', cast (SYSDATETIME() as time)GO
Set NoCount OnGO--DBCC TRACEON (1117,-1)--GO--Create database with 4 files keeping unequal size USE master GO IF EXISTS(SELECT 1 FROM sys.databases where name='1117') DROP DATABASE [1117] GO CREATE DATABASE [1117] ON PRIMARY( NAME = N'1117', FILENAME = N'C:\\MSSQL\\DATA\\1117.mdf', SIZE = 3072KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ), -- first Data file 3 MB( NAME = N'1117_1', FILENAME = N'C:\\MSSQL\\DATA\\1117_1.ndf', SIZE = 1024KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ), -- all other files only 1 MB( NAME = N'1117_2', FILENAME = N'C:\\MSSQL\\DATA\\1117_2.ndf', SIZE = 1024KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ), ( NAME = N'1117_3', FILENAME = N'C:\\MSSQL\\DATA\\1117_3.ndf', SIZE = 1024KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON( NAME = N'1117_log', FILENAME = N'C:\\MSSQL\\DATA\\1117_log.ldf', SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%) GO --script to get file size initially --SELECT name, (size*8)/1024 'Size in MB' FROM [1117].sys.database_filesSELECT file_id, name, [sizeInMb] = CONVERT(DECIMAL(12,2),ROUND(size/128.000,2)), [spaceUsedMb] = CONVERT(DECIMAL(12,2),ROUND(FILEPROPERTY(name,'SPACEUSED')/128.000,2)) FROM [1117].sys.database_filesWHERE (data_space_id = 1)---=-=-=-=-=-=-=-=-=-=-=--Now CREATE a table to populate the data USE [1117] GO CREATE TABLE Trash (name CHAR(8000)) GO INSERT Trash VALUES ('Trash for TF 1117') GO 700 --script to get file size after data insertion --SELECT name, (size*8)/1024 'Size in MB' FROM [1117].sys.database_filesSELECT file_id, name, [sizeInMb] = CONVERT(DECIMAL(12,2),ROUND(size/128.000,2)), [spaceUsedMb] = CONVERT(DECIMAL(12,2),ROUND(FILEPROPERTY(name,'SPACEUSED')/128.000,2)) FROM [1117].sys.database_filesWHERE (data_space_id = 1)GO ----INSERT Trash VALUES ('Trash for TF 1117') GO 200 SELECT file_id, name, [sizeInMb] = CONVERT(DECIMAL(12,2),ROUND(size/128.000,2)), [spaceUsedMb] = CONVERT(DECIMAL(12,2),ROUND(FILEPROPERTY(name,'SPACEUSED')/128.000,2)) FROM [1117].sys.database_filesWHERE (data_space_id = 1)--DBCC TRACEOFF (1117,-1)--GO
Set NoCount OnGOdbcctracestatusGOUSE DBCC_DEMOGOUSE [DBCC_DEMO]GOIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DL_1]') AND type in (N'U'))DROP TABLE [dbo].[DL_1]GOCREATE TABLE [dbo].[DL_1]( [i] [int] NULL, [c] [char](10) NULL) ON [PRIMARY]GOIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DL_2]') AND type in (N'U'))DROP TABLE [dbo].[DL_2]GOCREATE TABLE [dbo].[DL_2]( [i] [int] NULL, [c] [char](10) NULL) ON [PRIMARY]GO--OPEN Secund TABinsert DL_1 values(1,'abc')GO------=-=-=-=-=-=-=Begin tranupdate DL_1 set c='efg'where i =1--UPADTE in Sec tabupdate DL_2 set c='Def'where i =2---rollback tranDBCC TRACEON(1204, 3605,-1)DBCC TRACEOff(1204,1205,1222, 3605,-1)DBCC TRACEON(1205, 3605,-1)DBCC TRACEON(1222, 3605,-1)exec sp_readerrorlog-----------------------------Set NoCount OnGOinsert DL_2 values(2,'abc')GO---Begin tranupdate DL_2 set c='efg'where i =2----update DL_1 set c='efg'where i =1----rollback tranEXEC sp_cycle_errorlog ; GODBCC TRACEON(1204, 3605,-1)DBCC TRACEOff(1204,1205, 3605,-1)DBCC TRACEON(1205, 3605,-1)DBCC TRACEON(1222, 3605,-1)exec sp_readerrorlog
Set NoCount OnGOuse master;GODBCC TRACEON(3004,--3014,3604,3605,-1);GORESTORE DATABASE [AdventureWorks2008R2] FROM DISK = N'C:\\Program Files\\Microsoft SQL Server\\MSSQL10_50.VULCAN\\MSSQL\\Backup\\AdventureWorks2008R2.bak' WITH FILE = 1, NOUNLOAD, STATS = 10GODBCC TRACEOFF(3004,3014,3604,3605,-1);--DBCC tracestatus()--sp_readerrorlogDBCC TRACEON(3004,3014,3604,3605,-1);create database ttt;EXEC sp_readerrorlog; drop database ttt;EXEC sp_readerrorlog;DBCC TRACEOFF(3004,3014,3604,3605,-1);
Set NoCount OnGODBCC tracestatusDBCC traceon(3502,3604,3605,-1)CHECKPOINT exec sp_readerrorlogDBCC traceoff(3502,3604,3605,-1)