Thursday, May 6, 2010

11g new feature - READ ONLY TABLES

Starting with 11G there is very useful feature - read only table.

SQL> create table myt1 as select * from all_objects;

Table created.

SQL> select read_only from dba_tables where table_name = 'MYT1';

REA
---
NO

SQL> update myt1 set object_id = object_id*2;

71304 rows updated.

SQL> commit;

Commit complete.

SQL> alter table myt1 read only;

Table altered.


SQL> select read_only from dba_tables where table_name = 'MYT1';

REA
---
YES

SQL> update myt1 set object_id = object_id*2;
update myt1 set object_id = object_id*2
*
ERROR at line 1:
ORA-12081: update operation not allowed on table "SYS"."MYT1"

SQL> alter table myt1 read write;

Table altered.

SQL> update myt1 set object_id = object_id*2;

71304 rows updated.

No comments: