Atikh's DBA blog
  • Home
  • Oracle
  • MySQL
  • MongoDB
  • PostgreSQL
  • Snowflake
  • About Me
  • Contact Us

Create Pluggable Database (PDB) in Oracle 12c

 Atikh Shaikh     oracle, Oracle 12c     No comments   


We have gone through features of 12c Multitenant database. Now we will have discussion on create pluggable databases (PDB). There are different ways to create pluggable database
We will discuss on below methods

1. Using SEED pdb
2. Using XML file
3. By Cloning
     a. Local PDB
     b. Remote PDB

Using seed PDB PDB$SEED

Below are steps to create PDB using PDB$SEED, first Check the PDB's available in container database


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO

Now create PDB using below command, note that we have provided options to create admin user, default tablespaces and roles. FILE_NAME_CONVERT is required in case mount point or diskgroups are different, for understanding purpose we used in below example though diskgroup is same.

SQL> create pluggable database pdb_techon admin user techon_admin identified by techon#123 roles = (DBA)
default tablespace techon_tbs datafile '+DATA01' size 100M
FILE_NAME_CONVERT=('+DATA01','+DATA01');  2    3

Pluggable database created.

We can see PDB is default created in MOUNTED state. we need to open the same with alter pluggable database command as shown below

SQL>  show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     MOUNTED
SQL>
SQL> alter pluggable database PDB_TECHON open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ WRITE NO

We can check datafile created for tablespace techon_tbs

SQL> select name from v$datafile where name like '%tech%';

NAME
---------------------------------------------------------------
+DATA01/DEV12C1/TECHON_PDB/DATAFILE/techon_tbs.363.994818875


Using XML file

For carrying out this activity, I have created .xml file of our previous PDB, techno_pdb and dropped it using keep datafile option and generated xml file for the same

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ WRITE NO

SQL> alter pluggable database PDB_TECHON close;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     MOUNTED

SQL> alter pluggable database PDB_TECHON unplug into '/u01/pdb_backup/pdb_techon.xml';

Pluggable database altered.

SQL> drop pluggable database PDB_TECHON keep datafiles;

Pluggable database dropped.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
SQL>

Now lets see command to create PDB from xml file, as we have kept datafiles as it is during drop no file_name_convert or transfer of any datafile is required

SQL> Create pluggable database PDB_TECHON using '/u01/pdb_backup/pdb_techon.xml’;

Pluggable database created.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     MOUNTED
SQL>
SQL> alter pluggable database PDB_TECHON open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ WRITE NO


Using clone from local or remote PDB

Using Local PDB

Now we will discuss to clone PDB from local PDB, Below are the steps discussed,
Open source PDB in read only mode using below method

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ WRITE NO
SQL> alter pluggable database PDB_TECHON close;

Pluggable database altered.

SQL> alter pluggable database PDB_TECHON open read only;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ ONLY  NO

Below are commands to create PDB from local PDB, we have created PDB techon_new and open both PDB's

SQL> create pluggable database techon_new from PDB_TECHON FILE_NAME_CONVERT=( '+DATA01', '+DATA01');

Pluggable database created.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ ONLY  NO
         5 TECHON_NEW                     MOUNTED
SQL> alter pluggable database PDB_TECHON close;

Pluggable database altered.

SQL> alter pluggable database PDB_TECHON open;

Pluggable database altered.

SQL> alter pluggable database TECHON_NEW open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB_1                          READ WRITE NO
         4 PDB_TECHON                     READ WRITE NO
         5 TECHON_NEW                     READ WRITE NO

Using Remote PDB

For cloning remote follow the steps mentioned here Clone Remote PDB using DB link


You can also read (12c Features )
  • Share This:  
  •  Facebook
  •  Twitter
  •  Instagram
  •  Pin
  •  linkedin
  •  reddit
Email ThisBlogThis!Share to XShare to Facebook

Related Posts:

  • pfile and spfile in oracle database In this short article, we will discuss the server parameter file and initialization parameter file i.e., spfile and pfile   pfile - param… Read More
  • All about oracle database auditing As your application and database grow, more and more users get connected to the database, and it becomes difficult to manage all the privileges that i… Read More
  • Oracle : Database Links - Create, Use and DropA database link is an important schema object in the oracle database, we should know details about it in order to implement it in real-time applicatio… Read More
  • Different files involved in Oracle databaseAs Oracle DBA, we all know Oracle database server is combination of physical files, processes and memory, in this article we are going to discuss abou… Read More
  • Flashback query in oracleYou must have heard about the time machine in movies or magazines, just think of an oracle providing the same feature with its databases, and that is … Read More
Newer Post Older Post Home

0 comments:

Post a Comment

Author

Atikh Shaikh
View my complete profile

Categories

  • MongoDB (18)
  • Oracle 12c (30)
  • Oracle12cR2 New Feature (3)
  • PostgreSQL (20)
  • RMAN (10)
  • Snowflake (8)
  • mysql (23)
  • oracle (73)

Blog Archive

  • ▼  2018 (38)
    • ►  November (25)
    • ▼  December (13)
      • Starting and Stopping MongoDB
      • Oracle Database Architecture Physical and Logical
      • MongoDB Database Backup and Restore
      • Startup and Shutdown Oracle Database
      • Oracle 12c New features – Multitenant Database
      • MongoDB Storage Engines
      • Create Pluggable Database (PDB) in Oracle 12c
      • Warning: PDB altered with errors- opening PDB in O...
      • Oracle 12c: Starting and Stopping PDB
      • Know your Hostname in MySQL
      • Everything you need to know about Oracle Data Pump
      • List Databases, Tables, schemas and other basic c...
      • User Managed Backups in Oracle
  • ►  2019 (33)
    • ►  January (15)
    • ►  February (6)
    • ►  March (2)
    • ►  April (5)
    • ►  May (5)
  • ►  2020 (5)
    • ►  April (1)
    • ►  May (2)
    • ►  July (2)
  • ►  2021 (8)
    • ►  June (3)
    • ►  July (3)
    • ►  August (1)
    • ►  December (1)
  • ►  2022 (33)
    • ►  May (3)
    • ►  June (10)
    • ►  July (3)
    • ►  August (4)
    • ►  September (8)
    • ►  October (3)
    • ►  November (2)
  • ►  2023 (14)
    • ►  February (1)
    • ►  April (5)
    • ►  May (2)
    • ►  June (1)
    • ►  September (1)
    • ►  October (1)
    • ►  December (3)
  • ►  2024 (5)
    • ►  January (2)
    • ►  March (3)
  • ►  2025 (5)
    • ►  March (1)
    • ►  April (3)
    • ►  May (1)

Popular Posts

  • ORA-29283: invalid file operation: unexpected "LFI" error (1509)[29437]
    I was trying to export the schema in my windows PC, it got stuck with below error    C:\Users\shaik\Videos\technodba exp>expdp userid...
  • Oracle Dataguard Broker Configuration (DGMGRL)
    Data Guard Broker is a command-line interface that makes managing primary and standby databases easy. DBA can use a single command to switch...
  • ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
    In previous articles, we have learned about user creation and grants  in MySQL in detail, but there are a few privileges called global priv...
  • PostgreSQL : How to get data directory location for PostgreSQL instance
    Sometimes, you start working on a PostgreSQL instance but forget about the data directory, here we will discuss different methods to know th...
  • Oracle 23ai : The all new Hybrid Read-Only for pluggable databases (PDBs)
      The latest Oracle database version, Oracle 23ai, introduced a new open mode called Hybrid Read-Only for pluggable databases (PDBs). Local ...

Labels

oracle Oracle 12c mysql PostgreSQL MongoDB oracle 19c Oracle23c oracle19c Orale PDB-CDB oracle12c python AWS Oracle ASM Virtualbox pluggable database storage engine

Pages

  • Disclaimer
  • Privacy Policy

Follow TechnoDBA

Copyright © 2025 Atikh's DBA blog | Powered by Blogger