When a nightmare happens, you can use the following methods:
1, turn your neck, and generally try to turn and wake up;
2, try to relax, don't be nervous, let the breathing be even, and slowly wake up.
3, you can set an alarm clock, if possible, you can wake up people around you.
4, be sure to pay attention, don't sleep immediately after waking up, it is easy to have nightmares again. Sit up and sober yourself up.
The most effective method for nightmares is prevention:
1, don't sleep on your back or on your stomach, it's better to sleep on your side.
2, the pillow should not be too high
3. Stay up late less and have a reasonable rest.
However, medicine also says that this may be related to psychology and heredity, which I can't say.