I got to know about this option when I saw a configured backup script in an environment running Oracle Database 12c with Zero Data Loss Recovery Appliance (Recovery Appliance). Then I started to search about this and although Oracle Documentation doesn’t really show a lof about this option I could understand that it is one of the types of the long-term backup retention and then the backup or copy never expires.. However, one of the prerequisite to use this option is to have a recovery catalog because the control file can’t keep the backup forever. So in this post I will simply show how to configure this option.
1- Create the directory to receive the backup:
[root@hostech ~]# cd / [root@hostech /]# mkdir backup_forever [root@hostech /]# chown oracle:dba backup_forever [root@hostech /]# ls -ld backup_forever drwxr-xr-x 2 oracle dba 4096 Oct 19 16:56 backup_forever [root@hostech /]#
2- Connect into the RMAN catalog:
[oracle@hostech ~]$ rman target / Recovery Manager: Release 12.1.0.2.0 - Production on Sat Oct 19 17:25:28 2019 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: techdb (DBID=4110865931) RMAN> connect catalog rcatowner/<password>@rman connected to recovery catalog database
3- By default, RMAN allocates one disk channel for all operations. So as I want to specify a non-default backup location I have to change the channel:
#Before
RMAN> show all; RMAN configuration parameters for database with db_unique_name techdb are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 20 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup_forever/ora_df%t_s%s_s%p'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_techdb.f'; # default
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup_forever/ora_df%t_s%s_s%p'; new RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup_forever/ora_df%t_s%s_s%p'; new RMAN configuration parameters are successfully stored starting full resync of recovery catalog full resync complete
#After
RMAN> show all; RMAN configuration parameters for database with db_unique_name techdb are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 20 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup_forever/ora_df%t_s%s_s%p'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_techdb.f'; # default
4- Run the backup with the KEEP FOREVER clause in order to have a backup that doesn’t expire in the new channel:
RMAN> BACKUP DATABASE KEEP FOREVER; Starting backup at 19-OCT-19 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=68 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=71 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=64 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=75 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=/u01/app/oracle/oradata/techdb/system01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/techdb/users01.dbf channel ORA_DISK_1: starting piece 1 at 19-OCT-19 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00003 name=/u01/app/oracle/oradata/techdb/sysaux01.dbf input datafile file number=00020 name=/u01/app/oracle/oradata/techdb/ts_inactive2.dbf channel ORA_DISK_2: starting piece 1 at 19-OCT-19 channel ORA_DISK_3: starting full datafile backup set channel ORA_DISK_3: specifying datafile(s) in backup set input datafile file number=00011 name=/u01/app/oracle/oradata/techdb/PDB04pdbseed/sysaux01.dbf input datafile file number=00018 name=/u01/app/oracle/oradata/techdb/ts_inactive channel ORA_DISK_3: starting piece 1 at 19-OCT-19 channel ORA_DISK_4: starting full datafile backup set channel ORA_DISK_4: specifying datafile(s) in backup set input datafile file number=00007 name=/u01/app/oracle/oradata/techdb/pdbseed/sysaux01.dbf channel ORA_DISK_4: starting piece 1 at 19-OCT-19 channel ORA_DISK_3: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088886_s526_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:01:18 channel ORA_DISK_3: starting full datafile backup set channel ORA_DISK_3: specifying datafile(s) in backup set input datafile file number=00010 name=/u01/app/oracle/oradata/techdb/PDB04pdbseed/system01.dbf input datafile file number=00017 name=/u01/app/oracle/oradata/techdb/ts_active.dbf channel ORA_DISK_3: starting piece 1 at 19-OCT-19 channel ORA_DISK_4: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088886_s527_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_4: backup set complete, elapsed time: 00:01:19 channel ORA_DISK_4: starting full datafile backup set channel ORA_DISK_4: specifying datafile(s) in backup set input datafile file number=00005 name=/u01/app/oracle/oradata/techdb/pdbseed/system01.dbf channel ORA_DISK_4: starting piece 1 at 19-OCT-19 channel ORA_DISK_2: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088886_s525_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:01:20 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00009 name=/u01/app/oracle/oradata/techdb/my_1000m_ts2.dbf input datafile file number=00019 name=/u01/app/oracle/oradata/techdb/ts_active2.dbf channel ORA_DISK_2: starting piece 1 at 19-OCT-19 channel ORA_DISK_2: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088967_s530_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:03 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00004 name=/u01/app/oracle/oradata/techdb/undotbs01.dbf input datafile file number=00015 name=/u01/app/oracle/oradata/techdb/tsrestore.dbf channel ORA_DISK_2: starting piece 1 at 19-OCT-19 channel ORA_DISK_1: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088886_s524_s1 tag=TAG20191019T173444 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=00012 name=/u01/app/oracle/oradata/techdb/example01.dbf input datafile file number=00016 name=/u01/app/oracle/oradata/techdb/userstechdb01.dbf channel ORA_DISK_1: starting piece 1 at 19-OCT-19 channel ORA_DISK_1: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088971_s532_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_2: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088971_s531_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:04 channel ORA_DISK_3: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088965_s528_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:00:22 channel ORA_DISK_4: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088966_s529_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_4: backup set complete, elapsed time: 00:00:21 current log archived using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 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=29 RECID=24 STAMP=1022088989 channel ORA_DISK_1: starting piece 1 at 19-OCT-19 channel ORA_DISK_1: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088990_s533_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 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 19-OCT-19 channel ORA_DISK_1: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088992_s534_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 using channel ORA_DISK_1 using channel ORA_DISK_2 using channel ORA_DISK_3 using channel ORA_DISK_4 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 19-OCT-19 channel ORA_DISK_1: finished piece 1 at 19-OCT-19 piece handle=/backup_forever/ora_df1022088994_s535_s1 tag=TAG20191019T173444 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 19-OCT-19
5- Check the backup in the configured location:
[oracle@hostech ~]$ ls -ltr /backup_forever/ total 2522600 -rw-rw---- 1 oracle oracle 414818304 Oct 19 17:35 ora_df1022088886_s527_s1 -rw-rw---- 1 oracle oracle 423903232 Oct 19 17:35 ora_df1022088886_s526_s1 -rw-rw---- 1 oracle oracle 546185216 Oct 19 17:36 ora_df1022088886_s525_s1 -rw-rw---- 1 oracle oracle 2146304 Oct 19 17:36 ora_df1022088967_s530_s1 -rw-rw---- 1 oracle oracle 709672960 Oct 19 17:36 ora_df1022088886_s524_s1 -rw-rw---- 1 oracle oracle 2146304 Oct 19 17:36 ora_df1022088971_s532_s1 -rw-rw---- 1 oracle oracle 4390912 Oct 19 17:36 ora_df1022088971_s531_s1 -rw-rw---- 1 oracle oracle 208969728 Oct 19 17:36 ora_df1022088966_s529_s1 -rw-rw---- 1 oracle oracle 214319104 Oct 19 17:36 ora_df1022088965_s528_s1 -rw-rw---- 1 oracle oracle 38442496 Oct 19 17:36 ora_df1022088990_s533_s1 -rw-rw---- 1 oracle oracle 98304 Oct 19 17:36 ora_df1022088992_s534_s1 -rw-rw---- 1 oracle oracle 18022400 Oct 19 17:36 ora_df1022088994_s535_s1 [oracle@hostech ~]$
6- Change the channel to the default configuration in order to clear all the modification:
[oracle@hostech ~]$ rman target / catalog rcatowner/password@rman Recovery Manager: Release 12.1.0.2.0 - Production on Sat Oct 19 17:37:56 2019 Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved. connected to target database: techdb (DBID=4110865931) connected to recovery catalog database RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR; old RMAN configuration parameters: CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup_forever/ora_df%t_s%s_s%p'; old RMAN configuration parameters are successfully deleted starting full resync of recovery catalog full resync complete RMAN> show all; RMAN configuration parameters for database with db_unique_name techdb are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 20 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET; CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_techdb.f'; # default
Hi! I am Bruno, a Brazilian born and bred, and I am also a naturalized Swedish citizen. I am a former Oracle ACE and, to keep up with academic research, I am a Computer Scientist with an MSc in Data Science and another MSc in Software Engineering. I have over ten years of experience working with companies such as IBM, Epico Tech, and Playtech across three different countries (Brazil, Hungary, and Sweden), and I have joined projects remotely in many others. I am super excited to share my interests in Databases, Cybersecurity, Cloud, Data Science, Data Engineering, Big Data, AI, Programming, Software Engineering, and data in general.
(Continue reading)