SQL Server Trace Flag 4031

Hi Friends,

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

Trace flag 4031 writes both bytes and ASCII representation of send buffer. Here you can see the data sent by SQL Server to client. Let me show you practically.

We can enable this trace flag globally. Let me enable it from startup parameters from SQL Server configuration Manager and restart the sql service.

traceflag_4031_1

Now run the below TSQL to check trace flag is ON or not and what is written to error log.

use master
go
exec sp_cycle_errorlog
go
DBCC TRACESTATUS()
go
exec xp_readerrorlog 
go

Trace flag 4031 is ON but Nothing written about send buffer in error log. Turn on the trace flag 3605 to log these things in error log.

use master
go
DBCC TRACEON(3605,-1)
go
exec sp_cycle_errorlog
go
select name from sys.databases
go
exec xp_readerrorlog

traceflag_4031_2

We can say it is working for us somewhat like DBCC OUTPUTBUFFER. If you ever used this trace flag ever for troubleshooting kind of thing then we will be more than happy to read your comments.

Don’t forget to turn off the trace flag 3605 and also remove the trace flag 4031 from startup parameters and restart the services.

use master
go
DBCC TRACEOFF(3605,-1)
go

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

Avatar

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. Required fields are marked *