Aug 11, 2011

tar / compress in one command

To tar and then compress in one command use the following:

tar cvf - directory | gzip > filename.tar.gz

To uncompress and untar, use the following:

cat filename.tar.gz | gunzip | tar xvf -

Aug 10, 2011

rman delete

I have the following scenario. I have database backups I want to delete as I am recreating a database tomorrow morning, long story, but we have found a bug when running a block size of 16k.

I don't want to run the "RMAN DROP DATABASE INCLUDING BACKUPS NOPROMPT" command as the business testers want this environment back reasonably quickly.

What I did was:

unix> rman target /
rman> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
rman > DELETE NOPROMPT ALL;

Then it listed all the backup to remove, and I said "YES".

Now when I run the RMAN DROP DATABASE command tomorrow, it will complete in good time, not 2-3 hours it took to delete all my backups.

Aug 3, 2011

vi search and replace

Use "%s/searchstring/replacestring/g

If the searchstring or replacestring has a "/", then place a "\" in front. This is an escape character meaning that any character that follows is taken as its literal meaning.