What is the formula to determine a dominant scale in any major keys?
If you mean the scale for the dominant chord in a major key, then it would be the Mixolydian on the fifth scale degree. Example, in key of C, the fifth will be G so the chord would be G7 and G mixolydian would be the associated scale.
If however you are talking about other types of dominant scale, i.e., Phrygian dominant, Lydian dominant etc., then things can get a bit complicated.
The short answer is to take any scale or mode and alter it so that both the 3rd is major and the 7th is flat. This might often result in the notes simple becoming another common scale type. For example, D Dorian has a b3rd and the notes are D E F G A B C. If we raise the b3rd to a major 3rd then it becomes an F#. This just makes it a G major (Ionian) scale, so calling it a Dorian Dominant would be pointless.
Others like the Lydian has a #4 and already has a major third. The 7th is major so if we flatten it then we have a Lydian dominant. We could also just call it a Lydian b7 and probably other names too if I thought hard enough about it.
Personally, this kind of stuff is of no use to me so I don’t think much about it.