Redundant power supply for arduino uno

Hi!
I want to connect my arduino using two power supplies, for example a typical 230acto9vdc supply connected to the plug of the board and a 5v battery connected by usb.
I that way i want to keep the system active even if the ac supply turns off.
Is possible make that connection in a safe way?

Thank you.

Arduino UNO R3 has a power source on board solved by that way. It selects automatically between power from USB and power connector.

EDIT: Just for completion. USB source will be used in case of missing power on jack connector.

You mention "5 volt battery" for the usb input. The voltage applied to the usb input must be a regulated, clean +5 volt dc supply, it cannot come from an unregulated battery connection - as this voltage goes directly to the UNO's two ATmega processors. This voltage also provides the VREF signal to the analog section of the 328P so any noise on that supply will cause unending grief with analog signals.

The Uno gives priority to the power input jack. If there is no voltage present there, the power is supplied by the +5 supply from the USB connector. So, you really have nothing to do to implement your desired behavior with two power sources.

great! thank you a lot.