Skip to main content

Backup of a Container Database (CDB) and a Pluggable Database (PDB) Oracle in Detail step by step

Backup of a Container Database (CDB) and a Pluggable Database (PDB) Oracle in detail step by step

I am sharing the  are step-by-step instructions to backup a CDB and PDBs in Oracle to a custom location:

Database name:

SQL> select name from v$database;

NAME
---------
DB19


PDB name:

SQL> show pdbs

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


Database is on OCI VM DB system (DBCS). DB version is 19c

Create Backup  Directory

mkdir -p /u01/app/oracle/backup/DB19




Full CDB and PDB backup


A full backup of the CDB you are also doing a full backup of all PDBs.


RMAN> connect target sys/Sfbn-Dv123#@DB19_PRIMY;
Allocate channels with custom format:

run{
allocate channel ch1 type disk format '/u01/app/oracle/backup/%d/db_backup_%U';
allocate channel ch2 type disk format '/u01/app/oracle/backup/%d/db_backup_%U';
backup database plus archivelog;
release channel ch1;
release channel ch2;
}

Output:
[oracle@foadb backup]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Dec 31 16:49:31 2023
Version 19.21.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB19 (DBID=888209347)

RMAN> run{
allocate channel ch1 type disk format '/u01/app/oracle/backup/%d/db_backup_%U';
allocate channel ch2 type disk format '/u01/app/oracle/backup/%d/db_backup_%U';
backup database plus archivelog;
release channel ch1;
release channel ch2;
}
2> 3> 4> 5> 6> 7> 
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=66 device type=DISK

allocated channel: ch2
channel ch2: SID=220 device type=DISK


Starting backup at 31-DEC-23
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=2 RECID=1 STAMP=1157042730
channel ch1: starting piece 1 at 31-DEC-23
channel ch2: starting archived log backup set
channel ch2: specifying archived log(s) in backup set
input archived log thread=1 sequence=3 RECID=2 STAMP=1157042857
input archived log thread=1 sequence=4 RECID=3 STAMP=1157042997
channel ch2: starting piece 1 at 31-DEC-23
channel ch2: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_072fe4pm_7_1_1 tag=TAG20231231T164958 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:01
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_062fe4pm_6_1_1 tag=TAG20231231T164958 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:07
Finished backup at 31-DEC-23

Starting backup at 31-DEC-23
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/DB19_PRIMY/DATAFILE/system.261.1156994113
input datafile file number=00011 name=+DATA/DB19_PRIMY/DATAFILE/users.269.1156995421
channel ch1: starting piece 1 at 31-DEC-23
channel ch2: starting full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/DB19_PRIMY/DATAFILE/sysaux.268.1156994091
input datafile file number=00004 name=+DATA/DB19_PRIMY/DATAFILE/undotbs1.260.1156994147
channel ch2: starting piece 1 at 31-DEC-23
channel ch2: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_092fe4pu_9_1_1 tag=TAG20231231T165006 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:16
channel ch2: starting full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00008 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/system.273.1156994903
input datafile file number=00010 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/undotbs1.270.1156994937
channel ch2: starting piece 1 at 31-DEC-23
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_082fe4pu_8_1_1 tag=TAG20231231T165006 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:19
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATA/DB19_PRIMY/06FD4ED1E69F9D96E0639902F40A045F/DATAFILE/sysaux.265.1156993591
input datafile file number=00007 name=+DATA/DB19_PRIMY/06FD4ED1E69F9D96E0639902F40A045F/DATAFILE/undotbs1.266.1156993591
channel ch1: starting piece 1 at 31-DEC-23
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_0b2fe4qh_11_1_1 tag=TAG20231231T165006 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:07
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00005 name=+DATA/DB19_PRIMY/06FD4ED1E69F9D96E0639902F40A045F/DATAFILE/system.264.1156993591
channel ch1: starting piece 1 at 31-DEC-23
channel ch2: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_0a2fe4qe_10_1_1 tag=TAG20231231T165006 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:11
channel ch2: starting full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/sysaux.271.1156994923
input datafile file number=00012 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/users.274.1156995421
channel ch2: starting piece 1 at 31-DEC-23
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_0c2fe4qp_12_1_1 tag=TAG20231231T165006 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:07
channel ch2: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_0d2fe4qp_13_1_1 tag=TAG20231231T165006 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:07
Finished backup at 31-DEC-23

Starting backup at 31-DEC-23
current log archived
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=4 STAMP=1157043040
channel ch1: starting piece 1 at 31-DEC-23
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/db_backup_0e2fe4r1_14_1_1 tag=TAG20231231T165041 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 31-DEC-23

Starting Control File and SPFILE Autobackup at 31-DEC-23
piece handle=+RECO/DB19_PRIMY/AUTOBACKUP/2023_12_31/s_1157043042.266.1157043043 comment=NONE
Finished Control File and SPFILE Autobackup at 31-DEC-23

released channel: ch1

released channel: ch2


Root Container backup


A backup of the root container is a backup of the CDB, excluding any of the PDBs.


run{
allocate channel ch1 type disk format '/u01/app/oracle/backup/%d/root_backup_%U';
allocate channel ch2 type disk format '/u01/app/oracle/backup/%d/root_backup_%U';
backup database root;
release channel ch1;
release channel ch2;
}


Output:

[oracle@foadb DB19]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Dec 31 16:57:06 2023
Version 19.21.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB19 (DBID=888209347)

RMAN> run{
allocate channel ch1 type disk format '/u01/app/oracle/backup/%d/root_backup_%U';
allocate channel ch2 type disk format '/u01/app/oracle/backup/%d/root_backup_%U';
backup database root;
release channel ch1;
release channel ch2;
}
2> 3> 4> 5> 6> 7> 
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=39 device type=DISK

allocated channel: ch2
channel ch2: SID=223 device type=DISK

Starting backup at 31-DEC-23
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/DB19_PRIMY/DATAFILE/system.261.1156994113
input datafile file number=00011 name=+DATA/DB19_PRIMY/DATAFILE/users.269.1156995421
channel ch1: starting piece 1 at 31-DEC-23
channel ch2: starting full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATA/DB19_PRIMY/DATAFILE/sysaux.268.1156994091
input datafile file number=00004 name=+DATA/DB19_PRIMY/DATAFILE/undotbs1.260.1156994147
channel ch2: starting piece 1 at 31-DEC-23
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/root_backup_0g2fe57o_16_1_1 tag=TAG20231231T165728 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:25
channel ch2: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/root_backup_0h2fe57q_17_1_1 tag=TAG20231231T165728 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:25
Finished backup at 31-DEC-23

Starting Control File and SPFILE Autobackup at 31-DEC-23
piece handle=+RECO/DB19_PRIMY/AUTOBACKUP/2023_12_31/s_1157043475.267.1157043475 comment=NONE
Finished Control File and SPFILE Autobackup at 31-DEC-23

released channel: ch1

released channel: ch2

Pluggable Database Backup


We can take backup of individual pdb's. 

run{
allocate channel ch1 type disk format '/u01/app/oracle/backup/%d/PDB1_backup_%U';
allocate channel ch2 type disk format '/u01/app/oracle/backup/%d/PDB1_backup_%U';
backup pluggable database pdb1;
release channel ch1;
release channel ch2;
}

Output:

[oracle@foadb DB19]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Sun Dec 31 17:02:17 2023
Version 19.21.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DB19 (DBID=888209347)

RMAN> run{
allocate channel ch1 type disk format '/u01/app/oracle/backup/%d/PDB1_backup_%U';
allocate channel ch2 type disk format '/u01/app/oracle/backup/%d/PDB1_backup_%U';
backup pluggable database pdb1;
release channel ch1;
release channel ch2;
}
2> 3> 4> 5> 6> 7> 
using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=66 device type=DISK

allocated channel: ch2
channel ch2: SID=220 device type=DISK

Starting backup at 31-DEC-23
channel ch1: starting full datafile backup set
channel ch1: specifying datafile(s) in backup set
input datafile file number=00008 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/system.273.1156994903
input datafile file number=00010 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/undotbs1.270.1156994937
channel ch1: starting piece 1 at 31-DEC-23
channel ch2: starting full datafile backup set
channel ch2: specifying datafile(s) in backup set
input datafile file number=00009 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/sysaux.271.1156994923
input datafile file number=00012 name=+DATA/DB19_PRIMY/0DC6D840E24B49E0E063C902000A877F/DATAFILE/users.274.1156995421
channel ch2: starting piece 1 at 31-DEC-23
channel ch1: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/PDB1_backup_0j2fe5hj_19_1_1 tag=TAG20231231T170243 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:07
channel ch2: finished piece 1 at 31-DEC-23
piece handle=/u01/app/oracle/backup/DB19/PDB1_backup_0k2fe5hj_20_1_1 tag=TAG20231231T170243 comment=NONE
channel ch2: backup set complete, elapsed time: 00:00:07
Finished backup at 31-DEC-23

Starting Control File and SPFILE Autobackup at 31-DEC-23
piece handle=+RECO/DB19_PRIMY/AUTOBACKUP/2023_12_31/s_1157043771.268.1157043771 comment=NONE
Finished Control File and SPFILE Autobackup at 31-DEC-23

released channel: ch1

released channel: ch2




If you like please follow and comment

Comments

Popular posts from this blog

WebLogic migration to OCI using WDT tool

WebLogic migration to OCI using WDT tool Oracle WebLogic Deploy Tool (WDT) is an open-source project designed to simplify and streamline the management of Oracle WebLogic Server domains. With WDT, you can export configuration and application files from one WebLogic Server domain and import them into another, making it a highly effective tool for tasks like migrating on-premises WebLogic configurations to Oracle Cloud. This blog outlines a detailed step-by-step process for using WDT to migrate WebLogic resources and configurations. Supported WLS versions Why Use WDT for Migration? When moving Oracle WebLogic resources from an on-premises environment to Oracle Cloud (or another WebLogic Server), WDT provides an efficient and reliable approach to: Discover and export domain configurations and application binaries. Create reusable models and archives for deployment in a target domain. Key Pre-Requisites Source System: An Oracle WebLogic Server with pre-configured resources such as: Applica...

Rename a PDB in Oracle Database Multitenant Architecture in TDE and Non TDE Environment

Rename a PDB in Oracle Database Multitenant Architecture I am sharing a step-by-step guide to help you rename a PDB. This approach uses SQL commands. Without TDE or encryption Wallet Initial Check Check the Current Database Name and Open Mode: SQL > SELECT NAME, OPEN_MODE FROM V$DATABASE; NAME OPEN_MODE --------- -------------------- BEECDB READ WRITE List Current PDBs: SQL > SHOW PDBS; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 FUAT READ WRITE NO We need to RENAME FUAT to BEE  Steps to Rename the PDB Step 1: Export ORACLE_SID Set the Oracle SID to the Container Database (CDB): export ORACLE_SID=BEECDB Step 2: Verify Target PDB Name Availability If the target PDB name is different from the current PDB name, ensure no service exists with the target PDB name. Run SQL to Check Exi...

How to make flash work on IE or Edge with IE Compatibility

How to make flash work on IE or Edge with IE Compatibility With flash been ended from 1-Jan-2021, many applications using flash have stopped working the way they were built (like OEM, OBIEE, etc). The option you have to upgrade.  This method will give a workaround in IE or Edge in IE compatibility mode without upgrading. 1. Verify you have installed flash.ocx on your desktop. Typically, flash.ocx file is located in C:\Windows\System32\Macromed\Flash or C:\Windows\SysWOW64\Macromed\Flash according to your laptop OS system. 2. Edit mms.cfg from the location as a System Administrator In the case of the 64bit system, it might have mms.cfg under C:\Windows\SysWOW64\Macromed\Flash 3. Add below options into mms.cfg file. Note: AllowListUrlPattern list is an example. The URLs need to be replaced to your hosts those have Flash pages. SilentAutoUpdateEnable=0 AutoUpdateDisable=1 EOLUninstallDisable=1 EnableAllowList=1 AllowListUrlPattern=http://www.google.com/ AllowListUrlPattern=http://goo...