Years back, a friend and his wife woke to an intruder in their apartment. They had a pump SG and a Garand under the bed. Each grabbed one. The intruder stuck his head into their bedroom. They racked the slide on the shotgun. The intruder calmly turned and spent the next 15 minutes rummaging through the house taking whatever he fancied, before leaving. The ammo was in another part of the house. But, the point is, racking of the shotgun, as well as seeing, two armed occupants, did absolutely nothing to discourage this guy.
I know this is where folks chime in with, "an empy gun is useless" or "He wouldn't have walked away from my house". What any of us will do at times like that is another question. This is only about the idea that racking noise from a shotgun is an effective deterrent. It wasn't in that one case.