Database Reference
In-Depth Information
9.
To verify that the operation was successful, in SQL*Plus run the query you ran before
to validate the results:
SQL> SELECT SEGMENT_NAME, BLOCKS FROM DBA_SEGMENTS
WHERE OWNER = 'HR' and SEGMENT_NAME LIKE 'EMPL%';
SEGMENT_NAME BLOCKS
------------------------- ----------
EMPLOYEES 8
EMPLOYEES_HIST 16
EMPLOYEES_HIST_IX 8
In Exercise 10.2, you'll learn how to shrink a segment.
exeRCiSe 10.2
Shrinking a Segment
For this exercise, you'll create a table, populate it, delete rows, and then shrink the table
segment:
1.
Create a table named
shrink_test
with two columns: a
NUMBER
column named
X
and
a
VARCHAR2 (10)
column named
Y
. Enable row movement for the table.
2.
Insert two rows with a unique value for
X
for each row.
3.
Now, using the
INSERT INTO SHRINK_TEST SELECT * FROM SHRINK_TEST
SQL state-
ment repeatedly, grow the table to 1 million rows (or more), and commit.
4.
Query
DBA_SEGMENTS
to determine the size of the segment.
5.
Delete half the rows from the table, using one of the values of
X
as the delete criteria.
6.
Now shrink the segment online, and verify that the number of blocks decreases.
Managing Storage in a CDB and PDBs
In the Oracle 12
c
multitenant architecture, storage resources as data files and tablespaces
are allocated and managed somewhat differently than in previous versions of the RDBMS
since you now have the option to operate with a CDB and PDBs. For the CDB and for indi-
vidual PDBs, you can create, modify, and drop tablespaces. For the CDB and for each PDB,
you can create a default temporary tablespace. You can also specify a default tablespace
and default tablespace type for the root (CDB). The root has its out-of-the-box tablespaces
like
SYSTEM
and
SYSAUX
, and each PDB has its own tablespaces.
Search WWH ::
Custom Search