Ok, I found this on the net:
Why do dogs hump? Dogs humping humans may amuse other humans, but rarely the human who's being humped. Some dogs will hump a toy or sofa cushion incessantly. We accept dogs humping other dogs in the act of mating, but in other situations it can create problems. What does all this humping mean, and what can we do about it?
Early Days
Puppyhood socialization to another dog of the opposite sex can help a dog orient sexual behavior for adulthood. Whether you're going to breed the dog or not, it helps for the dog to develop the concept that sexuality is toward other dogs, not humans or pillows.
Much of the humping you'll see among puppies as well as among adult dogs is play. Some of it expresses dominance, but that's not always the case.
If a dog persists in humping another dog in a social situation, distracting the dog who's doing the humping into another activity is a good idea. For one thing, it's best that a dog not get obsessed with humping. Besides the potential annoyance to others, it can even result in physical irritation. When you consistently interrupt the humping, you prevent it from becoming a strong habit in the dog.
Secondly, being humped can become oppressive to the dog who is the target, so that's another reason to interrupt. This is a common complaint in situations where dogs get together to play, such as dog parks. Just distract the humping dog, without punishment of any kind.
THE CANINE BEHAVIOR SERIES
By Kathy Diamond Davis
Author and Trainer