Adding Space to a Pluggable Database

Introduction

Both CDBs and PDBs have their own set of tablespaces and datafiles. As such, both CDBs and PDBs have storage administration requirements. This guide shows how to create tablespaces and add datafiles in both CDBs and PDBs.

Step-By-Step

1. Connect to the CDB$ROOT and check the tablespaces and datafiles.

  • sqlplus '/ as sysdba'
  • SQL> SELECT CON_ID,TABLESPACE_NAME FROM CDB_TABLESPACES WHERE CON_ID=1;
    • NB The above statement shows the tablespaces in the CDB database.
  • SQL> SELECT CON_ID,FILE_NAME FROM CDB_DATA_FILES WHERE CON_ID=1;
    • NB The above statement shows the datafiles in the CDB database.
  • SQL> SELECT CON_ID,FILE_NAME FROM CDB_TEMP_FILES WHERE CON_ID=1;
    • NB The above statement shows the tempfiles in the CDB database.

NOTE con_id 1 is the CDB database CDB$ROOT

2. Whilst logged onto the CDB create a tablespace in the CDB$ROOT database

  • sqlplus '/ as sysdba'
  • CREATE TABLESPACE myroot_data DATAFILE '/u01/app/oracle/oradata/cdb1/myroot_data_1.dbf' SIZE 10M;
    • *NB** The command above creates a data tablespace in the CDB.
  • CREATE TEMPORARY TABLESPACE my_temp_root TEMPFILE '/u01/app/oracle/oradata/cdb1/my_temp_root_1.dbf' SIZE 10M;
    • *NB** The command above creates a temporary tablespace in the CDB.

3. Creating a tablespace in the PDB database works exactly the same way.

  • sqlplus '/ as sysdba'
  • SQL> connect myplugdb3 as sysdba
  • CREATE TABLESPACE myapp_data DATAFILE '/u01/app/oracle/oradata/cdb1/myplugdb3/myapp_data_1.dbf' SIZE 10M;
    • *NB** The command above creates a data tablespace in the PDB.
  • CREATE TEMPORARY TABLESPACE temp_plug TEMPFILE '/u01/app/oracle/oradata/cdb1/myplugdb3/temp_plug_1.dbf' SIZE 10M;
    • *NB** The command above creates a temporary tablespace in the PDB.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License