Pain is something difficult to tolerate. Some spiritual texts say since everything is maya (illusion), pain also is maya and just ignore it. I don't think it is possible to ignore a dental pain or even a small pebble in the show.
Does this mean the spiritual texts are wrong? It is both right and wrong. As long as we are in maya, we need to experience pain (and ofcourse pleasure) and once you are above maya, there is no pain. So while what spirituality says is correct, a general philosophy that every thing is maya does not help. You need to start where you are.
So here are some suggestions to deal with pain:
1) Consider that pain is indeed not real in a certain dimension. So even if you are facing pain now, aware of this point.
2) Take doctor's advice and meditation as required. Be reasonable and realistic to your present state.
3) Some times contemplating on pain helps. It is explained below.
How to contemplate on pain?
First read fully and then do this exercise with closed eyes.
Sit or lie down comfortably and relax your body from toe to head.
Scan your body from toe to head a couple of times, checking for further relaxation.
You may not be able to relax the pain location and surrounding areas. This does not matter, actually this exercise helps you isolate the pain area.
Now focus on the pain area and start mentally observing and trying to find answers to the following questions: where is the pain? how big is the area? If you have draw a center point for pain where is it exactly? Is the pain intensity coming down from a center? Is the pain on the surface of the body or inside the body? What is the color of the pain? Does the pain give any sound or noise? What is your body's response? Is the body reacting to the pain with tightening of the muscles? Is the pain intensity varying or fixed? Is it a nagging pain or a blasting pain? Is the pain traveling from one place to other in your body? Are there other areas in your body reacting sympathetically to your primary pain? What else you observe in your body related to this pain?
Do this for around 5-10 minutes or as long as you feel comfortable. While you are doing this, you may find pain disappearing some times or the intensity reduced or varying. Still continue with the exercise.
Gradually get up and note down your observations and insights. You can repeat this meditation 3 times a day when you are in pain.