In this article, we will see how we can take RMAN backup of whole CDB and for the single pluggable database.
To take RMAN backup of the whole CDB we can simply take backup by connecting to target as container database and backup database command.
Let us see by example :
CDB Backup :
Step 1 : Set db_recovery_file_dest and db_recovery_file_dest_size according your database size of whole CDB
SQL> alter system set db_recovery_file_dest='/u01/oracle/fast_recovery_area/'; System altered. SQL>alter system set db_recovery_file_dest_size=15G; System altered. SQL> exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
Step 2 : Connect RMAN with the target as CDB database
[oracle@localhost ~]$ rman target / Recovery Manager: Release 12.2.0.1.0 - Production on Tue Aug 14 10:48:14 2018 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTCDB (DBID=2723894279)
Step 3 : Take RMAN backup using backup database command
RMAN> backup database; Starting backup at 14-AUG-18 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=54 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00031 name=/u02/oradata/TESTCDB/728C0D40E7902D23E055000000000001/datafile/o1_mf_undotbs1_fp93brh4_.dbf input datafile file number=00029 name=/u02/oradata/TESTCDB/728C0D40E7902D23E055000000000001/datafile/o1_mf_system_fp93brf2_.dbf input datafile file number=00030 name=/u02/oradata/TESTCDB/728C0D40E7902D23E055000000000001/datafile/o1_mf_sysaux_fp93brh3_.dbf input datafile file number=00033 name=/u02/oradata/TESTCDB/728C0D40E7902D23E055000000000001/datafile/o1_mf_sal_tbs_fp944j58_.dbf input datafile file number=00032 name=/u02/oradata/TESTCDB/728C0D40E7902D23E055000000000001/datafile/o1_mf_users_fp93brh5_.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/728C0D40E7902D23E055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4sk357_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:46 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00027 name=/u02/oradata/TESTCDB/7280FBAEFC68381BE055000000000001/datafile/o1_mf_undotbs1_fp7s1dsm_.dbf input datafile file number=00025 name=/u02/oradata/TESTCDB/7280FBAEFC68381BE055000000000001/datafile/o1_mf_system_fp7s1dn7_.dbf input datafile file number=00026 name=/u02/oradata/TESTCDB/7280FBAEFC68381BE055000000000001/datafile/o1_mf_sysaux_fp7s1dsj_.dbf input datafile file number=00035 name=/u02/oradata/TESTCDB/7280FBAEFC68381BE055000000000001/datafile/o1_mf_t_data_fpmxdoxw_.dbf input datafile file number=00028 name=/u02/oradata/TESTCDB/7280FBAEFC68381BE055000000000001/datafile/o1_mf_users_fp7s1dsq_.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/7280FBAEFC68381BE055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4sng5f_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:25 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u02/oradata/testcdb/system01.dbf input datafile file number=00003 name=/u02/oradata/testcdb/sysaux01.dbf input datafile file number=00004 name=/u02/oradata/testcdb/undotbs01.dbf input datafile file number=00034 name=/u02/oradata/TESTCDB/datafile/o1_mf_u_data_fpmx0fhp_.dbf input datafile file number=00007 name=/u02/oradata/testcdb/users01.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4sq3sc_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:26 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00014 name=/u02/oradata/TESTCDB/71DA02D769265585E055000000000001/datafile/o1_mf_sysaux_fokrl9lr_.dbf input datafile file number=00013 name=/u02/oradata/TESTCDB/71DA02D769265585E055000000000001/datafile/o1_mf_system_fokrl9lc_.dbf input datafile file number=00015 name=/u02/oradata/TESTCDB/71DA02D769265585E055000000000001/datafile/o1_mf_undotbs1_fokrl9ls_.dbf input datafile file number=00016 name=/u02/oradata/TESTCDB/71DA02D769265585E055000000000001/datafile/o1_mf_sal_tbs_foskkjk4_.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/71DA02D769265585E055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4sst4t_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00018 name=/u02/oradata/TESTCDB/7216B23DC4065C7CE055000000000001/datafile/o1_mf_sysaux_fosq3dlz_.dbf input datafile file number=00017 name=/u02/oradata/TESTCDB/7216B23DC4065C7CE055000000000001/datafile/o1_mf_system_fosq3dlk_.dbf input datafile file number=00019 name=/u02/oradata/TESTCDB/7216B23DC4065C7CE055000000000001/datafile/o1_mf_undotbs1_fosq3dm0_.dbf input datafile file number=00020 name=/u02/oradata/TESTCDB/7216B23DC4065C7CE055000000000001/datafile/o1_mf_sal_tbs_fosqz0f9_.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/7216B23DC4065C7CE055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4stxln_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00010 name=/u02/oradata/testcdb/testpdb1/sysaux01.dbf input datafile file number=00012 name=/u01/oracle/oradata/testcdb/testpdb1/users01.dbf input datafile file number=00009 name=/u02/oradata/testcdb/testpdb1/system01.dbf input datafile file number=00011 name=/u02/oradata/testcdb/testpdb1/undotbs01.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/71D9DA30B4384F19E055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4sw1gc_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00006 name=/u02/oradata/testcdb/pdbseed/sysaux01.dbf input datafile file number=00005 name=/u02/oradata/testcdb/pdbseed/system01.dbf input datafile file number=00008 name=/u02/oradata/testcdb/pdbseed/undotbs01.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/71D9B31702F33E44E055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T104825_fq4sx6rt_.bkp tag=TAG20180814T104825 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35 Finished backup at 14-AUG-18 Starting Control File and SPFILE Autobackup at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/autobackup/2018_08_14/o1_mf_s_984135328_fq4sydjt_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 14-AUG-18 RMAN>
We can see in above output whole container database is backed up.
Pluggable Database Backup :
In the multitenant environment, we can take backup of individual pluggable database too.
Let us see the example :
Step 1 : Connect to RMAN with the target as CDB database
[oracle@localhost ~]$ rman target / Recovery Manager: Release 12.2.0.1.0 - Production on Tue Aug 14 11:03:20 2018 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: TESTCDB (DBID=2723894279)
Step 2 : We need to use backup pluggable database statement to take pluggable database rman backup
RMAN> backup pluggable database testpdb1; Starting backup at 14-AUG-18 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=32 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00010 name=/u02/oradata/testcdb/testpdb1/sysaux01.dbf input datafile file number=00012 name=/u01/oracle/oradata/testcdb/testpdb1/users01.dbf input datafile file number=00009 name=/u02/oradata/testcdb/testpdb1/system01.dbf input datafile file number=00011 name=/u02/oradata/testcdb/testpdb1/undotbs01.dbf channel ORA_DISK_1: starting piece 1 at 14-AUG-18 channel ORA_DISK_1: finished piece 1 at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/71D9DA30B4384F19E055000000000001/backupset/2018_08_14/o1_mf_nnndf_TAG20180814T110335_fq4tfjln_.bkp tag=TAG20180814T110335 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:36 Finished backup at 14-AUG-18 Starting Control File and SPFILE Autobackup at 14-AUG-18 piece handle=/u01/oracle/fast_recovery_area/TESTCDB/autobackup/2018_08_14/o1_mf_s_984135851_fq4tgn7t_.bkp comment=NONE Finished Control File and SPFILE Autobackup at 14-AUG-18 RMAN>
We can also pass comma separated list to take multiple pdbs
RMAN> BACKUP PLUGGABLE DATABASE pdb1, pdb2;
To take backup of specific tablespace of specific pdb we can pass a list as pdb_name:tablespace_name ;
RMAN> BACKUP TABLESPACE PDB1:USERS;
Thank you for giving your valuable time to read the above information.
If you want to be updated with all our articles send us the Invitation or Follow us:
Telegram Channel: https://t.me/helporacle
Skant Gupta’s LinkedIn: www.linkedin.com/in/skantali/
Joel Perez’s LinkedIn: Joel Perez’s Profile
LinkedIn Group: Oracle Cloud DBAAS
Facebook Page: OracleHelp
Very well explained.
helpful