DBA Trainer Oracle DBA - Creating Tablespace in CDB and PDB www.dbatrainer.
con
Creating Tablespace in CDB and PDB
Tablespaces in CDB and PDBs..
Create a Permanent tablespace in the root container:
SQL>connect sys@CDB5
SQL>CREATE TABLESPACE tbs_CDB_users DATAFILE
‘/u01/app/oracle/oradata/CDB5/cdb_users01.dbf’ size 100M;
Create a Permanent tablespace in PDB container:
SQL>connect sys@PDB1
SQL>CREATE TABLESPACE tbs_PDB1_users DATAFILE
'/u01/app/oracle/oradata/CDB/HR/pdb_users01.dbf' size 100M;
Assigning Default Tablespace
In the CDB:-
SQL>connect sys@CDB1 as sysdba
SQL>alter database default tablespace [tablespace_name];
In the PDB:-
SQL>connect sys@PDB1 as sysdba
SQL>alter database default tablespace [tablespace_name];
Creating Local Temporary Tablespace
• Only one default temporary tablespace or tablespace group is allowed per CDB or PDB.
• Each PDB can have temporary tablespaces or tablespace groups but only one default
per PDB.
• Temporary tablespaces will be transported with the PDB when it is unplugged.
• When you create user you can specify a temporary tablespace to be used by that user. If
a temporary tablespace is not specified , the default tablespace for the PDB is used. If a
default tablespace has not been specified for the PDB , the temporary tablespace for the
CDB Used.
DBA Trainer - Online Oracle DBA Training Institute Page 1
DBA Trainer Oracle DBA - Creating Tablespace in CDB and PDB www.dbatrainer.con
Creating Local Temporary Tablespace..
• SQL>CREATE TEMPORARY TABLESPACE tbs_hr_temp TEMPFILE
'/u01/app/oracle/oradata/CDB/HR/HR_temp1.dbf' size 100M;
• SQL>ALTER PLUGGABLE DATABASE DEFAULT TEMPORARY TABLESPACE tbs_hr_temp;
• The default temporary tablespace in the CDB is shared by all the PDBs. The amount of
space a single PDB can use in the shared temporary tablespace can be set in the PDB by:
SQL>alter pluggable database storage (MAX_SHARED_TEMP_SIZE 500M);
DBA Trainer - Online Oracle DBA Training Institute Page 2