(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
Four segments within tablespace, “A”, “B”, “C” and “D”
Tablespace ‘EXAMPLE’ contains two datafiles
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
One row for every tablespace in database
SQL> select tablespace_name, status, contents
2 from dba_tablespaces;
TABLESPACE_NAME STATUS CONTENTS
---------------- --------- ---------
SYSTEM ONLINE PERMANENT
UNDOTBS1 ONLINE UNDO
TEMP ONLINE TEMPORARY
EXAMPLE ONLINE PERMANENT
USERS READ ONLY PERMANENT
One row for every datafile in database
SQL> select tablespace_name, file_name
2 from dba_data_files
3 order by 1;
TABLESPACE_NAME FILE_NAME
--------------- ----------------------------------------
EXAMPLE C:\ORACLE\ORADATA\DAVE\EXAMPLE01.DBF
EXAMPLE C:\ORACLE\ORADATA\DAVE\EXAMPLE02.DBF
. . .
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> create tablespace test
2 datafile size 1m
3 extent management local;
Tablespace created.
More examples to come later in this lesson
SQL> select extent_management
2 from dba_tablespaces where tablespace_name='TEST';
EXTENT_MAN
----------
LOCAL
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> create table t
2 (c1 number)
3 tablespace users;
QUOTA or UNLIMITED TABLESPACE privilege required
Table created.
SQL> create index ti
2 on t(c1)
3 tablespace indx;
Index created.
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> create tablespace ts1
2 datafile 'c:\oracle\oradata\class2\ts1.dbf'
3 size 64m
4 autoextend on next 8m
5 maxsize 128m
6 extent management local autoallocate
7 segment space management auto
8 /
Tablespace created.
System-Managed LMT
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> create table t
2 (c1 number )
3 tablespace ts1;
Table created.
SQL> select bytes, blocks
2 from user_extents
3 where segment_name = 'T';
BYTES BLOCKS
---------- ----------
65536 8
SQL> alter table t allocate extent;
Table altered.
SQL> select bytes, blocks
2 from user_extents
3 where segment_name = 'T';
BYTES BLOCKS
---------- ----------
65536 8
65536 8
System-Managed LMT allocates 64k extents, then 1Mb extents, then 8Mb, then 64Mb
(If applicable)

Other Text:
(Examples or comments displayed on slide, if any).
SQL> create tablespace ts2
2 datafile 'c:\oracle\oradata\class2\ts2.dbf'
3 size 50m
4 autoextend on next 10m
5 maxsize 100m
6 extent management local uniform size 10m
7 segment space management auto
8 /
Every extent will be 10m
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> create tablespace test
2 segment space management auto;
Tablespace created.
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> create tablespace ts1
2 datafile 'c:\oracle\oradata\class2\ts1.dbf'
3 size 64m
4 autoextend on next 8m
5 maxsize 128m
6 extent management local autoallocate
7 segment space management auto;
Tablespace created.
ASSM manages free & used space in segment
SQL> create table t
2 (c1 number )
3 storage(FREELISTS 2)
4 PCTFREE 5
5 PCTUSED 60
6 tablespace ts2;
Table created.
AUTO segment storage management
SQL> create table t2
2 (c1 number )
3 tablespace ts1;
Table created.
MANUAL segment storage management
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
SQL> alter system
2 set db_create_file_dest='C:\oracle\oradata\class2'
3 scope=both;
System altered.
Dynamic initialization parameter
SQL> create tablespace ts1;
Tablespace created.
SQL> create tablespace ts2 datafile size 1m;
Tablespace created.
Uses default location & size (100Mb)
Override default size
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)
Other Text:
(Examples or comments displayed on slide, if any).
(If applicable)