Saturday 2 January 2016

12c : Manage Tablespace in PDB/CDB

Note: undo shared with all PDB with CDB, Temp either Shared or non- shared 

--------------------------------------------------------
Add and drop tablespace in CDB and PDB.
--------------------------------------------------------

Pluggable Databases

To create tablespaces in the pluggable databases (PDB), you need to ensure that you are in the correct container you want to create the tablespace for.
PDBs have container ids greater than 2.  The CON_NAME option is also a good way to ensure that you are in the correct container as well.



1. verify container db and id
select NAME, OPEN_MODE, CON_ID from V$PDBS;



2. Set container database.
alter session set container=PDB1;


3. See tablespace
select * from v$tablespaces;


4. Add/Drop tablespace
create tablespace SLOB datafile size 1M autoextend on next 1m;


5.Verify tablespace.
select * from v$tablespaces;



--------------------------------------------------------------
How to check where the tablespaces are located
--------------------------------------------------------------

conn sys as sysdba
OR
alter session set container=cdb$root;



select tablespace_name,status,con_id from cdb_tablespaces
where tablespace_name='SLOB' order by 3;



select pdb_id,pdb_name,status,con_id from cdb_pdbs order by 1;



------------------------
Default tablespace
------------------------

ALTER PLUGGABLE DATABASE DEFAULT TABLESPACE users;
ALTER PLUGGABLE DATABASE DEFAULT TEMPORARY TABLESPACE temp;



show con_name
show con_id

No comments: