I was hoping to get a response back to my request for more informaiton but don't want you to go without an answer either.
Many older dogs can develop health issues fairly quickly especially older dogs and at 9 a shepherd is considered elderly. If he is not eating and drinking normally or if he has excessive diarrhea or is vomiting, I'd go ahead and have him seen by your vet for a senior check up.
If he is otherwise fine, then it is possible he is developing Cognitive Dysfunction Syndrome (CDS) and has been seen in younger than your dog. There is a wonderful site that explains it well and also explains how to document your dog's behavior and discuss it with your vet.
The good news is that there is a drug called L-Selegeline (Anipryl (R)) which has been recently approved for use in the clinical indication of cognitive dysfunction (CDS) in dogs. Please see this site for more information and other causes that may exhibit the same symptoms.
I would also rule out an external cause for the behavior such as something outside, etc. A bout of loose stools will cause a dog to act in this manner as well. If you feel this might be the cause you might try a tablespoon of canned pumpkin (not pie filling) to his food to help stop loose stools.
If you want to answer the questions I asked, it may help narrow down what might be the cause. I hope this information is helpful to you. If you would like any additional information or have more questions please don’t hesitate to press the reply to expert or continue conversation button so I can address any issues you still have . If you do find this helpful, please take this opportunity to rate my answer positively so I am compensated for my time.