They are both energised all of the time except emergency situations. The essential devices can be switched between them, the non-essential ones will be turned off in such cases.
There is actually a couple more buses than two. The main ones, AC BUS 1 and 2¹, are powered by one engine-driven generator each, and are normally not connected. This has some advantages that
- the generators don't have to be synchronized, and
- if there is a short-circuit on one, the other remains functional.
The APU generator and external power are connected to a bar that can be connected to either and automatically connects to whichever is not powered. This bar can also be used for connecting the buses in case only one generator is running, and this can be controlled by a switch.
The essential devices, which means most cockpit instruments, are connected to a separate Essential AC BUS, which is normally connected to the AC BUS 1, but can be, manually, switched to AC BUS 2, in case AC BUS 1 does not work. It can also be powered by emergency generator (on RAT) or even an inverter from the batteries when RAT does not work (before it deploys and after landing during roll-out).
The even more important devices, including the flight control computers, are connected to the DC HOT BUSes directly powered by batteries.
So the essential devices can be switched when either bus is not energized. The non-essential devices like galleys, in-flight entertainment and cabin lights, will be powered off in that case. They will also be disconnected if the bus is energised, but does not have enough power (automatic load shedding).
¹ In the document I have they are not called A and B. The document document is (I got it off the internet², so it's not official copy for legal purposes) titled A318/A319/A320/A321 Flight deck and systems briefing for pilots and apparently created by Airbus (in 2007, but it's unlikely they changed this since)
² This or this is a slightly different version (even older, dated 1998), but the chapter 3. Electrical System has the same content. The included image is from the later link.