Automatic transfer switch or some such solution
A relay is the most simple solution, and very safe.  Most power relays are designed for continuous operation.  The coil warms up a bit, but not enough to cause insulation to break down, ignite something nearby, etc.

Many relays have contacts rated to switch both AC and DC.  Note that often the ratings for the two types of current are different.  Choose a relay with contacts that are rated for at least twice the maximum DC current in your circuit.

Once you have selected a relay, edit your question to include the manufacturer and part number.  A PDF file of the datasheet (or a link) will help us evaluate it.