sql server trace flag 3504

Hi Friends,

This is my seventh blog on SQL Server Trace Flag 3504 in the series of One Trace Flag a Day. You can go to all blogs under that series by clicking here.

Trace Flag 3504 is related to SQL Server Checkpoint. I hope we all are aware of checkpoint in SQL Server. Those who are not aware of it click here.

Sometimes during troubleshooting you may need such type of information like what checkpoint does behind the scene. This trace flag can really help you in such scenario. If you will enable Trace Flag 3504, then it will write checkpoint internal activity information in the SQL Server error log.

Let me show you this practically:

Use master
go
DBCC TRACEON(3504,-1)
go
create database CheckpointTest
go
alter database CheckpointTest set recovery SIMPLE;
go
use CheckpointTest
go
create table checktable
(a int, b int)
go
insert into checktable values(101,232)
go 100
exec sp_cycle_errorlog
go
checkpoint
go
use master
go
DBCC TRACEOFF(3504,-1)
go

From the above code, I will show you the error log entries for checkpoint due to trace flag 3504. To see the error log entries run the below command.

exec xp_readerrorlog

trace_flag_3504

   

You can use both trace flags 3502 and 3504 for more clarity. Now you can get checkpoint internal information between checkpoints started and ended messages.

Use master
go
DBCC TRACEON(3502,3504,-1)
go
create database CheckpointTest2
go
alter database CheckpointTest2 set recovery SIMPLE;
go
use CheckpointTest2
go
create table checktable
(a int, b int)
go
insert into checktable values(101,232)
go 100
exec sp_cycle_errorlog
go
checkpoint
go
use master
go
DBCC TRACEOFF(3502,3504,-1)
go

trace_flag_3504_2

PS: Do not use trace flags in production environment without testing it on non production environments and without consulting because everything comes at a cost.

HAPPY LEARNING!

Regards:
Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook

   

About Prince Rastogi

Prince Rastogi is working as Database Administrator at Elephant Insurance, Richmond. He is having more than 8 years of experience and worked in ERP Domain, Wealth Management Domain. Currently he is working in Insurance domain. In the starting of his career he was working on SQL Server, Internet Information Server and Visual Source Safe. He is post graduate in Computer Science. Prince is ITIL certified professional. Prince likes to explore technical things for Database World and Writing Blogs. He is Technical Editor and Blogger at SQLServerGeeks.com. He is a regular speaker at DataPlatformDay events in Delhi NCR. He has also presented some in depth sessions about SQL Server in SQL Server Conferences in Bangalore.

View all posts by Prince Rastogi →

Leave a Reply

Your email address will not be published.