Till now we can make a table read only, But what about setting few partitions of a table to read-only.

Thanks to Oracle 12.2 Release, We can do this. This is usually helpful, If requirement is to make the historical data not editable.

SYNTAX – ALTER TABLE MODIFY PARTITION READ ONLY;

If you tried to do any changes to the read only partition, it will throw below error.

ORA-14466: Data in a read-only partition or subpartition cannot be modified.

To make the read only partition to read write.

I tried to modify multiple partitions with one command. Seems we need can make a partition read only each with one command.
So if you wish to make 3 partitions read only, We need to run 3 ALTER TABLE MODIFY PARTITION command.

Leave a Reply