Oracle backup with RMAN

Deploying an Oracle database is one thing, but doing a good recovery backup plan is another matter. Good for us, Oracle comes with its own tool for doing backups called “RMAN”.

Sure, one can do backup with the Enterprise Manager, but with it you will need to shut down the database in order to do a backup. Not exactly, what is needed with a production database that is online 24/7 and can’t afford a shutdown. In order to do a “online backup” one needs to run a script for RMAN.

RMAN uses the same login settings as your SQLPLUS login and thus it should be rather easy to do so. In our case we have also configured a backup catalog within Oracle with its own tablespace. Once done a backup script can be run each night with crontab.

Here is how to setup the backup catalog:


sqlplus sys
SQL> create user rman identified by rman;
SQL> alter user rman default tablespace tools temporary tablespace temp;
SQL> alter user rman quota unlimited on tools;
SQL> grant connect, resource, recovery_catalog_owner to rman;
SQL> exit;

in case you don’t have a tablespace called “tools” you need to create it with:


create tablespace tools
  logging
  datafile '/dbf1/tools.dbf' 
  size 32m 
  autoextend on 
  next 32m maxsize 2048m
  extent management local;

Now you can log in to RMAN create the catalog schema with:


rman catalog rman/rman
RMAN> create catalog tablespace tools;
RMAN> exit;

Then register the database with;


rman catalog rman/rman target sys/password@ORCL
RMAN> register database;

Make sure you connect to the database that you need to backup!

I then created a script that will keep my backup for 2 days. I also have a script that will compress the backup files and move them to another server. Here is my backup script:


CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
'/opt/oracle/backup/autobackup_control_file%F';
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
run {
ALLOCATE CHANNEL RMAN_BACK_CH01 TYPE DISK;
CROSSCHECK BACKUP;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT
'/opt/oracle/backup/databasefiles_%d_%u_%s_%T';
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL FORMAT
'/opt/oracle/backup/archivelogs_%d_%u_%s_%T' DELETE INPUT;
BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE FORMAT
'/opt/oracle/backup/controlfile_%d_%u_%s_%T';
CROSSCHECK BACKUP;
DELETE NOPROMPT OBSOLETE;
DELETE NOPROMPT EXPIRED BACKUP;
RELEASE CHANNEL RMAN_BACK_CH01;
}
exit;

This will backup your control file, archive log and database. It will also compress the backup and will remove the old files.

In my case, I saved the above script as RMA_backup.txt and have a RMAN_script.sh with the following inside:


#!/bin/bash
rman target sys/password@ORCL @/opt/rman_backup.txt;

Troubleshooting
I have seen that sometimes we got errors running the above script with:


RMAN-06207: WARNING: 5 objects could not be deleted for DISK channel(s) due
RMAN-06208:          to mismatched status.  Use CROSSCHECK command to fix status
RMAN-06210: List of Mismatched objects

With RMAN you can check your backup with the following commands:


CROSSCHECK backup of database;  
CROSSCHECK backup of controlfile;
CROSSCHECK archivelog all; 

If all goes well, you should not get any errors running these commands. Still we had the above errors, even thought I issued the command to delete obsolte control files with;


DELETE NOPROMPT OBSOLETE RECOVERY WINDOW OF 2 DAYS;

The key to success was when I used the “FORCE” command as;


DELETE FORCE NOPROMPT OBSOLETE RECOVERY WINDOW OF 2 DAYS;

Hope this helps anybody. There is a good reference for backups over at the Oracle FAQ.

Why GPL

Matt Mullenweg of the famous WordPress application talks in the below video about GPL and why WordPress uses it. I recently had some discussions with some people why Razuna, our Open Source Media Management (Digital Asset Management) Solution, uses the AGPL and why we chose it. It think Matt brings it right to the point and I agree with him totally :-)

One of the reasons why the internet and open source works

Social theorist Jonathan Zittrain gave a very entertaining and enlightening talk about the random kindness on the Internet and how we can all benefit from this worldwide “kindness”.

Listening to his talk, you will also understand why open source works and why people spend many many hours contributing to projects without getting any financial rewards for it. It is the kindness and the good within the human nature to do “good” and to feel “belonging” to a greater good. I guess, open source projects, touch on this very common need of the humans.

I for myself, feel very satisfied to see so many people taking up our Open Source Digital Asset Management and contribute to it in any way possible. At this point, thank you all :-)

Enjoy the talk.

SELinux and FFMpeg

SELinux is a good thing, but it also requires you to watch out on some libraries. Sometimes, something just fails, because SELinux does not allow it to run. This so happens when you have SELinux installed and want to run FFMpeg.

I just run into this when I tried to run FFMpeg and got this error message:

“error while loading shared libraries: /usr/lib/libavcodec.so.52: cannot restore segment prot after reloc: Permission denied”

In order to run FFMpeg without problems I had to add the remove the restrictions for SELinux with:

chcon -t textrel_shlib_t ‘/usr/lib/libavutil.so.49.15.0′
chcon -t textrel_shlib_t ‘/usr/lib/libavcodec.so.52.20.0′
chcon -t textrel_shlib_t ‘/usr/lib/libavformat.so.52.31.0′
chcon -t textrel_shlib_t ‘/usr/lib/libavformat.so.52.31.0′
chcon -t textrel_shlib_t ‘/usr/lib/libswscale.so.0.7.1′

Griffin Express Card/34 and Snow Leopard

Like many others I installed Snow Leopard on my Mac and like many I’m most of the time very happy with it. But there are some things that still don’t work as expected. Especially troublesome is when working Hardware can not be used anymore.

Unfortunately, I had one of those experiences today. As a owner of the Late 2008 MacBook Pro series, I don’t have a Smart Card Reader built in, thus I bought myself a Griffin eSata Express Card, which I use to read/write to Smart Cards. But as I found out today, after wanting to use it for the first time since upgrading to Snow Leopard, the Smart Card could not be read. As a fact, the Card Reader is not even recognized by the System itself.

Apparently, Apple disables some drivers during the installation as stated in the Technote called “About incompatible Software”. One of those drivers is the one from Sillicon Image which enables the Smart Card Reader. After some searching I found the same driver again over at the Sillicon Image download page and installed the latest driver (from 2007) again. Low and behold the card works again.

Not sure, how long this will work, but for now this will hopefully help anybody else.

Update:
After some more searching I found that updated Snow Leopard ExpressCard drivers are available from FirmTek. So far, I can report successful installation working with this driver as well.

Awesome informative video

If you are moving on the web and are surrounded by many little gadgets or simply want to be informed where the society is heading you own it to yourself to watch the Fall Edition of the famous “Shift Happens” series. This one is called “Did you know 4.0″.

Always wanted to go to Japan

I just found the below Video over at the PresentationZen Blog. Since I have a total urge to go to Japan (don’t know why, just feels like the right thing) I thought this video to be a nice introduction to Japan/Tokyo. For all those who feel the same, enjoy!

How the mind changes and develops over time

This is another interesting talk over at the TED website entitled “How to read each other’s mind”. Thought I think the title is a bit misleading, the talk goes into how our minds and perception over time changes as we grow up.

After 10 minutes of her talk you get to a very interesting passage where they stimulate a different answer from their test with giving people small electromagnetic impulses to their brain. Now, just think a minute what this could mean and you see the bigger picture behind this. Guess there are many more things going on behind at MIT…

Retrieving mail from one Google App account to another with POP

I had the need to retrieve mails from one Google App account to another Google App account over POP. Like this you can actually “swap” from one primary domain to another primary domain (since Google does not allow it to be exchanged you need to create a new account and do all the needed steps as outlined in their document called “Swap primary domains“).

Since this is going from one Google App account to another I thought it would be very easy to do so. But as it turned out it wasn’t. Mainly because there is almost no documentation out there. The process itself is quite simple, all you have to do is to go to the “Settings” page within your account. Then go to “Accounts” and under “Get mail from other accounts” you add your other eMail account.

But the problem is that, even this is from Google to Google account, the wizard does not configure correctly. By default you might get filled in information like:

User: yourname
Mail Server: mail.domain.com
Port: 110

But to be able to retrieve mails over POP from another Google App account you will need the following settings:

User: name@domain.com
Mail Server: pop.gmail.com
Port: 995

Figuring out this setting took some valuable time. Hope someone else benefits from it.

Natasha Tsakos: Being human is an artform

This presentation of Natasha Tsakos is very well prepared and entertaining. She shows us a new form of theater, coupled with art and technology. My favorite paragraph is “Being human is an artform”. Watch for your self.