Archive for October, 2009

Quotes and poems

October 31, 2009

I Am There

I am the breeze that kisses your cheek.
I am the sun that warms your face.
When you look at the purple evening sky, it is me.
When you see a majestic mountain, it is me.

When the birds sweetly sing, it is my voice.
When the water gently laps against the shore, it is my heartbeat.

I am the green grass against your feet.
I am the refreshing shade of summer.

In the stars, you see my eyes.
In the blue sky, you see my body.

Feel the air that surrounds you, I am there.
Feel the love in your heart, I am there.

Quotes

I don’t want to fly above the storm,
I want to fly thru it, in it, become it,
feel it, experience it and when it is over,
I want to say – “I did it”.

When you touch the ocean
you touch the seas of all the world
when you touch the man’s souls
you touch the consciousness of all men.

Fear is another opportunity to listen to the heart.

Knowledge is a double-edged sword, your intent defines your purpose.

Friendship isn’t how you forget, but how you forgive.
Not how you listen, but how you understand.
Not how you see, but how you feel.
Not how let you go, but how you hold on!

Do not save your loving speeches
For your friends till they are dead;
Do not write them on their tombstones,
Speak them rather now instead.

Quotes

Quotes

Advertisements

Bash prompt goodies – PS1 varible

October 19, 2009
sample

In the above picture you see useful thing:

the user name is Red colored, host name is Blue and current directory is colored with Black. This will help you while you are working with multiple tab at a time-

In bash you can customize you prompt using the environment variable PS1. In order to get the above result insert the following in your .bashrc or .profile file.

export PS1=”\e[1;31m\]\u\e[1;30m\]@\e[1;34m\]\h \e[0;30m\]\w$ “

Nagios – SNMP Trap integration

October 14, 2009

We need to check the followings first:

1. A host that has nagios installed and configured. Get Nagios.
2. Forward SNMP traps from the device you want to monitor to the nagios host and make sure that the traps reach the nagios host. By default it should be UDP traffic on port 162. On a windows machine it should be under Services. Look for snmp service and configure it.
3. The MIBs of the device you want to monitor. Ask the manufacturer or look for that online. Sometimes you might be able to find them publicly available.
4. Install snmptrapd which is part of the open source package net-snmp. snmptrapd is a daemon that listens for SNMP messages and can trigger different events based on each message.

Configure snmptrapd

create a new file called snmptrapd.conf and add the following lines:

authCommunity log,execute,net public
traphandle default /opt/snmptrap/sbin/snmptt –ini=/opt/snmptrap/etc/snmptt.ini

Oracle 10g installation on Solaris

October 13, 2009

# Pre-installation task:

# First of all following users and groups should be created

1. Group dba, oper (optional), oinstall
2. user oracle having oinstall as primary group

use the following commands to create required groups and user (as root user)

groupadd oinstall

groupadd dba
groupadd oper
useradd -g oinstall -G dba[,oper] -d /export/home/oracle -s /usr/bin/bash -m oracle
passwd -r files oracle

# if user nobody exists then

useradd nobody

# Now create a project for oracle so that all resources can be alloacated to this project as root user

projadd oracle

# kernel parameters: oracle recommends the following kernel parameters to be set to recommended value
# the values can be set in /etc/system file in solaris as the following syntax
# set parameter-name=value
# editing system file is deprecated and solaris recommends using projmod command to do so

1. Parameter Replaced by Resource Control Recommended Value

noexec_user_stack NA 1
semsys:seminfo_semmni project.max-sem-ids 100
semsys:seminfo_semmns NA 1024
semsys:seminfo_semmsl project.max-sem-nsems 256
semsys:seminfo_semvmx NA 32767
shmsys:shminfo_shmmax project.max-shm-memory 4294967295
shmsys:shminfo_shmmin NA 1
shmsys:shminfo_shmmni project.max-shm-ids 100
shmsys:shminfo_shmseg NA 10

# you can view the current values of this parameters as follows

prctl -n project.max-shm-memory -i project oracle

# you can set the values permanently by the following command (as root)

projmod -sK “project.max-shm-memory=(privileged,2G,deny)” oracle

# Directories

# create ORACLE_BASE directory

mkdir -p /mount_point/app/oracle_sw_owner
chown -R oracle:oinstall /mount_point/app/oracle_sw_owner
chmod -R 775 /mount_point/app/oracle_sw_owner

# now export the base directory as environment variable which will let oracle installer to handle
# creation of oracle_home and oraInventory directory

export ORACLE_BASE=/mount_point/app/oracle_sw_owner

# Storage option :

# if you plan to use file system as database storage you have to do the following. It is good practice
# that the database storage be in separate file system (i.e. in separate partition)

mkdir /mount_point/oradata
chown oracle:oinstall /mount_point/oradata
chmod 775 /mount_point/oradata

# if you plan to use recovery then you have to create a flash_recovery area

mkdir /mount_point/flash_recovery_area
chown oracle:oinstall /mount_point/flash_recovery_area
chmod 775 /mount_point/flash_recovery_area

# If you plan to use Automatic Storage Management (ASM) as storage option then you have to create a disk group and
# instance. you have to do the following in case of creating a disk group consisting of only one solaris partition/slice.
# To do so, first check whether the partition is mounted or not by

df -k

# if the partition is mounted then unmount it and remove the entry corresponding to that partition from /etc/vfstab

# now you set the ownership and permission of the partiton to oracle as follows (replace c0d0s4 accordingly)

chown oracle:dba /dev/dsk/c0d0s4
chmod 660 /dev/dsk/c0d0s4

# Now you have to set some environment variables for user oracle. edit the file .profile in oracle’s home diectory
# invoke

vi ~/.profile

umask 022
unset ORACLE_HOME

# activate this changes without restarting or relogin by invoking

. ./.profile

# To verify that the environment has been set correctly, enter the following commands. the first
# command will output 0022 and second will show the list of env. variables.

umask
env | more

# Now run the oracle universal installer invoking …

/path/to/oracle/runInstaller

orcl
# Universal Installer choice

1. Installation Method – Basic – /path/to/orahome – DBA group oinstall should be selected.
2. Inventory Directory – /path/to/inventoryDir – gorup oinstall need to be selected
3. Product-specific – see if every check succeded
4. make note of URLs of various web-based tools

# Installing Automatic storage management (single partition as disk group)

1. run universal installer
2. select Advanced Installation
3. specify home directory
4. select Configure … ASM in configuration option screen
5. Provide Disk group name
6. Redundancy level-external
7. The partition u have prapared earlier will appear as the candidate disk. select it and press next

# In database creation screen make note of database SID.
# After installation is finished the installer provides three URL’s

http://urmachine:1158/em (which is oracle enterprise manager)
http://urmachine:5560/isqlplus (iSQL*Plus web interface)
http://urmachine:5560/isqlplus/dba (iSQL*Plus DBA web interface)

# use first link and create a user and using that username and password u can login to second url
# and invoke sql statements using the web interface.

# the third url is for those users with dba privileges. this URL requires server authentication.
# to use this URL u have to create in iSQL*Plus DBA realm in oracle http server and grant webDba
# role to that user. To do so follow the following steps.

cd /path/to/oracle/home/ (i.e. $ORACLE_BASE/oracle/product/10.2.0/db_1)
cp oc4j/j2ee/isqlplus/application-deployments/isqlplus/config/jazn-data.xml config/
cp oc4j/j2ee/isqlplus/application-deployments/isqlplus/config/jazn.xml config/
jdk/bin/java -Djava.security.properties=$ORACLE_HOME/oc4j/j2ee/home/config/jazn.security.props -jar \
$ORACLE_HOME/oc4j/j2ee/home/jazn.jar -user “iSQL*Plus DBA/admin” -password welcome -shell

# this will start the oracle server’s authorization provider’s (JAZN) shell

jazn>

# at that shell invoke the following

jazn> adduser “iSQL*Plus DBA” username password
jazn> grantrole webDba “iSQL*Plus DBA” username

# check that that ur user is created

jazn> listusers “iSQL*Plus DBA”

# Now login with the username and password u’ve just created in the 3rd URL that oracle installer provided.
# u have to provide sysdba username and password again.

# We are almost done with oracle 10g basic installation in solaris. One problem I have encountered is that
# when I restarted my machine after installation I couldnot connect to database with the URLs. the following
# error show..

ORACLE not found. ORA-…. shared memory realm does not exist .Error 2. no such file or directory.

# this is because after reboot the database instance is not started. so to have all things starts up in system bootup
# provide a script as follows. before that you have to do something…

# open the file /var/opt/oracle/oratab in your favourite editor. at the end of this file all the databases are listed like this

orcl:/oracle/app/oracle/oracle/product/10.2.0/db_1:Y

# if you install 2 database then you’ll have 2 such lines in this file .if the lines contain N at the end this means
# this database won’t be started during system bootup. change it to Y as above to make the database instance to start
# at system bootup

vi /etc/init.d/dbora

#!/usr/bin/bash
ORA_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1orcl
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo “Oracle startup: cannot start”
exit
fi
case “$1″ in
’start’) # Start the Oracle databases and listeners
su – $ORA_OWNER -c “$ORA_HOME/bin/dbstart $ORA_HOME”
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start LISTENER”
su – $ORA_OWNER -c “$ORA_HOME/bin/emctl start dbconsole”
su – $ORA_OWNER -c “$ORA_HOME/bin/isqlplusctl start”
;;
’stop’) # Stop the Oracle databases and listeners
su – $ORA_OWNER -c “$ORA_HOME/bin/isqlplusctl stop”
su – $ORA_OWNER -c “$ORA_HOME/bin/emctl stop dbconsole”
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl stop”
su – $ORA_OWNER -c “$ORA_HOME/bin/dbshut $ORA_HOME”
;;
esac

# now change this ownership and permission as follows

chown root:sys /etc/init.d/dbora
chmod 744 /etc/init.d/dbora

# now do this so that this script is called everytime the system boots up or shuts down.

cp /etc/init.d/dbora /etc/rc0.d/K10dbora
chown root:sys /etc/rc0.d/K10dbora
chmod 744 /etc/rc0.d/K10dbora

cp /etc/init.d/dbora /etc/rc2.d/S99dbora
chown root:sys /etc/rc2.d/S99dbora
chmod 744 /etc/rc0.d/S99dbora

# one little thing just add the following things to ~/.profile of the user oracle

ORACLE_BASE=/path/to/oracle/base/u’ve/set/earlier; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1; export ORACLE_HOME
ORACLE_SID=SID that you noted during installation; export ORACLE_SID
PATH=$PATH:/usr/local/bin:$ORACLE_HOME/bin; export PATH

# Now reboot your machine .. and you are done..