The RMAN shell allows for configuring parameters that affect RMAN behavior and how backups and restores are performed. In this video, learn how to connect to the RAMN prompt and use the CONFIGURE command to set RMAN runtime parameters such as backup retention policy and disk channel formats.
- [Instructor] RMAN stores built-in configuration options that can affect how backups will be performed. We need to understand some of those different configuration options before we can start running RMAN database backups. To view these different RMAN configuration options, we'll first have to open the RMAN command line prompt and have RMAN connect to our target database, that is the database we wish to back up or recover and just as a quick reminder, remember that if you are using the Oracle-supplied virtual machine for the exercises in this course, you will have to unset the TWO_TASK parameter before you can continue, so type export TWO_TASK in capital letters equals and type enter.
Now to have RMAN connect to the database instance running on this local virtual machine, all I have to do is type RMAN which is the RMAN command line utility, target equals which instruct RMAN to which database it should connect to and the backslash character. Again, this will connect RMAN to the Oracle instance running on this virtual machine.
We'll see different options for RMAN connection strings later in this course. Pressing enter will connect RMAN to the Oracle instance running locally on this VM. We can see the name of the Oracle instance in the RMAN prompt. This will change depending on the Oracle database instance you are connected to. To view all currently configured RMAN configuration options, we can simply type show all.
As you can see, we have several RMAN configuration options which have been configured for us by default. The first parameter we'll discuss is configure retention policy to redundancy one. This parameter specifies how many full or level zero backups of each data file and control file RMAN should keep, that is if the number of full or level zero backups for a specific data file or a control file exceeds the redundancy setting, then RMAN consider those extra backups as obsolete and can delete them upon user's request.
If you don't have the default retention policy redundancy parameter configured in your RMAN, you can configure it manually. You can find a sample configuration command included in your exercise file, so we'll just copy this command and paste it to our RMAN prompt. Note that simply by typing configure retention policy to redundancy 1 and pressing enter, we have supplied a new configuration value for this RMAN parameter.
The default retention policy in most databases is redundancy one. We'll see later how this comes into play when we'll start managing our RMAN backups. The next parameter we'll discuss is the configure default device type to disk parameter. This parameter specify that when running RMAN backups without explicitly specifying a destination for the backup sets, RMAN will create and store the backups on a disk instead of a tape device.
Next, we also have a parameter called control file auto backup which is enabled by default and instruct RMAN to back up the database control file, an SP file, when a database backup using RMAN is executed. The auto backup enables RMAN to recover the database even if the control file or server parameter file are lost. As you can see, the parameter is set to on by default.
Let's leave it as such so that RMAN will automatically back up our control file as part of the database backup. Following that, we can also specify the name and the path of the control file auto backup using the control file auto backup format parameter. We'll leave it at the default value for now. As you saw earlier, setting parameters in RMAN is easy and can be done using the configure command.
For example, let's see how we can set RMAN's retention period. The retention period specifies for how long you wish to retain your RMAN backups. When RMAN takes a backup, it will automatically delete all old backups that are older than the configured retention period. So, let's set a retention period of seven days which will instruct RMAN to keep database backups for a week. You can find the configure retention policy to recover a window of seven days command included in your exercise file.
So, let's copy this command and paste it into our RMAN prompt. We can see that this new setting has been enabled by showing all of the configuration options again, so I'll type show all. As you can see, we have set the retention policy to a recovery window of seven days. We will see how this comes into play later in our chapter when we'll start managing existing RMAN backups and delete old RMAN backups.
We can also specify where we want the RMAN backups to be created. By default, it will go to the directory we specified for the database fast recovery area. This is often what database administrators choose to do but we can override this default RMAN destination and configure what is known as a new RMAN channel which is the RMAN terminology for specifying a destination for our backups. You can find a sample command included in your exercise file.
So, let's copy this configure channel device type command and paste it into our RMAN prompt. This command instructs RMAN to create a new channel of a disk type and not a tape type so the backups will be stored on a disk and as part of the format section of the command instruct RMAN where or in which directory on disk that the backups should be stored.
The %d, %I, %T and %U characters are known as RMAN format spec and used to specify a filing format for backup files when they will be created. For example, percentage D will include the database name in the backup file name. %I will include the database ID and %d will include the time while %U specified a system generated unique file name.
Typing show all again will show us the new location specified for RMAN backups. In case we want to unset an already configured RMAN parameter, we can do that using the clear command. For example, we can unset the channel configuration option we have just set, so I can type configure channel device type disk and clear.
Typing show all again will show us that we no longer have a configured value for this parameter. There are a lot of additional RMAN configuration options to explore, more than we can cover in a single lesson, so feel free to consult the online RMAN documentation. Also, for many of these configuration options, we will have the ability to configure these parameters ad hoc for specific RMAN backups when they're executed.
We'll see more on this later when we'll create RMAN backup scripts.
- Complete vs. incomplete recovery
- Point-in-time recovery
- Failure categories
- Preparing the virtual machine
- Performing user-managed backups
- Restoring from manual backups
- Performing full and incremental backups with RMAN
- Recovering a PDB and CDB
- Exporting and importing data with Oracle Data Pump
- Performing logical backups with Data Pump
- Using Flashback Query, Table, and Database
- Creating restore points