Sometimes, playing dead against a brown bear attack works.
Do not try that with a black bear or a polar bear.
Do not try that until acting confidently and standing your ground has failed.
If retreat is possible to a refuge, that has worked (a cabin, a vehicle, up a sturdy tree (climbing trees is generally a bad idea, it signals to the bear you are afraid), into water deep enough to let you stand and the bear has to swim). Improvised weapons can work. Knives have worked. Bears have been killed with rocks.
Bear spray also works, a good bit of the time. It is not near 98% effective, and is likely considerably less than 90% effective against aggressive bears. It is very difficult to measure such a metric.
If one had a superior way with animals, and a good measure of confidence, perhaps tummy rubs could be worth a try.