A dog over six months old who is still having accidents is a problem. Unless he is having accidents because he is ill or neglected, you should come down hard on him and get the job of housebreaking over and done with. This includes the dog who is busy marking his territory off within your home.
You need to get a crate! Put the dog on a schedule, just as if you had a tiny puppy, and crate him in between walks. For the first week, treat him exactly as if he were a puppy, keeping him in the crate much of the time. That will get his attention. Then begin to keep him out when you know he’ll be good. Watch him carefully.
Crate him when you are not home. Make sure he does what he’s supposed to do on his walks and praise him for doing so. By using the crate, a schedule, the eyes of an eagle, you can housebreak any dog. Keep the crate clean and keep using it until the job is done.