Toothache refers to pain in or around the tooth that is generally created by pulp inflammation.

Considering the fact that pulp contains nerve endings, it is very sensitive to pain. Toothache may be the cause of:
Tooth decay
Tooth Abscess
Trauma to the tooth
Tooth fracture
A damaged filling
Infected gums
The type of pain can vary depending on the cause of it. It can be mild, severe and persistent or come and go. If your toothache continues for a couple of days, visit your dentist as soon as possible. If professional help isn’t immediately available, you can try following remedies:

Rinse your mouth with lukewarm salt-water
Use ice-compress
Use Clove Oil

Whereas the main cause of toothache is tooth decay, alleviating risk of the tooth decay can help prevent toothache. Hence, like most of oral problems, the best way to prevent toothache is maintaining oral hygiene by brushing, flossing and using mouthwash as a routine.