DBCC TraceOn – some processes are global.


I was recently doing some testing as I thought that I’d experiment with the ghost clean up process.

I found that I needed to enable Trace Flag 661 to disable this process.
So off I went and ran the following code


I then stated inserting records and deleting records, but I suddenly noticed (using DBCC PAGE) that my records were still being cleaned up.

So I ran the following code


and got the results

which made me think.

This task is a global task and needs to be enabled globally, like so

DBCC TRACEON(661 , -1);

I’ve not run into his before, so lesson learnt. Global processes seem to need the extra -1 parameter – you don’t seem able to say “keep running the global process – just miss it out on this particular database.”

Have a good day.



Tags: ,

About Martin Catherall

Martin Catherall is Senior SQL consultant at SQL Down Under, based in Melbourne, Australia. Martin is also a Microsoft Data Platform MVP and Regional Mentor (RM) for the Professional Association for SQL Server. Prior to relocating to Australia he was extremely active in the Christchurch, New Zealand data community - founding the local SQL Server user group and organizing SQL Saturday Christchurch - which later became SQL Saturday South Island. He likes learning interesting stuff about processing and storing data and passing on his knowledge. In his spare time he likes to learn guitar and hang out with his two young sons Callum Glen and Robert Michael.