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’ ’126.96.36.199′ ) */.
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 188.8.131.52 and 184.108.40.206: Patch 13371104: LOCK ORDER HAS CHANGED BETWEEN 10.2.0.5 AND 220.127.116.11.
Read more: Simple example