The bear spray works but you can also use a mixture of a pint or water with a few drops of dish-washing soap and three tablespoons of ammonia.
That mixture will put a dog on the ground in a hurry.
But the bear spray has a longer range
It actually does not have as long a range as one might think. The can advertises a very long range, 25 ft I think, but it seems to dissipate between 6-8 feet.
I would not want to test this against a charging grizzly at all, ever, for any reason.
It took three blasts over a period of about one minute to convince the second pit to leave. I do not think a grizzly would be so generous with his time.