Monday, March 30, 2009
A nice "SEARCH" plugin for wordpress
http://urbangiraffe.com/plugins/search-unleashed/
-- Vish.
Friday, February 20, 2009
RMAN incremental COLD Backup and Restore
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@
RMAN> connect auxiliary /
run
{
ALLOCATE AUXILIARY CHANNEL ch00 TYPE 'SBT_TAPE';
SEND 'NB_ORA_SERV=
set newname for datafile 1 to '/uXX/oradata/
set newname for datafile 2 to '/uXX/oradata/
set newname for datafile 3 to '/uXX/oradata/
set newname for datafile 4 to '/uXX/oradata/
set newname for tempfile 1 to '/uXX/oradata/
duplicate target database to
LOGFILE
GROUP 1 ('/uXX/oradata/
GROUP 2 ('/uXX/oradata/
GROUP 3 ('/uXX/oradata/
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=
#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 !!
-- Vish.
Three mistakes of my life !! (Chetan Bhagat)
-- Vish.
A speech by Chetan Bhagat
http://d.scribd.com/docs/1qzpkyw5ih8sc69agzkp.pdf
-- Vish.
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 !
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
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
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"