There is well-known bug with “for update order by” on 11.2, when rows locks not in specified order, although the ordering occurs.
I already wrote on my russian blog about the appearance of “buffer sort” in plans with “for update” even if sort order was not specified. And this behavior can be disabled for example by specifying /*+ opt_param( ‘optimizer_features_enable’ ’220.127.116.11′ ) */.
But if we want to solve problem with deadlock, we need to force index full scan/index range scan ascending with “buffer sort” usage.
UPD: The patch is already available for 18.104.22.168 and 22.214.171.124: Patch 13371104: LOCK ORDER HAS CHANGED BETWEEN 10.2.0.5 AND 126.96.36.199.
Read more: Simple example