Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
228
Part II: Setup Principles and Practices
RMAN Target
RMAN Client Version (with
RMAN Catalog
RMAN Catalog
Database Version
applied patches)
Database Version
Schema (with
(with applied
(with applied patches)
applied patches)
patches)
8.0.6
8.0.6
>=8.1.7
>=8.0.6
8.1.7
8.0.6.1
>=8.1.7
>=8.1.7
8.1.7
8.1.7
8.1.7
>=RMAN client
8.1.7.4
8.1.7.4
>=8.1.7
8.1.7.4
8.1.7.4
8.1.7.4
>=8.1.7
>=9.0.1.4
9.0.1
9.0.1
>=8.1.7
>=RMAN client
9.2.0
>=9.0.1.3 and <=the target
>=8.1.7
>=RMAN client
database executable version
10.1.0
>=9.0.1.3 and <=the target
>=9.0.1
>=RMAN client
database executable version
10.2.0
>=9.0.1.3 and <=the target
>=9.0.1
>=RMAN client
database executable version
11.1.0
>=9.0.1.3 and <=the target
>=9.0.1
>=RMAN client
database executable version
11.2.0
>=9.0.1.3 and <=the target
>=9.0.1
>=RMAN client
database executable version
TABLE 11-1
RMAN Compatibility Matrix
Monitoring RMAN Backup Status
RMAN produces output during the backup process. If you enable logging when you start RMAN, that output is suppressed. You can monitor RMAN operations by keeping an eye on the log file being generated, or you can use the V$ view V$RMAN_OUTPUT, as shown in this example: SQL> select output from v$rman output order by stamp;
OUTPUT
Starting
backup at 12 NOV 05
using target database control file instead of recovery catalog
allocated channel: ORA DISK 1
channel ORA DISK 1: sid 138 devtype DISK
allocated channel: ORA DISK 2
Chapter 11: RMAN Backups
229
channel ORA DISK 2: sid 154 devtype DISK
channel ORA DISK 1: starting compressed full datafile backupset
channel ORA DISK 1: specifying datafile(s) in backupset
input datafile fno 00001
name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\SYSTEM01.DBF
input datafile fno 00004
name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\USERS01.DBF
channel ORA DISK 1: starting piece 1 at 12 NOV 05
input datafile fno 00003
name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\SYSAUX01.DBF
channel ORA DISK 2: specifying datafile(s) in backupset
channel ORA DISK 2: starting compressed full datafile backupset
input datafile fno 00005name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\EXAMPLE01.DBF
input datafile fno 00002name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\UNDOTBS01.DBF
channel ORA DISK 2: starting piece 1 at 12 NOV 05
Offline RMAN Database Backups
Okay, so you think this RMAN thing sounds good, and the first few chapters were sure interesting.
Time to really put the beast to work! The first backup topic we will discuss is performing offline (or cold) backups of the Oracle database. An offline RMAN backup is taken with the database mounted, but not open (obviously). If you have set up your default configuration settings for RMAN (as discussed in Chapter 3), then an offline RMAN backup is fairly straightforward.
Offline Backups Using Default Settings
To do an offline backup, first sign into RMAN (in the example we provide for this backup, we are not using a recovery catalog). Next, use the RMAN commands
shutdown
and
startup mount
to mount the database, which is the condition that the database must be in to perform an offline backup. Once the database has been mounted, simply issue a
backup database
command and the backup will occur. Here is an example of the commands you would issue to perform an offline backup via RMAN:
shutdown
startup mount
backup database;
startup
If you prefer, you could do this as a compressed backup set:
shutdown
startup mount
backup as compressed backupset database;
startup
230
Part II: Setup Principles and Practices
RMAN Workshop:
Do an Offline Backup
Workshop Notes
This workshop assumes that your database has been configured with automatic channels, as shown in Chapter 3. It also assumes that you have configured a database account called backup_
admin for backups (as described in Chapter 3). In addition, it assumes that if you are using the Media Management Library (MML) layer, it has been configured.
Step 1.
Start up RMAN:
C:\>rman target backup admin/robert
Step 2.
Shut down the database with the
shutdown immediate
command: RMAN> shutdown immediate
Step 3.
Mount the database with the
startup mount
command: RMAN> startup mount
Step 4.
Back up the database with the
backup database
command. In this case, to save disk space, we will compress our backup set (since we have not configured compression as a default setting):
RMAN> backup as compressed backupset database;
Step 5.
Use the
alter database open
command to open the database: RMAN> alter database open;
Here is an example of a complete offline RMAN backup following these steps: C:\>rman target backup admin/Robert
RMAN> shutdown
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 272629760 bytes
Fixed Size 1248504 bytes
Variable Size 83886856 bytes
Database Buffers 184549376 bytes
Redo Buffers 2945024 bytes
RMAN> backup as compressed backupset database;
Starting backup at 04 NOV 05
allocated channel: ORA DISK 1
channel ORA DISK 1: sid 157 devtype DISK
allocated channel: ORA DISK 2
Chapter 11: RMAN Backups
231
channel ORA DISK 2: sid 155 devtype DISK
channel ORA DISK 1: starting compressed full datafile backupset
channel ORA DISK 1: specifying datafile(s) in backupset
input datafile fno 00001
name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\SYSTEM01.DBF
input datafile fno 00004
name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\USERS01.DBF
channel ORA DISK 1: starting piece 1 at 04 NOV 05
channel ORA DISK 2: starting compressed full datafile backupset
channel ORA DISK 2: specifying datafile(s) in backupset
input datafile fno 00003
name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\SYSAUX01.DBF
input datafile fno 00005name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\EXAMPLE01.DBF
input datafile fno 00002name C:\ORACLE\PRODUCT\10.2.0\ORADATA\ROB10R2\UNDOTBS01.DBF
channel ORA DISK 2: starting piece 1 at 04 NOV 05
channel ORA DISK 1: finished piece 1 at 04 NOV 05
piece handle
C:\ORACLE\PRODUCT\10.2.0\FLASH RECOVERY AREA\ROB10R2\BACKUPSET\2005 11 04\
O1 MF NNNDF TAG20051104T102913 1PQ32XLB .BKP
tag TAG20051104T102913 comment NONE
channel ORA DISK 1: backup set complete, elapsed time: 00:01:12
channel ORA DISK 2: finished piece 1 at 04 NOV 05
piece handle
C:\ORACLE\PRODUCT\10.2.0\FLASH RECOVERY AREA\ROB10R2\BACKUPSET\2005 11 04\
O1 MF NNNDF TAG20051104T102913 1PQ33J52 .BKP
tag TAG20051104T102913 comment NONE
channel ORA DISK 2: backup set complete, elapsed time: 00:01:11
Finished backup at 04 NOV 05
Starting Control File and SPFILE Autobackup at 04 NOV 05
piece handle
C:\ORACLE\PRODUCT\10.2.0\FLASH RECOVERY AREA\ROB10R2\AUTOBACKUP\2005 11 04\
O1 MF S 573474457 1PQ357T0 .BKP comment NONE
Finished Control File and SPFILE Autobackup at 04 NOV 05
Finished Control File and SPFILE Autobackup at 04 NOV 05
RMAN> alter database open;
Note that in the preceding example and the RMAN Workshop, we used very few commands.
RMAN will automatically use the default configuration settings that we have defined (refer to Chapter 3). We really didn’t have to do anything but issue the
shutdown
and
startup mount
commands to shut down and restart the database. We then issued the
backup as compressed backupset database
command and sat back to watch our backup take off. Pretty easy, huh? RMAN has backed up our database datafiles, our control file, and our SPFILE (assuming we have configured it to do so). Once it’s done, all we need to do is issue the
alter database open
command, and our backup is complete.
In this example, Oracle created two backup sets, each of which contains a single backup piece. As you can see from the output, these backup pieces will be created in the flash recovery area (FRA) of this database, which is C:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA: piece handle
C:\ORACLE\PRODUCT\10.2.0\FLASH RECOVERY AREA\ROB10R2\BACKUPSET\2005 11 04\
O1 MF NNNDF TAG20051104T102913 1PQ33J52 .BKP
tag TAG20051104T102913 comment NONE