Read only Table

A table can be set READ ONLY mode to restrict write operations.

SQL> alter table EMP read only; Table altered
 * Enable table for READ-ONLY

SQL> select table_name, read_only from user_tables where table_name='EMP'; TABLE_NAME                    READ_ONLY -- - EMP                           YES
 * The READ_ONLY column of the user_tables confirms the change.

SQL> update EMP set SAL=2000 where ENAME='SMITH'; update EMP set SAL=2000 where ENAME='SMITH' ORA-12081: update operation not allowed on table "USER1"."EMP"
 * Making an attempt to do DML will fail.

SQL> alter table EMP read write; Table altered SQL> select table_name, read_only from user_tables where table_name='EMP'; TABLE_NAME                    READ_ONLY -- - EMP                           NO
 * Enable table for READ-WRITE