oracleasm ASMLib Kernel Driver upgrade - steps by steps

Shutdown and disable CRS (RAC) or has (non-RAC)

crsctl stop crs / crsctl disable crs
crsctl stop has / crsctl disable has
  
Backup the oracleasm

ls -ltr /etc/sysconfig/oracleasm
lrwxrwxrwx 1 root root 24 Jun  6  2011 /etc/sysconfig/oracleasm -> oracleasm-_dev_oracleasm
cp oracleasm-_dev_oracleasm oracleasm-_dev_oracleasm.orig

Comment out (#) the following line in /etc/inittab to avoid respawn

#h1:35:respawn:/etc/init.d/init.ohasd run >/dev/null 2>&1 </dev/null
/sbin/init q

Ensure that init.ohasd is now not running
ps -ef|grep init
/etc/init.d/oracleasm stop
Dropping Oracle ASMLib disks: [  OK  ]
Shutting down the Oracle ASMLib driver: [  OK  ]

/etc/init.d/oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
:/etc/sysconfig
/etc/init.d/oracleasm disable
Writing Oracle ASM library driver configuration: done
Dropping Oracle ASMLib disks: [  OK  ]
Shutting down the Oracle ASMLib driver: [  OK  ]

Install oracleasm rpm packages

rpm -ivh oracleasm-2.6.18-274.18.1.el5-debuginfo-2.0.5-1.el5.x86_64.rpm --nodeps
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.18-274.18########################################### [100%]
rpm -ivh oracleasm-2.6.18-274.18.1.el5-2.0.5-1.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.18-274.18########################################### [100%]

rpm -ivh oracleasm-2.6.18-274.18.1.el5debug-2.0.5-1.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.18-274.18########################################### [100%]

rpm -ivh oracleasm-2.6.18-274.18.1.el5xen-2.0.5-1.el5.x86_64.rpm
error: Failed dependencies:
        kernel-xen = 2.6.18-274.18.1.el5 is needed by oracleasm-2.6.18-274.18.1.el5xen-2.0.5-1.el5.x86_64

rpm -qa | grep oracleasm

/usr/lib/oracleasm/oracleasm_debug_link 2.6.9-42.ELsmp $(uname -r)
 
You can remove the old package using rpm -e

 
ls -l /lib/modules/$(uname -r)/kernel/drivers/addon/oracleasm
total 604
-rw-r--r-- 1 root root 613516 Feb 14 23:36 oracleasm.ko

oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no

/etc/init.d/oracleasm start

/etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.

This will configure the on-boot properties of the Oracle ASM library
driver.  The following questions will determine whether the driver is
loaded on boot and what permissions it will have.  The current values
will be shown in brackets ('[]').  Hitting <ENTER> without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface [oracle]:
Default group to own the driver interface [dba]:
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]:
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [  OK  ]
Scanning the system for Oracle ASMLib disks:
[  OK  ]

Oracleasm listdisks
DBATOOLS - oracle: oracleasm listdisks
DATA101_DISK1
DATA101_DISK2
DATA101_DISK3

To view alert, run tail -f /var/log/oracleasm

Startup cluster
crsctl start has or  crsctl start cluster


Index tips

Below are several tips that I've analyzed and implemented on Oracle indexes to increase performance.

1.  Create all primary constraints for all tables.  This creates B-tree indexes.
2.  Review your queries and determine appropriate index selection.  In general, you should have indexes on columns used in majority queries in SELECT, ORDER BY , GROUP BY , UNION, or DISTINCT, etc.
3.  Create indexes on foreign-key columns included in the WHERE clauses when joining tables
4.  Consider bitmap index in data warehouse for low cardinality columns where the values are not updated.
5.  Create indexes on a separate tablespaces from application user data tablespace.
6.  Monitor your indexes, and if a index is not unused, you should drop it to improve the performance of DML statements.
7.  Rebuild indexes are not necessary unless they're corrupted or you need to move the indexes to a separate tablespace
..etc..

A note about locking issue when foreign key columns are not index.  Anytime that you delete in the child table, it places a lock on the parent table until the child table transaction finishes.  To avoid this locking issue, you should have a B-tree index on the foreign key columns.

Linux Performance System CPU

Here are several performance tools that enable you to capture performance about CPU utilization.

vmstat - virtual memory statistics is a great command to give a rough idea of how your system performs as a whole.  For CPU specific output

r:  number of current runnable processes.  Ideally this value should match with the number of CPUs available. 
b:  number of processes blocked and waiting for I/O to complete
in:  number of interrupt occurring on the system
cs:  number of context switches happening on the system
us:  % cpu time on user processes
sy:  % cpu time spent in system code
wa:  cpu time waiting for I/O
id:  idle

vmstat -s :  memory, swap, pages paged in, paged out, etc..
      2059580  total memory
      1976900  used memory
      1265408  active memory
       499676  inactive memory
        82680  free memory
       133088  buffer memory
       599228  swap cache
      4095992  total swap
        90796  used swap
      4005196  free swap
        33206 non-nice user cpu ticks
         6098 nice user cpu ticks
        18493 system cpu ticks
      6244845 idle cpu ticks
       158150 IO-wait cpu ticks
         1346 IRQ cpu ticks
         1145 softirq cpu ticks
            0 stolen cpu ticks
      1398931 pages paged in
      8113635 pages paged out
            0 pages swapped in
           24 pages swapped out
      7631737 interrupts
    141139062 CPU context switches
   1329539948 boot time
       138095 forks



top:  The system wide performance statistics.  It shows the load average of the system over the past 1,5,15 minutes, CPUs states, and processes state (sleeping, running, etc.).  While top is running, you can press F while top command is running.  Pressing F key then indicate A for PID, B for PPID, etc..) to display the desired statistics.

top - 13:57:06 up 17:17,  2 users,  load average: 1.18, 0.49, 0.54
Tasks: 194 total,   2 running, 192 sleeping,   0 stopped,   0 zombie
Cpu(s):  1.3%us,  0.3%sy,  0.0%ni, 98.0%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2059580k total,  1967912k used,    91668k free,   136012k buffers
Swap:  4095992k total,    90888k used,  4005104k free,   589284k cached

mpstat: shows you how your processes are behaving based on time.  The most advantages is that it shows the time new to statistics, so you can look for a correlation between CPU uage and time of day.  In addition, mpstat can be used to determine whether the CPUs are fully utilized and relatively balanced.  By observing the number of interrupts each CPUs is handling, you can find an imbalance.

mpstat -P 0 1 10  (-P option tells mpstat which CPUs to monitor.  cpu is the number between 0 and total CPUs minus 1.)

mpstat -P ALL 1 10

sar: system activity reporter  

c:  how many processes are being created per second
w:  number of context switches
q:  run queues and load average

sar -w -c -q 1 2

Linux 2.6.18-194.el5 (si01.an.com)      02/18/2009

02:20:18 PM    proc/s
02:20:19 PM      0.00

02:20:18 PM   cswch/s
02:20:19 PM   2242.16

02:20:18 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
02:20:19 PM         1       554      0.86      0.57      0.42

02:20:19 PM    proc/s
02:20:20 PM      0.00

02:20:19 PM   cswch/s
02:20:20 PM   2225.74

02:20:19 PM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
02:20:20 PM         1       554      0.79      0.56      0.42


runq-sz:   run queue  
plist-sz:  number of processes (sleeping, running, or waiting for I/O)
ldavg-1   ldavg-5  ldavg-15:  average load of the last minute, past 5 minutes, past 15 minutes
cswch:  context swithes per second


to be continued..




OS upgrade and oracleasm packages

After upgrade OS, for example RHEL 5.6 to 5.7, you will need to download and install the oracleasm packages that match with your new kernel.  There is no need to relink oracle or grid binaries after installing or upgrading ASMlib packages. 


You need to run the "uname -r" to determine your kernel version  and the corresponding package has the name oracleasm-<kernel_version>  For more information, please follow this reference link..
  
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html