Question: How do I perform a cold
backup in RMAN?
Answer:
Here is how to perform an Offline (Cold) Backup of
your Database with RMAN
RMAN Offline Backup
Recall that an offline backup is a
backup of the database while it is not running. Hence, to
perform our backup we will shutdown the database from RMAN
and then mount the database. We will perform the backup.
Once the backup is complete we will restart the database
again. Here is an example of this process:
RMAN>shutdown immediate
RMAN>startup mount
RMAN>backup database;
RMAN>sql 'alter database open';
Once this process is complete, you
have completed your first backup.
In this section we will show you how
to perform an offline (or cold) backup using RMAN. This will
require that the database be down (that's why it's called an
offline backup). Oracle supports online backups also, and we
will be covering these shortly.
Before we can use RMAN we need to
configure a few settings. In this section we will look at
configuring the database for our backup, and then we will
proceed to do the backup.
Configure Oracle and RMAN for Backup
Before we can use RMAN we will need
to configure a few settings. In this section we will assume:
1. That you will be backing up to a
file system called /u01/app/oracle/backup. You will need to
create this file system if it does not already exist.
2. That you are using an SPFILE.
Note that if you created your
database as we described earlier in the book, you should
already be using an SPFILE.
The configuration is pretty basic.
First, we need to configure a couple of database parameters.
These parameters will configure the Flash Recovery Area of
the database.
This is the location that all the
disk backups will be made to. To configure the flash
recovery area we will use the alter system command to set
the value of two database parameters:
* db_recovery_file_dest - Determines the location of the flash recovery area.
* db_recovery_file_dest_size
- Determines how much space can be used by Oracle in the
flash recovery area.
We will configure the flash recovery
area to the value of /u01/app/oracle/backup, and we will
assign it a 2 Gigabyte limit. Note!
Oracle flash recovery
area re-named to fast recovery area
You may need to assign your flash
recovery area more space depending on the following factors:
* The size of your database
* The number of backups you want to
keep
* If you are running your database
in ARCHIVELOG mode (which we will discuss later in this
chapter).
Here is an example of configuring
the flash recovery area for the settlings listed previously.
This assumes your database is using a SPFILE which we
discussed in earlier chapters:
Alter system set db_recovery_file_dest='/u01/app/oracle/backup';
Alter system set db_recovery_file_dest_size=2G;
We will also want to set a couple of
RMAN settings before we do our first backup. Start RMAN as
detailed earlier in this section with:
$ rman target /
Now, we want to configure the
following:
* Automatic backups of the control
file and SPFILE.
* Retention policy to a redundancy
of 2
Next, we can use the RMAN configure
command to configure these settings as seen in this example:
-- Configure the retention
policy to redundancy of 2.
-- This means RMAN will try to
keep 2 copies of the database backups.
RMAN> configure retention
policy to redundancy 2;
-- Configure automated backups
of the control file and SPFILE.
RMAN>configure controlfile
autobackup on;
Now that RMAN and the database are
configured, we are ready to proceed to backup the database.
Also, see my
notes on the
different backup types and the differences between
incremental cumulative and incremental differential backups.