Check partition read only in Oracle
Check the status for partition
col PARTITION_NAME for a32
select partition_name,read_only from dba_tab_partitions where table_name='TRAN';
PARTITION_NAME READ
---------------- ----
TRAN_202101 NO
TRAN_202102 NO
TRAN_202103 NO
TRAN_202104 No
Modified the partition into Read only state.
ALTER TABLE table_name MODIFY PARTITION partition_name READ ONLY;
Example
ALTER TABLE scott.tran MODIFY PARTITION tran_202101 READ ONLY;
Modified the partition into Read write state.
ALTER TABLE table_name MODIFY PARTITION partition_name READ WRITE;
Example
ALTER TABLE SCOTT.TRAN modify partition TRAN_201601 read write;
Script for converting all read-only partition to read-write for a table or vice versa
--Convert read only partition to read write.
SELECT 'ALTER TABLE '||table_name||' MODIFY PARTITION '||partition_name ||' READ WRITE;' from dba_tab_partitions where read-only = 'YES';
--Convert read write partition to read only.
SELECT 'ALTER TABLE '||table_name||' MODIFY PARTITION '||partition_name ||' READ ONLY;' from dba_tab_partitions where read-only = 'NO';