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