From October 2009

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:
[code]]czoyNjM6XCIKc3FscGx1cyBzeXMKU1FMJmd0OyBjcmVhdGUgdXNlciBybWFuIGlkZW50aWZpZWQgYnkgcm1hbjsKU1FMJmd0OyBhbHR7WyYqJl19ZXIgdXNlciBybWFuIGRlZmF1bHQgdGFibGVzcGFjZSB0b29scyB0ZW1wb3JhcnkgdGFibGVzcGFjZSB0ZW1wOwpTUUwmZ3Q7IGFsdHtbJiomXX1lciB1c2VyIHJtYW4gcXVvdGEgdW5saW1pdGVkIG9uIHRvb2xzOwpTUUwmZ3Q7IGdyYW50IGNvbm5lY3QsIHJlc291cmNlLCByZWNve1smKiZdfXZlcnlfY2F0YWxvZ19vd25lciB0byBybWFuOwpTUUwmZ3Q7IGV4aXQ7ClwiO3tbJiomXX0=[[/code]

in case you don’t have a tablespace called “tools” you need to create it with:
[code]]czoxNDY6XCIKY3JlYXRlIHRhYmxlc3BhY2UgdG9vbHMKICBsb2dnaW5nCiAgZGF0YWZpbGUgXCcvZGJmMS90b29scy5kYmZcJyAKICBzaXtbJiomXX16ZSAzMm0gCiAgYXV0b2V4dGVuZCBvbiAKICBuZXh0IDMybSBtYXhzaXplIDIwNDhtCiAgZXh0ZW50IG1hbmFnZW1lbnQgbG9jYWw7e1smKiZdfQpcIjt7WyYqJl19[[/code]

Now you can log in to RMAN create the catalog schema with:
[code]]czo3NTpcIgpybWFuIGNhdGFsb2cgcm1hbi9ybWFuClJNQU4+IGNyZWF0ZSBjYXRhbG9nIHRhYmxlc3BhY2UgdG9vbHM7ClJNQU4+IGV7WyYqJl19eGl0OwpcIjt7WyYqJl19[[/code]

Then register the database with;
[code]]czo3NDpcIgpybWFuIGNhdGFsb2cgcm1hbi9ybWFuIHRhcmdldCBzeXMvcGFzc3dvcmRAT1JDTApSTUFOPiByZWdpc3RlciBkYXRhYmF7WyYqJl19c2U7ClwiO3tbJiomXX0=[[/code]

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:
[code]]czo3NDM6XCIKQ09ORklHVVJFIENPTlRST0xGSUxFIEFVVE9CQUNLVVAgT047CkNPTkZJR1VSRSBDT05UUk9MRklMRSBBVVRPQkFDS1V7WyYqJl19UCBGT1JNQVQgRk9SIERFVklDRSBUWVBFIERJU0sgVE8KXCcvb3B0L29yYWNsZS9iYWNrdXAvYXV0b2JhY2t1cF9jb250cm9sX2ZpbGV7WyYqJl19JUZcJzsKQ09ORklHVVJFIFJFVEVOVElPTiBQT0xJQ1kgVE8gUkVDT1ZFUlkgV0lORE9XIE9GIDIgREFZUzsKcnVuIHsKQUxMT0NBVEV7WyYqJl19IENIQU5ORUwgUk1BTl9CQUNLX0NIMDEgVFlQRSBESVNLOwpDUk9TU0NIRUNLIEJBQ0tVUDsKQkFDS1VQIEFTIENPTVBSRVNTRUQgQntbJiomXX1BQ0tVUFNFVCBEQVRBQkFTRSBGT1JNQVQKXCcvb3B0L29yYWNsZS9iYWNrdXAvZGF0YWJhc2VmaWxlc18lZF8ldV8lc18lVFwnOwpzcWx7WyYqJl19IFwnQUxURVIgU1lTVEVNIEFSQ0hJVkUgTE9HIENVUlJFTlRcJzsKQkFDS1VQIEFTIENPTVBSRVNTRUQgQkFDS1VQU0VUIEFSQ0hJVkVMe1smKiZdfU9HIEFMTCBGT1JNQVQKXCcvb3B0L29yYWNsZS9iYWNrdXAvYXJjaGl2ZWxvZ3NfJWRfJXVfJXNfJVRcJyBERUxFVEUgSU5QVVQ7CkJBQ3tbJiomXX1LVVAgQVMgQ09NUFJFU1NFRCBCQUNLVVBTRVQgQ1VSUkVOVCBDT05UUk9MRklMRSBGT1JNQVQKXCcvb3B0L29yYWNsZS9iYWNrdXAvY3tbJiomXX1vbnRyb2xmaWxlXyVkXyV1XyVzXyVUXCc7CkNST1NTQ0hFQ0sgQkFDS1VQOwpERUxFVEUgTk9QUk9NUFQgT0JTT0xFVEU7CkRFTEVURXtbJiomXX0gTk9QUk9NUFQgRVhQSVJFRCBCQUNLVVA7ClJFTEVBU0UgQ0hBTk5FTCBSTUFOX0JBQ0tfQ0gwMTsKfQpleGl0OwpcIjt7WyYqJl19[[/code]

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:
[code]]czo2NjpcIgojIS9iaW4vYmFzaApybWFuIHRhcmdldCBzeXMvcGFzc3dvcmRAT1JDTCBAL29wdC9ybWFuX2JhY2t1cC50eHQ7ClwiO3tbJiomXX0=[[/code]

Troubleshooting
I have seen that sometimes we got errors running the above script with:
[code]]czoxOTc6XCIKUk1BTi0wNjIwNzogV0FSTklORzogNSBvYmplY3RzIGNvdWxkIG5vdCBiZSBkZWxldGVkIGZvciBESVNLIGNoYW5uZWx7WyYqJl19KHMpIGR1ZQpSTUFOLTA2MjA4OiAgICAgICAgICB0byBtaXNtYXRjaGVkIHN0YXR1cy4gIFVzZSBDUk9TU0NIRUNLIGNvbW1hbmQgdHtbJiomXX1vIGZpeCBzdGF0dXMKUk1BTi0wNjIxMDogTGlzdCBvZiBNaXNtYXRjaGVkIG9iamVjdHMKXCI7e1smKiZdfQ==[[/code]

With RMAN you can check your backup with the following commands:
[code]]czo5NjpcIgpDUk9TU0NIRUNLIGJhY2t1cCBvZiBkYXRhYmFzZTsgIApDUk9TU0NIRUNLIGJhY2t1cCBvZiBjb250cm9sZmlsZTsKQ1J7WyYqJl19T1NTQ0hFQ0sgYXJjaGl2ZWxvZyBhbGw7IApcIjt7WyYqJl19[[/code]

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;
[code]]czo1MzpcIgpERUxFVEUgTk9QUk9NUFQgT0JTT0xFVEUgUkVDT1ZFUlkgV0lORE9XIE9GIDIgREFZUzsKXCI7e1smKiZdfQ==[[/code]

The key to success was when I used the “FORCE” command as;
[code]]czo1OTpcIgpERUxFVEUgRk9SQ0UgTk9QUk9NUFQgT0JTT0xFVEUgUkVDT1ZFUlkgV0lORE9XIE9GIDIgREFZUzsKXCI7e1smKiZdfQ==[[/code]

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

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.