Oracle RMAN 11g Backup and Recovery (87 page)

BOOK: Oracle RMAN 11g Backup and Recovery
2.57Mb size Format: txt, pdf, ePub

Chapter 11: RMAN Backups
247

■ Using the
set controlfile autobackup format for device type
command enables you to modify the default format for control file autobackups.

When doing backups, you may well need to use some of these commands. For example, if you wish to do a backup that creates two copies of each backup piece that is created and you want to allow for ten corruptions in datafile 3, you would craft a backup script that looks like this: run

{

set maxcorrupt for datafile 3 to 10;

set backup copies 2;

backup database;

}

Online RMAN Database Backups

We have spent the first half of this chapter on offline backups and the
set
command. If you are interested in online backups, then this section (and the following one) is for you. Still, don’t skip the previous sections, because they present a great deal of foundational information that won’t be repeated here. If you are jumping into the chapter at this point, first go back and read the previous sections. If you have read the first half of the chapter already and you find that you are a bit punchy, then take a short break before you forge on.

In this section, we first discuss several different kinds of online backups: backups of the entire database, tablespace backups, and datafile backups. We then look at archive log file backups and, finally, backups of the control file and parameter files.

Online Database Backups

As described in Chapters 1 and 3 in detail, to perform online backups with RMAN, our database must be in ARCHIVELOG mode. If your database is not in ARCHIVELOG mode, RMAN will generate an error if you try to perform an online backup. So, having ensured that we are in ARCHIVELOG mode, we are ready to do our first RMAN online backup.

NOTE

From this point on in this chapter, we assume that you have

configured default channels (refer to Chapter 3), unless we need to

point out something specifically. This saves you typing and allows

us to leave out commands such as
allocate channel
, giving us more
space to give you important information.

You will find that online backups are not all that different from offline backups. In fact, they are a bit simpler because you don’t have to mess with shutting down and then mounting the database. When you have your defaults configured (refer to Chapter 3), an online backup is as simple as this:

backup database plus archivelog;

This command does it all. First, the process does a log switch (using the
alter system archivelog
current
command). Next, it backs up any existing archived redo logs. Then, the actual database backup occurs. At this point, another log switch occurs (using the
alter system archivelog current
248
Part II: Setup Principles and Practices

command), and RMAN backs up the remaining archived redo logs (using the
backup archivelog
all
command). Finally, the autobackup of the control file and SPFILE occurs. Because a full database backup will always include datafile 1, which belongs to the SYSTEM tablespace, there will always be a backup of the control file and SPFILE.

RMAN Workshop:
Do an Online 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 MML layer, it has been configured. Finally, your database must be configured for and operating in ARCHIVELOG mode.

Step 1.
Start up RMAN:

C:\>rman target backup admin/robert

Step 2.
Start the backup:

RMAN> backup database plus archivelog;

Here is an example of a complete online RMAN backup following these steps: C:\>rman target backup admin/robert

RMAN> backup database plus archivelog;

Starting backup at 15-JUN-02

current log archived

using target database controlfile instead of recovery catalog

configuration for DISK channel 3 is ignored

allocated channel: ORA DISK 1

channel ORA DISK 1: sid 13 devtype DISK

channel ORA DISK 1: starting archive log backupset

channel ORA DISK 1: specifying archive log(s) in backup set

input archive log thread 1 sequence 351 recid 13 stamp 464457020

channel ORA DISK 1: starting piece 1 at 15-JUN-02

input archive log thread 1 sequence 352 recid 14 stamp 464609012

input archive log thread 1 sequence 353 recid 15 stamp 464609115

channel ORA DISK 1: finished piece 1 at 15-JUN-02

piece handle D:\BACKUP\ROBT\BACKUP 20DR2QJ8 1 1 comment NONE

channel ORA DISK 1: backup set complete, elapsed time: 00:00:11

channel ORA DISK 1: starting archive log backupset

channel ORA DISK 1: specifying archive log(s) in backup set

input archive log thread 1 sequence 357 recid 19 stamp 464610450

input archive log thread 1 sequence 358 recid 20 stamp 464611007

input archive log thread 1 sequence 359 recid 21 stamp 464611921

channel ORA DISK 1: starting piece 1 at 15-JUN-02

channel ORA DISK 1: finished piece 1 at 15-JUN-02

piece handle D:\BACKUP\ROBT\BACKUP 22DR2QJK 1 1 comment NONE

channel ORA DISK 1: backup set complete, elapsed time: 00:00:03

Chapter 11: RMAN Backups
249

Finished backup at 15-JUN-02

Starting backup at 15-JUN-02

using channel ORA DISK 1

channel ORA DISK 1: starting full datafile backupset

input datafile fno 00001 name D:\ORACLE\ORADATA\ROBT\SYSTEM01.DBF

input datafile fno 00005 name D:\ORACLE\ORADATA\ROBT\USERS01.DBF

input datafile fno 00004 name D:\ORACLE\ORADATA\ROBT\TOOLS01.DBF

input datafile fno 00003 name D:\ORACLE\ORADATA\ROBT\INDX01.DBF

input datafile fno 00002

name D:\ORACLE\ORADATA\ROBT\ROBT TEST RECOVER 02.DBF

input datafile fno 00010 name D:\ORACLE\ORADATA\ROBT\ROBT RBS 01.DBF

input datafile fno 00011

name D:\ORACLE\ORADATA\ROBT\ROBT TEST TBS 01.DBF

input datafile fno 00007

name D:\ORACLE\ORADATA\ROBT\ROBT TEST RECOVER 01.DBF

input datafile fno 00006

name D:\ORACLE\ORADATA\ROBT\ROBT TEST RECOVER 03.DBF

channel ORA DISK 1: starting piece 1 at 15-JUN-02

channel ORA DISK 1: finished piece 1 at 15-JUN-02

piece handle D:\BACKUP\ROBT\BACKUP 23DR2QJU 1 1 comment NONE

channel ORA DISK 1: backup set complete, elapsed time: 00:04:56

Finished backup at 15-JUN-02

Starting backup at 15-JUN-02

current log archived

using channel ORA DISK 1

channel ORA DISK 1: starting archive log backupset

channel ORA DISK 1: specifying archive log(s) in backup set

input archive log thread 1 sequence 360 recid 22 stamp 464612416

channel ORA DISK 1: starting piece 1 at 15-JUN-02

channel ORA DISK 1: finished piece 1 at 15-JUN-02

piece handle D:\BACKUP\ROBT\BACKUP 25DR2R2K 1 1 comment NONE

channel ORA DISK 1: backup set complete, elapsed time: 00:00:04

Finished backup at 15-JUN-02

Starting Control File and spfile Autobackup at 15-JUN-02

piece handle D:\BACKUP\ROBT C-3395799962-20020615-02 comment NONE

Finished Control File and spfile Autobackup at 15-JUN-02

We have now completed an entire online database backup! Next, we will look at tablespace backups.

NOTE

As we will discuss later in this chapter, a full database backup cannot
be used as a base for application of incremental backups.

Tablespace Backups

Occasionally, you will wish to do tablespace-level backups instead of backups of the entire database. This might be before you drop a partition that is specific to that tablespace, or perhaps

Other books

Bachelor Unleashed by Brenda Jackson
Dark Desires: Deliverance by Kourtney King
Kitty by Beaton, M.C.
The Good Life by Tony Bennett
It's Snow Joke by Nancy Krulik
Classic Sourdoughs by Jean Wood, Ed Wood
Six Bedrooms by Tegan Bennett Daylight