What should you do to prevent this? You can break a channel into the ice dam so the water can flow down (or if you're like my dad in this picture, get a ladder and completely hammer the ice away... though this isn't the safest technique so maybe hire a professional to do it instead). Definitely don't use a crazy power tool that may only cause additional harm to your roof! You could also take some old, long socks and fill them with calcium chloride (NOT rock salt) and lay them perpendicular to the edge of the roof.
Check out this video of Geoff Gordon explaining ice dams, including how to open them up safely and let the water drain to prevent damage to your home.