We know that when we take backup using RMAN it has its configuration for Retention Policy. Every backup has its retention policy either in days or in a number of back-ups. And backups are stored in the Fast recovery area. Once a backup exceeds from its retention policy it becomes obsolete.
But today we will see a KEEP FOREVER clause of RMAN taking a backup. Which is very important when we require it for some hands-on activity.
It is called archival backup. Archival backups can be created with an open or mounted database.
Things to consider when taking archival backup :
1. We must configure the recovery catalog to take archival backup.
2. Archival backups cannot be taken in Fast Recovery Area
Steps to create an archival backup
Step 1: Connect to target as target database and catalog as catalog database :
[oracle@localhost ~]$ rman target sys/oracle catalog rcatown/rcat@rpdb1 Recovery Manager: Release 12.2.0.1.0 - Production on Mon Jan 7 12:05:03 2019 Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved. connected to target database: DEMO (DBID=3740643610) connected to recovery catalog database RMAN>
Step 2: Take backup with keep forever
RMAN> backup database keep forever; Starting backup at 07-JAN-19 starting full resync of recovery catalog full resync complete allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=1 device type=DISK backup will never be obsolete archived logs required to recover from this backup will be backed up 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/DEMO/datafile/o1_mf_system_g2v3h4nx_.dbf input datafile file number=00003 name=/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3kjm5_.dbf input datafile file number=00004 name=/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3lxr9_.dbf input datafile file number=00007 name=/u02/oradata/DEMO/datafile/o1_mf_users_g2v3lywc_.dbf channel ORA_DISK_1: starting piece 1 at 07-JAN-19 RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/07/2019 12:06:31 ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep attributes continuing other job steps, job failed will not be re-run 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/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_sysaux_g2v4j0p1_.dbf input datafile file number=00009 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_system_g2v4j0j1_.dbf input datafile file number=00011 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_undotbs1_g2v4j0p2_.dbf input datafile file number=00013 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_tbs_rcat_g2v5zj00_.dbf input datafile file number=00012 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_users_g2v4mrlj_.dbf channel ORA_DISK_1: starting piece 1 at 07-JAN-19 RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/07/2019 12:06:32 ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep attributes continuing other job steps, job failed will not be re-run 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/DEMO/datafile/o1_mf_sysaux_g2v3ot3q_.dbf input datafile file number=00005 name=/u02/oradata/DEMO/datafile/o1_mf_system_g2v3ot3x_.dbf input datafile file number=00008 name=/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3ot45_.dbf channel ORA_DISK_1: starting piece 1 at 07-JAN-19 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 01/07/2019 12:06:33 ORA-19811: cannot have files in DB_RECOVERY_FILE_DEST with keep attributes RMAN>
You will get above error if you are not set location for backup other than DB_RECOVERY_FILE_DEST.
Step 3: Set backup format and take backup
RMAN> BACKUP DATABASE FORMAT '/u02/bkp/%U' KEEP FOREVER; Starting backup at 07-JAN-19 using channel ORA_DISK_1 backup will never be obsolete archived logs required to recover from this backup will be backed up 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/DEMO/datafile/o1_mf_system_g2v3h4nx_.dbf input datafile file number=00003 name=/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3kjm5_.dbf input datafile file number=00004 name=/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3lxr9_.dbf input datafile file number=00007 name=/u02/oradata/DEMO/datafile/o1_mf_users_g2v3lywc_.dbf channel ORA_DISK_1: starting piece 1 at 07-JAN-19 channel ORA_DISK_1: finished piece 1 at 07-JAN-19 piece handle=/u02/bkp/0stmnphe_1_1 tag=TAG20190107T121021 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15 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/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_sysaux_g2v4j0p1_.dbf input datafile file number=00009 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_system_g2v4j0j1_.dbf input datafile file number=00011 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_undotbs1_g2v4j0p2_.dbf input datafile file number=00013 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_tbs_rcat_g2v5zj00_.dbf input datafile file number=00012 name=/u02/oradata/DEMO/7E8758AC5ED126B4E055000000000001/datafile/o1_mf_users_g2v4mrlj_.dbf channel ORA_DISK_1: starting piece 1 at 07-JAN-19 channel ORA_DISK_1: finished piece 1 at 07-JAN-19 piece handle=/u02/bkp/0ttmnpjp_1_1 tag=TAG20190107T121021 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=00006 name=/u02/oradata/DEMO/datafile/o1_mf_sysaux_g2v3ot3q_.dbf input datafile file number=00005 name=/u02/oradata/DEMO/datafile/o1_mf_system_g2v3ot3x_.dbf input datafile file number=00008 name=/u02/oradata/DEMO/datafile/o1_mf_undotbs1_g2v3ot45_.dbf channel ORA_DISK_1: starting piece 1 at 07-JAN-19 channel ORA_DISK_1: finished piece 1 at 07-JAN-19 piece handle=/u02/bkp/0utmnpku_1_1 tag=TAG20190107T121021 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25 current log archived using channel ORA_DISK_1 backup will never be obsolete archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting archived log backup set channel ORA_DISK_1: specifying archived log(s) in backup set input archived log thread=1 sequence=6 RECID=5 STAMP=996927160 channel ORA_DISK_1: starting piece 1 at 07-JAN-19 channel ORA_DISK_1: finished piece 1 at 07-JAN-19 piece handle=/u02/bkp/0vtmnplq_1_1 tag=TAG20190107T121021 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 backup will never be obsolete archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current SPFILE in backup set channel ORA_DISK_1: starting piece 1 at 07-JAN-19 channel ORA_DISK_1: finished piece 1 at 07-JAN-19 piece handle=/u02/bkp/10tmnplu_1_1 tag=TAG20190107T121021 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 backup will never be obsolete archived logs required to recover from this backup will be backed up channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 07-JAN-19 channel ORA_DISK_1: finished piece 1 at 07-JAN-19 piece handle=/u02/bkp/11tmnpm0_1_1 tag=TAG20190107T121021 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 07-JAN-19 RMAN>
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