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.

SQL> col PARTITION_NAME for a32
SQL>  select partition_name,read_only from dba_tab_partitions where table_name='ORDER_TAB';

PARTITION_NAME                   READ
-------------------------------- ----
CREATED_2105_P10                 NO
CREATED_2105_P11                 NO
CREATED_2105_P12                 NO
CREATED_2105_P8                  NO
CREATED_2105_P9                  NO
CREATED_MX                       NO

6 rows selected.

SYNTAX – ALTER TABLE MODIFY PARTITION READ ONLY;

SQL> alter table dbatest.ORDER_TAB modify partition CREATED_2105_P10 read only;

Table altered.

SQL>  select partition_name,read_only from dba_tab_partitions where table_name='ORDER_TAB';

PARTITION_NAME                   READ
-------------------------------- ----
CREATED_2105_P10                 YES
CREATED_2105_P11                 NO
CREATED_2105_P12                 NO
CREATED_2105_P8                  NO
CREATED_2105_P9                  NO
CREATED_MX                       NO

6 rows selected.

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.

SQL> alter table dbatest.ORDER_TAB modify partition CREATED_2105_P10  read write;

Table altered.

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.

SQL> alter table dbatest.ORDER_TAB modify partition CREATED_2105_P10,CREATED_2105_P11,CREATED_2105_P12 read only;
alter table dbatest.ORDER_TAB modify partition CREATED_2105_P10,CREATED_2105_P11,CREATED_2105_P12 read only
*
ERROR at line 1:
ORA-14004: missing PARTITION keyword