What type of back pain is it? Skeletal, muscular, just tightness that you can't pinpoint the cause of? The technique could vary drastically depending on what is causing the pain. This is always the starting point especially for lower back issues assuming no unrecooperated injuries. Usually the cause for lower back pain has to do with over or under active muscles and this would address the underactive muscles. To pinpoint the remedy though, you would ideally do a fitness assessment. Overhead squat assessment, pushing/pulling assessment etc and a properly trained person could tell you what the corrective exercises/stretches would be. If you are able to be unbiased and objective toward yourself, you could even do these yourself. You might add 15 minutes a day to what you're already doing at the gym (and get some weird looks) but a pain free back is worth it IMO.