Sunday, April 26, 2026

Interview Questions 7 - Multitenant Architecture - RAC CDB & RAC PDB

1. Normal database Vs CDB database (PDB) 

DEVDB: - Normal Database
======
Instance + Database
Instance = Memory (SGA+PGA) + BG Process (Mandatory+Non-Mandatory)
Database = Datafiles (System, Sysaux, Undo, Users, Temp)
spfile/pfile
controlfile
redologs/archivelogs 
passwordfile 
listener / tnsfiles / oraclehome 


DEVCDB: - Normal Database
======
Instance + Database
Instance = Memory (SGA+PGA) + BG Process (Mandatory+Non-Mandatory)
Database = Datafiles (System, Sysaux, Undo, Users, Temp)
spfile/pfile
controlfile
redologs/archivelogs 
passwordfile 
listener / tnsfiles / oraclehome 

PDB - Pluggable database (This PDB resides inside CDB) (Virtual Database)
- Only datafiles (System, Sysaux, Undo, Users, Temp)

2. Multitenant architecture 
- CDB + PDB 

3. CDB - container database 

4. PDB (virtual databases)
- only datafiles 

5. Normal database files 
Instance + Database
Instance = Memory (SGA+PGA) + BG Process (Mandatory+Non-Mandatory)
Database = Datafiles (System, Sysaux, Undo, Users, Temp)
spfile/pfile
controlfile
passwordfile 
redologs/archivelogs 
listener / tnsfiles / oraclehome 

6. CDB database files 
Instance + Database
Instance = Memory (SGA+PGA) + BG Process (Mandatory+Non-Mandatory)
Database = Datafiles (System, Sysaux, Undo, Users, Temp)
spfile/pfile
controlfile
passwordfile 
redologs/archivelogs 
listener / tnsfiles / oraclehome 

7. PDB database files 
- only datafiles 

8. Common user Vs local user
CDB - Common user - c##
PDB - local user

9. All the admin activates we perform at PDB level 
- user creation 
- tablespace creation 
- user management or administration 
- datafile addition and resize  
- many more 

10. listener and TNS 
- only 1 listener at Oracle Home pointing to CDB
- LREG bg process of CDB will register all CDB and PDBs into listener 
- We can have multiple tnsnames according to CDB or PDB 

11. How to connect to Normal Database 
- sqlplus / as sysdba 

12. How to connect to CDB Database 
- sqlplus / as sysdba 

13. How to connect to PDB Database 
- connect to CDB first and then connect to PDB 
- sqlplus / as sysdba 
- alter session set container=<PDB>

14. PDB open and close 

Close (shutdown) - MOUNTED
Open - READ / WRITE 

node1:
alter pluggable database PDB1 open;
alter pluggable database PDB1 close;

node2:
alter pluggable database PDB1 open;
alter pluggable database PDB1 close;

node1/node2:
alter pluggable database PDB1 open instances=all;
alter pluggable database PDB1 close instances=all;

alter pluggable database all open instances=all;
alter pluggable database all close instances=all;

15. save state:
alter pluggable database DEVPDB save state instances=all;
alter pluggable database PDB2 save state instances=all;
alter pluggable database PDB3 save state instances=all;

16. 19c new feature - directly connect to pdb using sqlplus / as sysdba 
export ORACLE_PDB_SID=DEVPDB
unset ORACLE_PDB_SID

17. connecting from one PDB to other PDB 
alter session set container=DEVPDB;
alter session set container=PDB3;

18. PDB level cloning 
- 5 options 
- Clone/Create PDB1 from PDB$SEED
- Clone/Create PDB2 from another DEVPDB (mallik)
- Clone/Create from a Remote CDB
- Plug a unplugged PDB
- Convert a non-CDB (Normal Database - DEVDB) to PDB

19. RMAN backup and Recovery:
- L0 & L1 -> DEVDB 
- L0 & L1 -> DEVCDB  
- We take backup at CDB level then underlining all PDBs will be backedup 

When we take CDB level backup all PDB datafiles will be backed-up 

We can use L0 & L1 backup taken at CDB level for clone / restore - restore 
- We clone / restore-recover CDB level

Can I take only PDB backup?
- Yes 

rman target / >>>> DEVCDB 
RMAN> BACKUP PLUGGABLE DATABASE DEVPDB format='/u01/backup/DEVPDB';
RMAN> BACKUP PLUGGABLE DATABASE PDB3 format='/u01/backup/PDB3';

Can I use these PDB backup to clone PDB?
- NO

What is the use of taking PDB backups? 
- In case of PDB crash, We can use those PDB backups to restore 
- We can use CDB backup to restore those PDBs 

rman target / >>>> DEVCDB 
RMAN> RUN {
ALTER PLUGGABLE DATABASE DEVPDB CLOSE instances=all;
RESTORE PLUGGABLE DATABASE DEVPDB backup location <CDB_backup_location>;
RESTORE PLUGGABLE DATABASE DEVPDB backup location <PDB_backup_location>;
RECOVER PLUGGABLE DATABASE DEVPDB;
ALTER PLUGGABLE DATABASE DEVPDB OPEN instances=all;
}

20. Standby / DR 
- CDB to CDB level DR build
- Archive log shipping will happens form CDB to CDB 
- MRP we start it at DR/standby side at CDB level 

21. Listener 
One oracle home -> We create CDB -> inside CDB we will be having PDBs 
-> That oracle Home will have listener (local listener) if not 
-> In case of RAC default listener will be at GI  
-> Inside oracle home network/admin we will have all tns detail for CDB & PDBs 

22. Spfile pfile / pfile - CDB level
Controlfile file - CDB level
redo log -> archive logs - CDB level
password file - CDB level
 
datafiles - CDB level + PDB level 

23. CDB startup vs PDB startup 
shutdown -> nomount -> mount - open 
close -> open 

24. DB services are cluster 
DEVDB 
- srvctl add service -d DEVDB -s DEVDB_HR_SERVCIE -r DEVDB1,DEVDB2 -P BASIC -e SESSION
- srvctl add service -d DEVCDB -s DEVCDB_HR_SERVCIE -r DEVDB1,DEVDB2 -P BASIC -e SESSION
- srvctl add service -d DEVCDB -P DEVPDB -s DEVPDB_HR_SERVCIE -r DEVDB1,DEVDB2 -P BASIC -e SESSION

DEVDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEVDB)
    )
  )

DEVDB_HR_SERVCIE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEVDB_HR_SERVCIE)
    )
  )


DEVCDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEVCDB)
    )
  )

DEVCDB_HR_SERVCIE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEVCDB_HR_SERVCIE)
    )
  )

DEVPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEVPDB)
    )
  )

DEVPDB_HR_SERVCIE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = scan.localdomain.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DEVPDB_HR_SERVCIE)
    )
  )

Regards,
Mallikarjun / Vismo Technologies
WhatsApp: +91 9880616848 / +91 9036478079
Cell: +91 9880616848 / +91 9036478079
Email: mallikarjun.ramadurg@gmail.com / vismotechnologies@gmail.com


No comments:

Post a Comment

Interview Questions 7 - Multitenant Architecture - RAC CDB & RAC PDB

1. Normal database Vs CDB database (PDB)  DEVDB: - Normal Database ====== Instance + Database Instance = Memory (SGA+PGA) + BG Process (Mand...