I forgot to mention that there are also a few therapeutic interventions for nightmares. One I've tried and found helpful is Image Rehearsal Therapy. In the morning when you first wake up and the nightmare is most clear in your mind, you write it down with as much detail as possible, trying to really create a vivid picture in your mind. But you change the ending so that you emerge victorious--defeat the attacker, escape, get rescued, any positive ending. Then you read that several times throughout the day, each time trying to really emerse yourself in it and create as vivid an experience in your mind as you can, focusing on the positive ending. You also do it right before bed, maybe when you get in bed. I've only tried it a couple times because sometimes I don't remember the nightmares well enough to do it, but it really helped. If you have a trauma-informed therapist, he or she can probably help you with it.
I also have a therapist who's trained in art therapy, and we sometimes do kind of the same thing, but through visual representations of the nightmare. A couple days ago I had a bad one and I drew a picture with oil pastels of these big black figures with red arms reaching toward me, a small figure (I was a child in the dream) with no arms or legs, just a little snowman-shaped ball of a lot of colors to represent the intense and varied feelings. My therapist and I talked about it and she gave me a couple ideas of how to change it. The one I picked was to cut myself out and glue myself onto a picture of a safe place, adding in whatever would make me feel most safe and happy. Some people really don't like art therapy, but if you do, it's pretty cool