The Sysadmin Wiki


157pages on
this wiki
Add New Page
Talk0 Share

Rman means recovery manager. It let's you backup your database when it is online, no needs to do a shutdown of the database.

If you got any troubles in your database of your hardware, you can recover your database to the point when you did the backup. You can find more information, on oracle web site here. Section "Backup and recovery".

All the things that I will explain here, are tested on a oracle database 10gR2 and it's working. It will probably be the same with oracle database 9i. But of course, it's up to you to check it out before doing anything on oracle database 9i.

Some notes Edit

  • You should be aware that it can slown down the responsiveness of your database, as it uses the memory allocated to oracle, use a lot of input/output and of course the cpu. So, you should perhaps not use it when a lot of user are logged in...
  • To use rman properly, your database have to be in "archivelog". If this is not the case, 4 step need to be done to enable it :
    • shutdown first your database
    • startup mount
    • alter database archivelog
    • alter database open

Connecting to rman Edit

You can use rman in 2 way :

  1. entering command in the rman prompt
  2. entering command in a file, and use rman in a batch way

We will use here, only the command line way. So, to enter to the rman prompt, you simply need to enter this command :

rman target /

this will connect rman to the database ( DBID ) which are set to your environment in UNIX. command printenv if you don't known your DBID.

You can also simply connect to rman, and then choose the database that you want to connect to. It can be done with this two command :

  • rman

and in the rman prompt :

  • connect /

Configuration Edit

You will specify here how and where you want to backup all the things that rman can do.

First, to view the current setting of rman, let's simply do :

RMAN> show all;

Then, if you apply any new settings to rman config, check it with this command.

There is 2 way to backup things with rman, the simply copy or an advanced type file design for rman. We will chose the second way, as it can be compressed, and it is easily managed by rman and more efficient way to do the backup. So, let's specify this type of backup to rman :

RMAN> configure device type disk backup type to compressed backupset;

You can choose to not compress the backupset, and test your own way to compress the file of course, so you would perhaps do :

RMAN> configure device type disk backup type to backupset;

As you probably known control file are very important for oracle. So, I would recommend to back it up as soon as you change something with rman, this can be done with :

RMAN> configure controlfile autobackup on;

Like that, whenever you do a backup of a datafile, all database or something else within rman, it will automatically backup the control file. What we want now, is to specify how rman will name this backup'ed control file, and where to put it, so :

RMAN> configure controlfile autobackup format for device type disk to '/my/dir/for/controlfile/cf-%F';

The " %F " is replace by rman with DBID + TIMESTAMP + HEXADECIMAL caracter.

Let's now configure the way rman will backup the datafile. We will also tell him where to put his backup and how to name them :

RMAN> configure channel device type disk format '/opt/oracle/rman-backup/bkp_%t_%s_%p';
  •  %t represents a timestamp
  •  %s represents the backup set number
  •  %p represents the piece number

Note that when you will do a backup of a big database, it is possible that the file produced will be very big, and perhaps too big for the file system by instance. So, you can specify to rman to do a sort of "split" , and not bypass a specific size of file. This can be done with :

RMAN> configure channel device type disk format '/opt/oracle/rman-backup/bkp_%t_%s_%p' maxpiecesize = 600m;

So, each file produced by rman will be not greater than 600m, like that you can, by instance, put the backup'ed file on a cd or dvd.

Doing full backup Edit

To do simply a full backup that can be used to do an incremental backup, let's do this :

RMAN> backup incremental level 0 database;

Doing incremental backup Edit

Once you done your full backup, say once a week, you can do an incremental backup of your database. This is faster and more efficient of course. This can be done with :

RMAN> backup incremental level 1 database;

Listing backup Edit

Once your backup is done, you can view the details of them with this command :

RMAN> list backup;

This will probably produce a lot of things. At the beginning, you won't probably understand what it's all about. So, there is way to only have a summary of the last output with :

RMAN> list backup summary;

Deleting backup Edit

Once your backup is done, you will perhaps put it on a safer place, like a cd-rom, dvd, tape or something else...

Of course, you can delete it in your bash prompt all the backup'ed file produced by rman. But this can be done automatically also with rman, it's better to have a central point of management.

If you want to enter your answer before really erasing any backup'ed file, let's enter this :

RMAN> delete backup;

Otherwise, you can also do it without any answer and delete them once the command entered with :

RMAN> delete noprompt backup;

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.