Do I need a transit visa if I am travelling from Marrakech to Oakland, California, with connections in Oslo, Norway and Barcelona, Spain. I have a 12-hour layover in Oslo and a 2-hour layover in Barcelona. I am a Moroccan passport holder and I am a US permanent resident.
Your problem is that the flight between Oslo and Barcelona is a Schengen internal flight which from an immigration point of view is treated like a domestic flight. So you will have to enter the Schengen area in Oslo and leave it in Barcelona.
An airside transit visa is no use to you because you have to enter the area. The Schengen area no longer issues landside transit visas. Therefore you will need a regular short stay Schengen Visa.