Canker sores (or aphthous ulcers) can be terribly painful, both when touched or when food, especially acid food, touches the open sore. You might think in the era of high-tech medicine that someone would have found the cause of these nasty things, but to the best of my knowledge, no cause is known. They are not caused by the herpes virus, they don’t seem to be infectious, and I have never heard about them being transmitted through oral sex.
A dentist in Norway published a small study a year or so ago which supported the idea that sodium lauryl sulfate, the chemical in most toothpastes that makes them foam, caused or worsened aphthous ulcers.
There are toothpastes around such as Rembrandt Natural that do not contain this chemical, and some people who have switched to it seem to get sores less frequently, and the sores they do get are smaller.
If you do get a canker sores, there are a number of treatments that seem to make them heal faster and reduce the pain. Cauterizing them with a silver nitrate applicator hurts like the devil, but then seems to hasten the healing. Some people swear by a product often used by dentists, Kenalog in Orabase, a cortisone-type drug in a dental preparation that sticks better to the membranes in the mouth.
There are also local anesthetics in a sticky preparation that stays on the sore. Orajel Mouth-Aid is one of these, and it can be bought without a prescription, unlike the first two treatments I mentioned which require a prescription or visit to the doctor.