Manage Tablespaces in A Container Database (CDB) and Pluggable Database (PDB)
Manage Tablespaces in A Container Database (CDB) and Pluggable Database (PDB)
----------------------------
CONN / AS SYSDBA
CON_NAME
------------------------------
CDB$ROOT
SQL>
Tablespace created.
SQL>
Tablespace altered.
SQL>
Tablespace dropped.
SQL>
Session altered.
CON_NAME
------------------------------
PDB1
SQL
CON_NAME
------------------------------
PDB1
SQL>
Tablespace created.
SQL>
Tablespace altered.
SQL>
Tablespace dropped.
SQL>
Undo Tablespaces
----------------
CONN pdb_admin@pdb1
TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
TEMP
USERS
SQL>
But we can see the datafile associated with the CDB undo tablespace.
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/cdb1/undotbs01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/system01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/sysaux01.dbf
/u01/app/oracle/oradata/cdb1/pdb1/pdb1_users01.dbf
SQL>
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/cdb1/pdb1/temp01.dbf
SQL>
Temporary Tablespaces
----------------------
Management of the temporary tablespace in a CDB is unchanged from that of a non-CDB
database.
A PDB can either have its owner temporary tablespace, or if it is created without a
temporary tablespace, it can share the temporary tablespace with the CBD.
CONN pdb_admin@pdb1
Tablespace created.
SQL>
Tablespace dropped.
SQL>
Default Tablespaces
----------------------
Setting the default tablespace and default temporary tablespace for a CDB is
unchanged compared to a non-CDB database.
There are a two ways to set the default tablespace and default temporary tablespace
for a PDB. The ALTER PLUGGABLE DATABASE command is the recommended way.
CONN pdb_admin@pdb1
ALTER PLUGGABLE DATABASE DEFAULT TABLESPACE users;
ALTER PLUGGABLE DATABASE DEFAULT TEMPORARY TABLESPACE temp;
For backwards compatibility, it is also possible to use the ALTER DATABASE command.
CONN pdb_admin@pdb1
ALTER DATABASE DEFAULT TABLESPACE users;
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp;
With both methods, you should be pointing to the appropriate container for the
command to work.