Monthly Archives: June 2009

Oracle RMAN backups

More notes on Oracle RMAN backups, see also Oracle – how to purge old RMAN backups. Thanks Raoul for your email…

Are the backups being deleted using RMAN or simply 'rm'?

Oracle's RMAN can be set up to manage this for you based on RETENTION POLICY.  Eg, set retention policy to recovery window of 14 days and
it will regard any backups older than 14 days to be OBSOLETE. Obsolete backups can be removed regularly using this:
 DELETE NOPROMPT OBSOLETE;
in a script that RMAN runs, for example, the daily backup script.

Here's a quick rundown of the rman commands you might find useful:

-- list all configuration parameters
SHOW ALL;

-- check for spurious files in FRA (backup location)
-- typically, these can be safely deleted
-- but check messages/output first.
CATALOG RECOVERY AREA NOPROMPT;

-- check to see what backups are available in the backup
-- destination area (refresh with what's available)
-- missing ones are marked as EXPIRED
CROSSCHECK BACKUPSET;
CROSSCHECK COPY;

-- delete all obsolete backups
-- this physically removes the backup pieces from the backup
-- destination and removes knowledge of them from the control
-- file this is performed based on the RETENTION policy
DELETE NOPROMPT OBSOLETE;

-- delete all expired backups, etc
-- this is clearing the knowledge of such EXPIRED (missing)
-- backups from the control file
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED COPY;

Once you've set the retention policy, then the following backup script (or one like it) will remove old backups automatically.

-- full back, deleting archive logs after backing them up
backup device type disk tag '%TAG' database;
backup device type disk tag '%TAG' archivelog all not backed up delete all input;
allocate channel for maintenance type disk;
delete noprompt obsolete device type disk;
release channel;

Example of what to do if system runs out of disk space due to archive logs:

crosscheck archivelog all;
delete expired archivelog all;
backup archivelog all delete input;
backup database;

Another year, another Sydney Film Festival

Another year, another Sydney Film Festival. Two films I saw really stood out – The Cove (about the continued Japanese dolphin slaughter) and Che Part I and Part II (covering the Cuban and Bolivian years of Ernesto ‘Che’ Guevara). Also memorable was Big River Man, about a middle aged  Slovenian man who swims the entire length of the Amazon river.

Like always (this is my approx 15th festival), I start the festival with feelings of both anticipation and trepidation – anticipation that I’ll see some great films, and trepidation at the long nights and weekends in the dark, followed by getting up in the morning for work :-) But there’s nothing like seeing a great movie with several thousand other cineastes in the splendour of the State Theatre to renew my love of good cinema.

The Cove works at multiple levels. Firstly we’re made to enjoy the almost James Bond nature of the film makers’ mission, as the team try to infiltrate the area where the slaughter takes place in Taiji, Japan – think spies and decoys, cameras disguised as rocks, and run-ins with guards. Then we’re made to feel revulsion at the killing of these animals that are so like us – they love their freedom, get happy, sad, even commit suicide, and most of all are sentient (as in “having self awareness”). The scenes of the actual slaughter are gut-wrenching – thousands of dolphins are herded into a 100m wide cove and killed by hand with harpoons. Dolphins in their death throws spin around in circles screaming, thrashing their tails, and even jumping onto land. The blood filled seawater turns opaque and divers feel their way along the seabed by hand, searching for carcasses.

But then the film starts to ask some deeper questions. First of all, dolphin meat contains high levels of mercury due to pollution and is basically poisonousness and unsaleable. Eating meat with these levels of mercury leads to large numbers of horrendous birth defects – which the Japanese unfortunately became aware of in the 70′s – a whole generation of birth defects forcing the closure of  many polluting industries in Japan. So why keep up with the “harvest”, even if the meat has to be foisted onto the Japanese public via illegal meat substitution and Yakuza links? The answers seem to involve dirty international politics and ugly right wing Japanese nationalism.

Secondly, inorganic pollutants are concentrated as we move up the predator-prey cycle, and dolphins (like wolves, lions, humans) are at the top of the food chain. Dolphin meat contains so much mercury that it’s inedible – what about us? How is that we can poison our environment so much that we’re poisoning ourselves?

Source keychain credentials in Perl

I use keychain for securely caching my ssh key credentials when running scripts from cron.

Here’s how to use keychain with Perl scripts:

Create a wrapper script:
source ~/.keychain/hostname-sh
run_perl_program.pl

To run a one-off command do:

system("source ~/.keychain/hostname-sh; cmd");

ruby gem server

I’m back to Rails development after a few months doing other things. Note to brain: the ruby gem server is now started using gem server & rather than gem_server &, like it used to be… </frustration>

Offline rdoc gem documentation in Ruby

Perl – @INC

@INC – like $PATH for do, require, use

Display existing @INC:

  • perl -V | tail
  • perl -le ‘print for @INC’

Modify @INC:

  • in a script: unshift @INC, “/home/sonia/lib/perl”
  • better: use lib ‘/home/sonia/lib/perl/’;
  • for shell: export PERL5LIB=/home/sonia/lib/perl
  • onetime at command line: perl -I/home/sonia/lib/perl foo

Also: