Paul Karman

Oracle Certified Professional DBA


Home

Contact

Curriculum

Algemene voorwaarden

Tarief

Verhandelingen



The five minute rman backup

It really isn't hard to start with rman, you might just need a quick primer. So here it is.

Although the rman backup itself is simple and fast I need to make some assumptions

  • Your database runs in "archive log" modus. If you don't know what archivelog mode is then this is a great moment to learn a tiny bit about it by clicking this link.
  • Your OS is Unix/Linux. (Although I think you only need to change the slashes if you want to do this exercise on Windows.)
  • You are using Oracle RDBMS version 10g or higher.
  • You are smart enough to try this on a test environment. In other words, this is the usual disclaimer saying that although I take great care to provide you with a safe procedure I cannot be held responsible for any damages.

The key points I hope you will pick up out of this exercise are these:

  • Repository smository. Although there are situations where the Repository provides you with useful functionality that does not mean you need it for every site. It only adds complexity.
  • Difficult cryptic commands? Rman supplies them to you in a "cut and paste" ready format.
  • Lost track of your backup? It's really not that hard to control the location of the backup set.



So lets start the stopwatch and go!

  • Log on. Use a character oriented terminal to log in to your system. The user under which should be the user you used to install Oracle or, if you have been a bit more conscious about it, another user with the right privileges to manipulate an oracle instance.

  • Check the ORACLE_SID. Check whether the unix environment variable ORACLE_SID is set. If it's not then a ps -ef|grep ora_smon should remind you to the name you supplied during installation or database creation.

  • Enter "rman target /" . This starts an rman session and connects to the database specified in ORACLE_SID.

  • Configure the location for your backup set. Here is where the cut and paste possibilities of Rman shine. Execute the command "show all;" and use the output to create and execute the following commands:
    • CONFIGURE CONTROLFILE AUTOBACKUP ON;
    • CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '<path to your preferred backup location>/%F';
    • CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '<path to your preferred backup location>/%d_%U';

      Did you discover you could not drag and drop that last command? Correct! That one little statement is probably the key breaking point where many get tired of looking into rman. It is where you tell rman where to save it's backups. Cherish the fact that you know it now. And the way you just set it now makes it possible to make all your future backups with only command ... which is on the next line...

  • Enter "backup as compressed backupset database plus archivelog;"

    Congratulations! You just did your first hot backup, including archived log files and you deleted those archived log files automatically after the backup and you squeezed all empty blocks out of the backup making it much smaller, all in one command!



    Now... To prove that you really made a backup...

    • "rman target /"
    • "shutdown abort"
    • Delete one or more datafiles. Have fun, delete the system datafile.
    • "startup" and notice that Oracle complains about a missing data file.
    • "restore datafile <number of lost datafile>;"
    • "recover datafile <number of lost datafile>;"
    • "alter database open;"

      and you are back in the air!



    Hopefully this exercise has tickled your imagination enough to start looking in all those other possible commands and configurations. Retention policy for instance is mighty interesting. Maybe you want to be even more bold and start setting your whole system up with a good and simple implementation of rman as described here.



    Paul Karman

Webpage hosted by Goliath       System up: 429 days and 21 hours