You can use diodes on both the auxillary battery and the main 12V supply to prevent either from feeding into the other. This is fine and will do what you want.
However, the main problem is the auxillary battery. Wouldn't it be best to use a rechargeable battery? A small 9V battery may not be...