School shootings are a subset of homicides perpetrated by young people who are fundamentally suicidal. Successful prevention is possible, and it focuses on that profile rather than on situational specifics which are always different from one event to the next. Simplistic tactics like door locking procedures or arming teachers do not work, in part because they will always be practiced unevenly. Take a minute to read about the research behind those ideas in an article on FiveThirtyEight by Maggie Koerth: We’ve Known How To Prevent A School Shooting for More Than 20 Years.
