Total Pageviews

July 17, 2021

7/17/2021 12:37:00 PM

 From Release 11g onwards one can make the table as READ only.By doing so we can restrict DML operations.

How to do it a table as READ ONLY


alter table table_name read only;

How to change it to read write?

alter table table_name read write;

CREATE TABLE EMP_READ_TEST

(EMPNO NUMBER):


SQL>CREATE TABLE EMP_READ_TEST

(EMPNO NUMBER);


SQL>INSERT INTO EMP_READ_TEST

VALUES(1001);

ORA-12081:update operation not allowed on table 

SQL>UPDATE EMP_READ_TEST

SET EMPNO=2

ORA-12081:update operation not allowed on table 


SQL>DELETE FROM EMP_READ_TEST

ORA-12081: update operation not allowed on table

SQL> alter table EMP_READ_TEST read write;

SQL>DELETE FROM EMP_READ_TEST

1 row deleted.

The read-only status of tables is displayed in the READ_ONLY column of the [DBA|ALL|USER]_TABLES views

 
Related Posts Plugin for WordPress, Blogger...