How locks work with move partition ONLINE on Oracle 12c

With the release 12c Oracle introduced the “online partition movement” making the operation a non-blocking DDL command. This means that it’s possible to run any DML on a partition while the same is being “moved” using the new ONLINE option.
Let’s see how that works on our usual test table populated with 1 million rows in the first partition

Now let’s try to get advantage of the online move partition running the exact same test case. In one session we can execute

1

altertableMYTABmovepartitionP1onlinecompressforOLTP;

and before it ends in another one session we run

1

2

3

4

updateMYTAB

setid=id

whererun_date=date'2016-01-01'

andrownum=1;

without commit. Are you maybe still waiting for the first operation to complete? Well, you will not see it finishing unless you close the transaction you started with the update! Yes, that’s the peculiar thing with online movement: the DDL is not blocking anymore but it cannot end if there are uncommitted transactions on the same partition.
We can again take a look at the locks and see that this time the DML is holding the DDL

and this is a great way deal with big tables whose indexes require a lot of time to be rebuilt!
Interestingly, if we first run the DML leaving the lock and then execute from another session an ONLINE move operation, we don’t get any exception (like it happened for the non-online execution) but the DDL waits for the DML lock to be released.