Monday, March 30, 2009

A nice "SEARCH" plugin for wordpress

Here's a nice "SEARCH" plugin for wordpress. I'm impressed with the features it has. Does a good job of highlighting the search words, also showing a small part of the each post/page, so that you can see all the posts related to your search.

http://urbangiraffe.com/plugins/search-unleashed/


-- Vish.

Friday, February 20, 2009

RMAN incremental COLD Backup and Restore

Here's a brief overview of how to do a cold backup with RMAN and restore/duplicate it.


1. RMAN FULL COLD Backup.

rman target / catalog rman/rman@prman
run
{
STARTUP FORCE DBA;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
BACKUP INCREMENTAL LEVEL 0 DATABASE include current controlfile;
ALTER DATABASE OPEN;
}


2. RMAN Incremental COLD Backup.

rman target / catalog rman/rman@prman
run
{
STARTUP FORCE DBA;
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
BACKUP INCREMENTAL LEVEL 1 DATABASE include current controlfile;
ALTER DATABASE OPEN;
}




3. RMAN Duplicate to restore the cold backup to a different server with a different Name.

rman target sys/password@ catalog rman/rman@rman
RMAN> connect auxiliary /
run
{
ALLOCATE AUXILIARY CHANNEL ch00 TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=,NB_ORA_CLIENT=';
set newname for datafile 1 to '/uXX/oradata//system01.dbf';
set newname for datafile 2 to '/uXX/oradata//undotbs01.dbf';
set newname for datafile 3 to '/uXX/oradata//sysaux01.dbf';
set newname for datafile 4 to '/uXX/oradata//users01.dbf';
set newname for tempfile 1 to '/uXX/oradata//temp01.dbf';
duplicate target database to
LOGFILE
GROUP 1 ('/uXX/oradata//redo01a.log') SIZE 50M REUSE,
GROUP 2 ('/uXX/oradata//redo02a.log') SIZE 50M REUSE,
GROUP 3 ('/uXX/oradata//redo03a.log') SIZE 50M REUSE;
release channel ch00;
}


RMAN Duplicate for a cold backup will automatically use "Recover NOREDO", since it knows that its a cold backup and hence does not look for online-redo-logs.


4. Restore the database to the same server.

run
{
ALLOCATE CHANNEL ch00 TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=,NB_ORA_CLIENT=';
#set until time "to_date('18-JUN-08 11:56:38','DD-MON-YY HH24:MI:SS')";
restore controlfile;
sql 'alter database mount';
restore database;
recover database noredo; ==> This is to tell RMAN that its a cold backup restore
and do not look for online-redo-logs.
}

Monday, January 12, 2009

Slumdog Millionaire !!

Watched the movie "Slumdog Millionaire" and really liked it. It is one of those classic movies where you won't get bored of watching it. Good direction, photography, TIGHT screenplay and a new story makes it worth watching.

-- Vish.

Three mistakes of my life !! (Chetan Bhagat)

"Three mistake of my life", a book by Chetan Bhagat is an interesting read. Its a small book and can be completed within 3-4 hrs. Its an interesting story about a businessman who wants to achieve something big in his life and how his mistakes cost him, almost his life.

-- Vish.

A speech by Chetan Bhagat

A good speech from Chetan Bhagat, a writer from India. It is about how to keep yourself engaged in life and not feel bored. The moral of the story is "Always have a goal and try to keep acheiving it. Also, have a balanced life (work and family)"

http://d.scribd.com/docs/1qzpkyw5ih8sc69agzkp.pdf

-- Vish.

remsh or ssh?

You might have a centralized server that has remsh/ssh authentication setup with all the other servers in your environment. You want to write a script to, lets say, get a crontab listing of all the servers. The command below shows if you can either remsh or ssh.

=========================================
ssh -o BatchMode=yes $i /bin/truex
if [[ $? -eq 0 ]];then
echo "ssh enabled"
else
echo "remsh enabled"
fi


=========================================

-- Vish

Friday, January 09, 2009

My book library !

1. The Book Thief
A book based on a German backdrop.
2. Three cups of Tea
One Man's Mission to Promote Peace . . . One School at a Time.
3. Darfur Diaries : Stories of survival
A genocide in Darfur taking place and the world ignores it !!
4. Three mistake of my life
A book by Chetan Bhagat about three mistakes a businessman did in his life !!
5. The last lecture
A book by Randy Paush, about acheiving childhood dreams.

Script to push any script to all the servers in a unix environment

It is always helpful for any dba to have a script that can push any regularly used scripts to all the servers. In my case, we had a centralized server where have all the scripts and there was authentication setup, either remsh or ssh. The script below checks if 1) it can ping the server, 2) if it can ping it, can it ssh? 3) If it cannot ssh, can it remsh?

I run this script from Sun OS. If you run it from any other OS like linux, the ping command would be different. Change it accordingly.

Operating System : SunOS


===================== Script start ==================================

cat push_script.sh

#!/usr/bin/ksh

list=`cat /tmp/complete_server_list.lst`

for i in $list

do

ping -s $i 64 1 |grep -w "0% packet loss" # Check if we can ping the server

if [[ $? -eq 0 ]];then

ssh -o BatchMode=yes $i /bin/true # Check if ssh is enabled, if not use remsh/rcp

if [[ $? -eq 0 ]];then

scp -p /tmp/test_script $i:/tmp/test_script

else

rcp -p /tmp/test_script $i:/tmp/test_script

fi

else

echo "${i}" >> /tmp/cantping.lst

fi

done


===================== Script End==================================

A good way to list the filesystem space in MB's or GB's on a unix server

A good way to list the filesystem space in MB's or GB's on a unix server.

The following commands will give the listing of the free space on the server in descending order. In my case, I'm searching for mountpoints which have /u*. This way, I get a quick overview of the free space on the server.

HP-UX:

bdf /u* | awk '($0 !~ /ounted/ && $5 !~ /100/) {printf("%s\t%dM\n",$6,$4/1024)}' | sort -n -r +1|grep /u |grep -v "/usr"



SUN OS:

df -k /u* | awk '($0 !~ /ounted/ && $5 !~ /100/) {printf("%s\t%dG\n",$6,$4/1024/1024)}' | sort -n -r +1 |grep /u |grep -v "/usr"