Your Search Bar For Shrewd Tips

How To Restore Cdb and Pdb In Oracle 19c


How To Restore CDB and PDB In Oracle 19c

Restoring Container Databases (CDB) and Pluggable Databases (PDB) in Oracle 19c is a critical task for database administrators, especially in scenarios involving data corruption, human errors, or disaster recovery. Oracle 19c introduces a flexible architecture that allows for restoring CDBs and PDBs independently or together, providing greater control and efficiency during recovery operations. This guide provides a comprehensive step-by-step process on how to restore both CDB and PDB in Oracle 19c, ensuring your database environment remains resilient and operational with minimal downtime.

Understanding Oracle 19c CDB and PDB Architecture

Before diving into the restoration processes, it’s essential to understand the architecture of Oracle 19c’s multitenant environment. Oracle Database 19c supports a Container Database (CDB) that contains zero or more Pluggable Databases (PDBs). The CDB manages shared resources and metadata, while each PDB operates as a self-contained database that can be plugged into or unplugged from the CDB.

In Oracle 19c, restoring CDBs and PDBs involves different considerations:

  • Restoring the CDB involves recovering the entire database, including all PDBs, system metadata, and datafiles.
  • Restoring a PDB can be done independently if it is unplugged from the CDB, enabling targeted recovery without affecting other PDBs or the CDB itself.

Understanding these distinctions helps in planning the appropriate recovery strategy based on the specific scenario.

Preparation Before Restoring CDB and PDB

Effective restoration requires thorough preparation:

  • Ensure you have valid backup copies of the CDB and PDBs. Use Oracle Recovery Manager (RMAN) or Data Pump for backups.
  • Check the compatibility of backup files with your current Oracle 19c version.
  • Identify the correct point-in-time for recovery, whether it’s a full backup, incremental, or a specific point-in-time recovery (PITR).
  • Establish the target environment where the CDB and PDB will be restored, including storage and network configurations.
  • Review the existing database configuration, including initialization parameters and storage layout.

Having a recovery plan and testing it in a non-production environment can prevent unexpected issues during actual restoration.

Restoring the CDB in Oracle 19c

Restoring the entire CDB involves recovering the database files and applying the appropriate logs. Here’s a detailed step-by-step process:

Step 1: Prepare the Environment

  • Set the environment variables, especially ORACLE_SID and ORACLE_HOME, to point to the CDB to be restored.
  • Ensure the target storage location has sufficient space for the restored database files.

Step 2: Mount the Database in NOMOUNT Mode

Start the database in NOMOUNT mode to facilitate restoration:

sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
STARTUP NOMOUNT;

Step 3: Use RMAN to Restore the CDB

Execute the RMAN commands to restore the database from backup:

rman target /
RESTORE DATABASE;
RECOVER DATABASE;

If performing a point-in-time recovery, include the UNTIL TIME clause:

RESTORE DATABASE UNTIL TIME "TO_DATE('2024-04-25 15:00:00', 'YYYY-MM-DD HH24:MI:SS')";
RECOVER DATABASE;

Step 4: Open the CDB with RESETLOGS

After successful recovery, open the database with the RESETLOGS option:

ALTER DATABASE OPEN RESETLOGS;

This completes the CDB restoration process, making it available for use.

Restoring a PDB in Oracle 19c

Restoring a PDB can be performed independently of the CDB, especially if it was unplugged or needs to be recovered separately. The process involves plugging in a backup or a datafile into a running CDB.

Step 1: Prepare the Target CDB

  • Ensure the CDB is open and accessible.
  • Create a new PDB or identify the existing PDB to be restored.

Step 2: Prepare the Backup or Datafiles for the PDB

  • If restoring from RMAN backup, ensure the backup is accessible.
  • If restoring from datafiles, copy the datafiles to the appropriate location.

Step 3: Create a New PDB or Unplugged PDB

If restoring into a new PDB:

CREATE PLUGGABLE DATABASE new_pdb USING '/path/to/backup/manifest.xml' COPY;

If restoring an unplugged PDB from a backup, use the unplug procedure:

CREATE PLUGGABLE DATABASE pdb_name FROM '/path/to/unplugged/pdb.xml';

Step 4: Plug in the PDB

To plug in a PDB from a backup or an unplugged PDB:

ALTER PLUGGABLE DATABASE pdb_name OPEN;

If the PDB was unplugged, plug it into the CDB:

CREATE PLUGGABLE DATABASE pdb_name USING '/path/to/unplugged/pdb.xml' PLUGGABLE;

Step 5: Recover and Open the PDB

If the PDB requires recovery, perform it using RMAN or Data Pump, depending on your backup method. Once recovered, open the PDB:

ALTER PLUGGABLE DATABASE pdb_name OPEN RESETLOGS;

Ensure the PDB is synchronized and ready for use.

Best Practices for Restoring CDB and PDB in Oracle 19c

  • Always maintain regular backups of your CDB and PDBs, including full backups and incremental backups.
  • Test your backup and recovery procedures periodically to ensure they work as expected.
  • Use RMAN for consistent backups and recovery operations, leveraging features like block recovery and incremental backups.
  • Document your recovery procedures thoroughly to reduce downtime during actual recovery scenarios.
  • Keep your Oracle environment up to date with patches and updates to ensure compatibility and security.

Conclusion

Restoring CDBs and PDBs in Oracle 19c is a vital skill for ensuring data integrity and availability in the face of failures or data corruption. By understanding the architecture, preparing adequately, and following structured recovery procedures, DBAs can minimize downtime and restore operations efficiently. Whether restoring the entire container database or individual pluggable databases, Oracle 19c provides flexible options to meet diverse recovery needs. Regular backups, testing, and adherence to best practices will help ensure that your Oracle environment remains resilient and reliable.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


πŸ’‘ Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments πŸ‘‡

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum β†’