본문 바로가기

Database/Oracle

47 - [Oracle 19C] To create PDB from seed PBD(DBCA)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

# to create tablespace manually if you did not choose the default user tablespace

CREATE TABLESPACE pdb2
  DATAFILE '/u01/app/oracle/oradata/ORCL/pdb2/pdb2_01.dbf' SIZE 1M
  AUTOEXTEND ON NEXT 1M;

ALTER TABLESPACE pdb2 ADD
  DATAFILE '/u01/app/oracle/oradata/ORCL/pdb2/pdb2_02.dbf' SIZE 1M
  AUTOEXTEND ON NEXT 1M;

 

 

 

 

 

 

 

 

 

SQL> select name, open_mode from v$pdbs;

NAME		     OPEN_MODE
-------------------- ----------
PDB$SEED	     READ ONLY
ORCLPDB 	     READ WRITE
PDB1		     READ WRITE
PDB2		     READ WRITE

SQL>

 

 

 

# if don't want default tablespace with new PDB as pdb3

SQL> show con_name
CON_NAME
------------------------------
CDB$ROOT


SQL> alter session set container=pdb3;
Session altered.


SQL> show con_name
CON_NAME
------------------------------
PDB3


SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP


SQL> select con_id,file#, name from V$DATAFILE;

    CON_ID	FILE# NAME
---------- ---------- --------------------
	 5	   21 /u01/app/oracle/oradata/ORCL/pdb3/system01.dbf
	 5	   22 /u01/app/oracle/oradata/ORCL/pdb3/sysaux01.dbf
	 5	   23 /u01/app/oracle/oradata/ORCL/pdb3/undotbs01.dbf


SQL> CREATE TABLESPACE pdb3
  DATAFILE '/u01/app/oracle/oradata/ORCL/pdb3/pdb3_01.dbf' SIZE 1M
  AUTOEXTEND ON NEXT 1M;  2    3

Tablespace created.


SQL> ALTER TABLESPACE pdb3 ADD
  DATAFILE '/u01/app/oracle/oradata/ORCL/pdb3/pdb3_02.dbf' SIZE 1M
  AUTOEXTEND ON NEXT 1M;  2    3

Tablespace altered.


SQL> select con_id,file#, name from V$DATAFILE;

    CON_ID	FILE# NAME
---------- ---------- --------------------------------------------------
	 5	   21 /u01/app/oracle/oradata/ORCL/pdb3/system01.dbf
	 5	   22 /u01/app/oracle/oradata/ORCL/pdb3/sysaux01.dbf
	 5	   23 /u01/app/oracle/oradata/ORCL/pdb3/undotbs01.dbf
	 5	   24 /u01/app/oracle/oradata/ORCL/pdb3/pdb3_01.dbf
	 5	   25 /u01/app/oracle/oradata/ORCL/pdb3/pdb3_02.dbf


SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
SYSAUX
UNDOTBS1
TEMP
PDB3


...


# before making TABLESPACE
[oracle@test ORCL]$ cd pdb3
[oracle@test pdb3]$ ll
total 716880
-rw-r----- 1 oracle oinstall 346038272 Nov 26 22:32 sysaux01.dbf
-rw-r----- 1 oracle oinstall 283123712 Nov 26 22:32 system01.dbf
-rw-r----- 1 oracle oinstall  37756928 Nov 26 22:31 temp012023-11-11_01-06-19-635-AM.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov 26 22:32 undotbs01.dbf


# after making TABLESPACE
[oracle@test pdb3]$ ll
total 718944
-rw-r----- 1 oracle oinstall   1056768 Nov 26 23:01 pdb3_01.dbf
-rw-r----- 1 oracle oinstall   1056768 Nov 26 23:01 pdb3_02.dbf
-rw-r----- 1 oracle oinstall 346038272 Nov 26 22:46 sysaux01.dbf
-rw-r----- 1 oracle oinstall 283123712 Nov 26 23:01 system01.dbf
-rw-r----- 1 oracle oinstall  37756928 Nov 26 22:56 temp012023-11-11_01-06-19-635-AM.dbf
-rw-r----- 1 oracle oinstall 104865792 Nov 26 23:01 undotbs01.dbf