How to force grant all badges from command line?

Thanks, I reviewed queries quickly and fixed one a bit and it only took ~1k seconds now. I also cross-posted my SQL-optimization question in a separate topic.

Back to the badges - it now worked and all badges are granted. Thank you for your assistance and prompt replies.