Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: how can you protect read-only indexes?
On Thu, 3 Mar 2005 12:49:24 -0400, Juan Carlos Reyes Pacheco
<juancarlosreyesp_at_gmail.com> wrote:
> Hi carmen, move to a tablespace, and make it read only.
what like this? read only doesn't necessarily mean what you think.
SQL>drop tablespace test including contents and datafiles;
Tablespace dropped.
SQL>create tablespace test
2 datafile 'c:\oracle\product\10.1.0\oradata\test.dbf' size 10m ;
Tablespace created.
SQL>CREATE TABLE T1(C1 NUMBER)
2 TABLESPACE TEST;
Table created.
SQL>CREATE INDEX IDX1 ON T1(C1) TABLESPACE TEST; Index created.
SQL>BEGIN
2 FOR I IN 1..1000
3 loop
4 EXECUTE IMMEDIATE ' INSERT INTO T1 VALUES (:1)' USING I;
5 END loop;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL>commit;
Commit complete.
SQL>ALTER TABLESPACE TEST READ ONLY; Tablespace altered.
SQL>insert into test values (3);
insert into test values (3)
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL>insert into t1 values (3);
insert into t1 values (3)
*
ERROR at line 1:
ORA-00372: file 7 cannot be modified at this time
ORA-01110: data file 7: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\TEST.DBF'
SQL>DROP INDEX IDX1; Index dropped.
SQL>DROP TABLE T1; Table dropped.
SQL>
-- Niall Litchfield Oracle DBA http://www.niall.litchfield.dial.pipex.com -- http://www.freelists.org/webpage/oracle-lReceived on Thu Mar 03 2005 - 12:16:04 CST