#Example 1
$ sqlplus dbadmin
Enter password:
Enter password:
SQL> show parameter deferred_segment_creation
NAME TYPE VALUE
------------------------------------ ----------- ------
deferred_segment_creation boolean TRUE
SQL> create tablespace DFS datafile size 10M;
Tablespace created.
SQL> SQL> create table JUNK ( col1 number ) tablespace DFS;
Table created.
SQL> SELECT OWNER,SEGMENT_NAME,BYTES/1024/1024 MB FROM DBA_SEGMENTS WHERE SEGMENT_NAME='JUNK';
no rows selected
SQL> insert into JUNK values (100);
1 row created.
SQL> set linesize 168
SQL> SELECT OWNER,SEGMENT_NAME,BYTES/1024/1024 MB FROM DBA_SEGMENTS WHERE SEGMENT_NAME='JUNK';
OWNER SEGMENT_NAME MB
---------- ---------------------
DBADMIN JUNK .0625
SQL> drop table JUNK;
Table dropped.
#Example 2.
SQL> alter tablespace DFS read only;
Tablespace altered.
SQL> create table JUNK ( col1 number ) tablespace DFS;
Table created.
SQL> SELECT OWNER,SEGMENT_NAME,BYTES/1024/1024 MB FROM DBA_SEGMENTS WHERE
SEGMENT_NAME='JUNK';
no rows selected
SQL> insert into JUNK values (100);
insert into JUNK values (100)
*
ERROR at line 1:
ORA-01647: tablespace 'DFS' is read-only, cannot allocate space in it
SQL> alter tablespace DFS read write;
Tablespace altered.
SQL> insert into JUNK values (100);
1 row created.
SQL> SELECT OWNER,SEGMENT_NAME,BYTES/1024/1024 MB FROM DBA_SEGMENTS WHERE SEGMENT_NAME='JUNK';
OWNER SEGMENT_NAME MB
------------- ---------------------
DBADMIN JUNK .0625
SQL> commit;
Commit complete.
no rows selected
SQL> insert into JUNK values (100);
insert into JUNK values (100)
*
ERROR at line 1:
ORA-01647: tablespace 'DFS' is read-only, cannot allocate space in it
SQL> alter tablespace DFS read write;
Tablespace altered.
SQL> insert into JUNK values (100);
1 row created.
SQL> SELECT OWNER,SEGMENT_NAME,BYTES/1024/1024 MB FROM DBA_SEGMENTS WHERE SEGMENT_NAME='JUNK';
OWNER SEGMENT_NAME MB
------------- ---------------------
DBADMIN JUNK .0625
SQL> commit;
Commit complete.
0 comments:
Post a Comment