Fortunately, we only had this problem for a very short time and it did not happy very often. For us, he did it when he was feeling under-stimulated and needed more to do and had tons of pent up energy that we were not aware of. Correcting this behavior is obviously the first thing. This is why teaching your dog a "settle" type of command is so helpful. Then once he settles, you can start letting him get his energy out through games/activities, whether they are physical like fetch/walking/running or mentally stimulating like doing tricks or learning new ones. Our favorite mentally stimulating game to play with Yusuke is "find." We tell him to stay. We go to hide his treat in another room. Then we come back and say "find" and he comes looking and sniffing around for the treat we've hidden.