I've done quite a bit of research on bear attacks in Alaska.
It appears that there are a number of traits common in the successful repulsion of surprise bear attacks with a firearm:
1. The person had a gun. . Seriously, the most important factor in surviving the attack was that the person had a gun they could reach instantly, i.e., in a holster, not propped up against a nearby tree, in the truck, in the cabin, etc.
2. The person had a handgun. Some of the attacks were repelled by one buddy with a handgun when the other buddy could not raise his longgun fast enough. This occurs more often than you would think.
3. Smaller calibers are effective. This is the one that shocked me. Although some of the successful folks used .44 mags or .45 LC's, a number of them used 9mm's and .40 cals (and some were using ball ammo). In one account in particular, two buddies were fishing. A brown bear charged one buddy so fast, he couldn't raise his shotgun to fire, so he through it at the bear and dove into the water. His companion shot the bear with a 9mm pistol (ball ammo), and one of the shots broke the bear's shoulder. Once the bear was disabled, other fishermen joined in with their handguns and killed the bear.
4. The handgun appears to be effective because it is always there. The hunter/fisherman draws and shoots in an instant. The handgun might night kill the bear, but it often disables the bear sufficiently for the hunter/his companion to procure another handgun/long gun and then the bear is killed. Some local's have said "use the handgun to fight your way back to your rifle".
5. One last surprise. Urban legends aside, I found no documented evidence where an outdoorsman was able to shoot the bear (regardless of caliber) but was unable to repel the attack. There were some close calls, but nobody who got off a shot died. Not saying it hasn't happened, just saying I haven't seen it.
6. Final recommendation. If it were me, I'd bring something like a Glock/XD etc that is light enought to carry with me everywhere I go. I'd load something hot and non-hollow point.
Good luck and have fun,
David