This is a simple circuits to switch between two different voltage sources using two diodes.. No need of any relay or complicated circuits.If you are using schottky diodes then voltage drop will reduced.
when we connect to voltages we get the highest one on the output.Here in this example if we connect 9v first then the output voltage will be 8.6v(9v-diode drop) and when we connect 12 v in this circuit we will get 11.4v(12v-diode drop)
Step 1: Circuit
Step 2: Components
The diode part numbers are not critical. Just select diodes that match the current needed by your circuit and voltage drop of diode
Thank you very much