This is my 39th blog on SQL Server Trace Flag 4013 in the series of One Trace Flag a Day. You can go to all blogs under that series by clicking here.
Trace flag 4013 write entries in error log whenever a new connection established. These entries contain login name and SPID also. Let me enable this trace flag first.
use master go DBCC TRACEON(4013,-1) go exec sp_cycle_errorlog
Now you can try to make a new connection. Let me try to connect the same instance through SSMS for login as sa. Now run the below commend.
The output will show you some entries like mention below:
Login: sa WIN-XXXXXX server process ID (SPID): xx, kernel process ID (KPID): xx.
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.
use master go DBCC TRACEOFF(4013,-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.
Prince Kumar Rastogi