I think the advice so far on nightmares has been reasonable, I don't have much experience with them, usually though my son woke up immediately if he was having a nightmare.
But, if instead of nightmares, they're night terrors where their eyes might be open but you can't wake them up or get them to calm down I have some very practical advice.
The first time it happened with my son, he cried for about 30 minutes while staring blankly at us. It was terrifying for us, my husband did a lot of on-line research into them. They usually start a little older than 2 but Cian was two. The consensus seems to be that for some reason it's associated with their feet being too hot. So, to prevent them, get the kid out of footed pajamas or socks. Bare feet to sleep with, and make sure the blanket is easy to kick off. If they have a night terror put a cool wet washcloth on their feet.
The night after the first one he had another one, we put a wet washcloth on his feet, he stopped crying and was soundly asleep and has never had another one since. We now tell it to everyone. It's weird, but in some ways it makes sense.