As you've just discovered, long-duration exposures of the night sky can be fogged. And although @AstroDave's post processing shows that it's possible to remove the background fog to create a dark sky, the fog does limit the visibility of fainter stars and thus
The longest possible exposure time (for a given ISO and aperture) depends on:
1) your camera sensor's dark current
2) the quantity of light pollution (city lights + moon light).
3) the quality of the atmosphere (humidity, haze, dust, smoke, etc.)
Issue #1 is something you can test in the comfort of your home. To do so, turn off long-shutter time noise reduction. Next, put the lens cap on, cover the viewfinder eyepiece, place the camera somewhere dark, and shoot a 1 hour, 2 hour, or whatever long duration image of absolute darkness. You'll find that even in pitch darkness, the image will have a speckled fogginess that gets worse with longer durations and at higher temperatures. Hard-core astrophotographers use cameras with chilled sensors and take special care to collect "dark frames" which are long duration test shots that record the pattern of the sensor's dark current and enable them to subtract that part of the image fog.
Issue #2 is the easiest to control but typically means driving somewhere that's very dark and then only shooting when there's no moon. Other's have posted a link to a light pollution map you can use to find suitable locations with less light.
Issue #3 is harder to control but websites such as Clear Outside (
Clear Outside v1.0 - International Weather Forecasts For Astronomers ) can help you forecast the quality of atmosphere at your location to pick nights that are more likely to yield decent images. Clear Outside also gives International Space Station passovers and moonrise/moonset times.
Issues 2 & 3 aren't exact sciences so it's a good idea to try to measure the actual light pollution and haze conditions when you get to the site. One tip is to do a high-ISO test photo before doing a really long duration shot. Multiply the ISO you plan to use by 64 or increase the ISO by 6 stops (e.g., ISO 100 becomes ISO 6400) and take a shot where the number of minutes of exposure in the test shot equals the number of hours you plan for the real shot (a 2 minute high-ISO exposure provides a test for 2 hour low-ISO exposure). (Or you can do one with the number of seconds in the test shot equals the number of minutes in the planned shot: 45 seconds at high ISO simulates 45 minutes at low ISO). The point is to get a sense of the quality of the sky.
Have fun!