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