The documentation of 12cR2 was released and with that several people are learning all the new features. There are some questions that people are starting to have, for example, when configuring Local Undo (New Undo Configuration in Oracle 12cR2) in what moment the undo tablespaces are created for the Pluggable Databases? that is the question I will treat in this article.
Firstly let me show you the Environment I am using for this example:
- Oracle 12.2.0.1.0 Enterprise Edition Extreme Performance (Oracle Cloud).
- Two Pluggable Databases already created: NuvolaPDB1 and NuvolaPDB2.
The first step is of course to configure Local Undo in the Container Database:
Configuring Oracle Local Undo:
SQL> shutdown immediate;
SQL> startup upgrade;
SQL> alter database local undo on;
Database altered.
SQL> shutdown immediate;
SQL> startup;
At this time the Container Database was started up and the PDB$SEED is in read only, by default. The other two Pluggable Databases didn't open by default, because they don't have the state saved (new feature introduced in 12.1.0.2), so the two Pluggable Databases are mounted at this time. The point here (and it is the key) is that the only PDB that has been opened is PDB$SEED.
SQL> select name, open_mode from v$pdbs
NAME OPEN_MODE
---------- ----------
PDB$SEED READ ONLY
NUVOLAPDB1 MOUNTED
NUVOLAPDB2 MOUNTED
Undo tablespace creation in PDB$SEED:
The answer of the question of this article is: In a "Local Undo" configuration, the Undo Tablespace for one Pluggable Database is created when the Pluggable Database is Opened for the first time. Oracle likes this style for Multitenant Architecture. Whenever a Pluggable Database open for the first time Oracle does things. You can read more about this in my article"The semi-patching of a PDB right after creation". In this case, the first PDB Opening right after configuring Local Undo is when the undo tablespace is created in that specific Pluggable Database.
The proof of that is that since only the PDB$SEED has been opened after configuring Local Undo, only that PDB got its undo tablespace created:
Completed: ALTER DATABASE MOUNT
ALTER DATABASE OPEN
PDB PDB$SEED(2)converted to local undo mode, scn: 0x000000008a2f8eb0
PDB$SEED(2):Autotune of undo retention is turned on.
PDB$SEED(2):Undo initialization finished serial:0 start:344096331 end:344096559 diff:228 ms (0.2 seconds)
PDB$SEED(2):Database Characterset for PDB$SEED is US7ASCII
PDB$SEED(2):Opatch validation is skipped for PDB PDB$SEED (con_id=0)
PDB$SEED(2):Opening pdb with no Resource Manager plan active
PDB$SEED(2):CREATE SMALLFILE UNDO TABLESPACE undo_1 DATAFILE SIZE 116391936 AUTOEXTEND ON NEXT 3145728 MAXSIZE 10307919872 ONLINE
PDB$SEED(2):[2595] Successfully onlined Undo Tablespace 3.
PDB$SEED(2):Completed: CREATE SMALLFILE UNDO TABLESPACE undo_1 DATAFILE SIZE 116391936 AUTOEXTEND ON NEXT 3145728 MAXSIZE 10307919872 ONLINE
PDB$SEED(2):JIT: pid 2595 requesting stop
PDB$SEED(2):Autotune of undo retention is turned on.
PDB$SEED(2):Endian type of dictionary set to little
PDB$SEED(2):Undo initialization finished serial:0 start:344102100 end:344102100 diff:0 ms (0.0 seconds)
PDB$SEED(2):Database Characterset for PDB$SEED is US7ASCII
PDB$SEED(2):Opatch validation is skipped for PDB PDB$SEED (con_id=0)
PDB$SEED(2):Opening pdb with no Resource Manager plan active
Completed: ALTER DATABASE OPEN
In the next query we can see that only PDB$SEED has "UNDO_1" tablespace created:
SQL> select pdb.name PDB_NAME, tbs.name TABLESPACE_NAME from v$tablespace tbs, v$pdbs pdb where tbs.con_id=pdb.con_id order by 1;
PDB_NAME TABLESPACE_NAME
----------- ------------------------------
NUVOLAPDB1 TEMP
NUVOLAPDB1 SYSAUX
NUVOLAPDB1 SYSTEM
NUVOLAPDB2 TEMP
NUVOLAPDB2 SYSTEM
NUVOLAPDB2 SYSAUX
PDB$SEED UNDO_1
PDB$SEED TEMP
PDB$SEED SYSAUX
PDB$SEED SYSTEM
11 rows selected.
Undo tablespace creation in other PDBs:
Now let's open another Pluggable Database, NuvolaPDB1:
SQL> alter pluggable database NuvolaPDB1 open;
Pluggable database altered.
Since this is the first time NuvolaPDB1 is opened after configuring Local Undo, its undo tablespace is created in that opening:
alter pluggable database NuvolaPDB1 open
NUVOLAPDB1(3):Endian type of dictionary set to little
PDB NUVOLAPDB1(3) converted to local undo mode, scn: 0x000000008a2f90c0
NUVOLAPDB1(3):Autotune of undo retention is turned on.
NUVOLAPDB1(3):Undo initialization finished serial:0 start:345249262 end:345249847 diff:585 ms (0.6 seconds)
NUVOLAPDB1(3):Database Characterset for NUVOLAPDB1 is US7ASCII
NUVOLAPDB1(3):Opatch validation is skipped for PDB NUVOLAPDB1 (con_id=0)
NUVOLAPDB1(3):Opening pdb with no Resource Manager plan active
NUVOLAPDB1(3):CREATE SMALLFILE UNDO TABLESPACE undo_1 DATAFILE SIZE 116391936 AUTOEXTEND ON NEXT 3145728 MAXSIZE 10307919872 ONLINE
NUVOLAPDB1(3):[2595] Successfully onlined Undo Tablespace 3.
NUVOLAPDB1(3):Completed: CREATE SMALLFILE UNDO TABLESPACE undo_1 DATAFILE SIZE 116391936 AUTOEXTEND ON NEXT 3145728 MAXSIZE 10307919872 ONLINE
Pluggable database NUVOLAPDB1 opened read write
Completed: alter pluggable database NuvolaPDB1 open
Now PDB$SEED and NuvolaPDB1 are the only PDBs that have undo tablespace, it is pending NuvolaPDB2 but is because it has not been opened:
SQL> select pdb.name PDB_NAME, tbs.name TABLESPACE_NAME from v$tablespace tbs, v$pdbs pdb where tbs.con_id=pdb.con_id order by 1;
PDB_NAME TABLESPACE_NAME
------------ -----------------
NUVOLAPDB1 TEMP
NUVOLAPDB1 UNDO_1
NUVOLAPDB1 SYSAUX
NUVOLAPDB1 SYSTEM
NUVOLAPDB2 TEMP
NUVOLAPDB2 SYSTEM
NUVOLAPDB2 SYSAUX
PDB$SEED UNDO_1
PDB$SEED TEMP
PDB$SEED SYSAUX
PDB$SEED SYSTEM
11 rows selected.
Follow me: