Databases Reference
In-Depth Information
6. Add a data file to the
EXAMPLE
tablespace on a different disk:
ALTER TABLESPACE EXAMPLE ADD
DATAFILE '/u01/oradata/TESTDB2/example_DISK2.dbf' SIZE 100M;
7.
Allocate an extent for the
COUNTRIES
table of the
SH
schema on the newly-created
data file:
ALTER TABLE SH.COUNTRIES ALLOCATE EXTENT
(DATAFILE '/u01/oradata/TESTDB2/example_DISK2.dbf' SIZE 1M);
How it works...
We want to spread our objects to different disks, to obtain better performance. To do so,
we can use multiple tablespaces, allocating them to different disks and distributing objects
among different tablespaces, or we can add multiple data files—spread among different
disks—to the same tablespace and allocate extents for our objects to these data files. In this
recipe, we have followed both the methods.
We can use the
DBA_HIST_SEG_STAT
view to identify
the most-accessed segments from instance startup.
In step 2, we created a new tablespace, named
EXAMPLE2
, made by a single data file on
a disk mounted under the
/u01/oradata/TESTDB2/
path.
In step 3, we moved the
CUSTOMERS
table of the
SH
schema from tablespace
EXAMPLE
to
tablespace
EXAMPLE2
. We have used the
NOLOGGING
option to avoid logging all the data
movements—only the change in a data dictionary is logged.
We can see the results of these operations in the following screenshot: