Vishal Gupta's Blog

Archive for the ‘Linux’ Category

Oracle 11gR2 on RHEL6

Posted by Vishal Gupta on Sep 19, 2011

Just a quick note to say that RedHat submitted certification test result of Oracle 11gR2 on RHEL6 to Oracle Corporation on 09-Aug-2011, so we should expect the formal certification around last week of Sep-2011.

More news at – http://www.redhat.com/about/news/blog/Red-Hat-Submits-Oracle-11gR2-on-Red-Hat-Enterprise-Linux-6-Certification-Test-Results-to-Oracle

[Update: 17-Apr-2012]

Oracle has finally certified 11gR2 on OEL6 and RHEL6. See the announcement here

Posted in 11gR2, Linux, Oracle | 17 Comments »

Oracle RMAN command prompt hang???

Posted by Vishal Gupta on Jun 22, 2011

This afternoon on a Oracle 11.2.0.2 installation, i was trying to run the Oracle RMAN utility. Rman cli was just hanging and not going into RMAN.

[oracle@linux2 ~]$ . oraenv
ORACLE_SID = [oracle] ? 11202
The Oracle base has been set to /opt/oracle/product/rhel4/database/11.2.0.2
[oracle@linux2 ~]$ rman
 

After entering above rman command, nothing happened. It just hung on the command prompt. I did not receive any error at all. Hmm… whats happening? I issued an CTRL-C to cancel it and tried again. Still same result. Okay lets trace it using Linux strace utility.

oracle@linux2 ~]$ strace rman
execve("/usr/X11R6/bin/rman", ["rman"], [/* 31 vars */]) = 0
uname({sys="Linux", node="linux2.vishalgupta.com", ...}) = 0
brk(0)                                  = 0x5a3000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a95556000
access("/etc/ld.so.preload", R_OK)      = 0
open("/etc/ld.so.preload", O_RDONLY)    = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=23, ...}) = 0
mmap(NULL, 23, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x2a95557000
close(3)                                = 0
readlink("/proc/self/exe", "/usr/X11R6/bin/rman", 4096) = 19
open("/stub/lib64/libcwait.so", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\3>\1\20\6"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=4176, ...}) = 0
mmap(NULL, 1051008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2a95558000
mprotect(0x2a95559000, 1046912, PROT_NONE) = 0
mmap(0x2a95658000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x2a95658000
close(3)                                = 0
munmap(0x2a95557000, 23)                = 0
open("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/tls/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/tls/x86_64", 0x7fbfffec30) = -1 ENOENT (No such file or directory)
open("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/tls", 0x7fbfffec30) = -1 ENOENT (No such file or directory)
open("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/x86_64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/x86_64", 0x7fbfffec30) = -1 ENOENT (No such file or directory)
open("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/opt/oracle/product/rhel4/database/11.2.0.2/home/lib", {st_mode=S_IFDIR|0755, st_size=12288, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=146311, ...}) = 0
mmap(NULL, 146311, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2a95659000
close(3)                                = 0
open("/lib64/tls/libc.so.6", O_RDONLY)  = 3
read(3, "\177ELF\2\1\1\3>\1p\305\1"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1636072, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a9567d000
mmap(NULL, 2330696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2a9567e000
mprotect(0x2a957ae000, 1085512, PROT_NONE) = 0
mmap(0x2a958ad000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12f000) = 0x2a958ad000
mmap(0x2a958b3000, 16456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2a958b3000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a958b8000
mprotect(0x2a958ad000, 16384, PROT_READ) = 0
mprotect(0x3e48a14000, 4096, PROT_READ) = 0
arch_prctl(ARCH_SET_FS, 0x2a958b86e0)   = 0
munmap(0x2a95659000, 146311)            = 0
brk(0)                                  = 0x5a3000
brk(0x5c4000)                           = 0x5c4000
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a95659000
read(0,  <unfinished ...>
[oracle@linux2 ~]$

Had to again issue a CTRL-c to come out of trace, as it was just hanging again. I tried connecting to database using sqlplus, that worked fine.

oracle@linux2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Mon Jun 20 06:08:58 2011
Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

Hmm… Lets recompile the Oracle binaries, it case something funny was going on with libraries. And then we will re-run our RMAN cli.

[oracle@linux2 tns_admin]$ relink
writing relink log to: /opt/oracle/product/rhel4/database/11.2.0.2/home/install/relink.log
[oracle@linux2 tns_admin]$ rman

Hmm… still the same.

It turns out the there is Linux RMAN command as well, which is installed by xorg-x11-devel rpm package.

[oracle@linux2 ~]$ which rman
/usr/X11R6/bin/rman
[oracle@linux2 bin]$ man rman
PolyglotMan(1)                                                                                                                                                    PolyglotMan(1)

NAME
       PolyglotMan, rman - reverse compile man pages from formatted form to a number of source formats

So lets run the actual Oracle RMAN command.

[oracle@linux2 bin]$ $ORACLE_HOME/bin/rman

Recovery Manager: Release 11.2.0.2.0 - Production on Mon Jun 20 07:14:58 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

RMAN>

So, moral of the story is set your PATH correctly. I hope someone will find it useful, in case their rman command is hung.

 

Posted in Linux, Oracle, RMAN | 9 Comments »

Resizing disks on Linux

Posted by Vishal Gupta on Mar 12, 2011

RHEL 5.3 x64 disks

On a RHEL OS using LVM volume manager, you can extend the underlying disk and its associated filesytem (non-root) can be extended while its mounted.

  • Extend the underlying virtual/SAN disks.
  • Check the size of disk

#   fdisk -l

  • Force the re-scan of disk, so that OS kernel can see the new size

# echo 1 > /sys/block/sdb/device/rescan

where disk extended was /dev/sdb

  • Extend LVM physical volume size.

# pvs

# pvresize /dev/sdb

# pvs

  • Extend LVM logical volume

# lvdisplay

# lvextend /dev/ora_vg/ora /dev/sdb

# lvdisplay

  • Extend filesystem (online)

# df –h

# resize2fs /dev/ora_vg/ora

# df –h

Filesystem is extended.

Posted in Linux | Leave a Comment »

Linux auto start/stop scripts

Posted by Vishal Gupta on May 17, 2010

Normally DBAs and SAs have a tendency to create the auto start/stop scripts like following.

# cat /etc/init.d/oracle
case $1 in
start)
 /opt/oracle/product/11.1.0/bin/dbstart;
 ;;
stop)
 /opt/oracle/product/11.1.0/bin/dbshut;
 ;;
esac

# ln -s /etc/init.d/Oracle /etc/rc.d/rc0.d/K01oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc3.d/S99oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc4.d/S99oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc5.d/S99oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc6.d/K01oracle

This works fine on non-Linux operating systems. But on Linux operating system, there is an requirement to for start/stop script to create/remove a /var/lock/subsys/ file, where is name of the file in /etc/init.d. This ensures that, when init is changing runlevel as part of server start and stop routine, a service which is already started does not start again. And a service which is already stopped does not stop again. If /var/lock/subsys/ is not created then inspite of K(ill) symbolic links being present in rc*.d folder for runlevel zero (halt) and 6 (reboot), stop script is not called. This means process are killed instead of being shutdown cleanly by your stop script.

On Linux Operating system, start/stop functions for a service init.d script should look like below. Important part is highlighted in red below

# chkconfig: 2345 99 01

# description: This script start/stop Oracle

case $1 in
start)
   /opt/oracle/product/11.1.0/bin/dbstart;
    touch /var/lock/subsys/Oracle;
    # where  is same as name of file in /etc/init.d
    ;;
stop)
    /opt/oracle/product/11.1.0/bin/dbshut;
    rm –f /var/lock/subsys/Oracle; 
    ;;
esac

# ln -s /etc/init.d/Oracle /etc/rc.d/rc0.d/K01oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc3.d/S99oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc4.d/S99oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc5.d/S99oracle
# ln -s /etc/init.d/Oracle /etc/rc.d/rc6.d/K01oracle

This applies to not only oracle but all start/stop created for init.d on Linux.

This requirement to create subsystem lock file in /var/lock/subsys can be verified by looking at /etc/rc script, which is called everytime there is runlevel change. See below the portion of /etc/rc script which is checking for presense of /var/lock/subsys/ file before calling Kill/stop scripts.

# First, run the KILL scripts.
for i in /etc/rc$runlevel.d/K* ; do
   check_runlevel "$i" || continue

   # Check if the subsystem is already up.
   subsys=${i#/etc/rc$runlevel.d/K??}
   [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \
    || continue

   # Bring the subsystem down.
   if LC_ALL=C egrep -q "^..*init.d/functions" $i ; then
      $i stop
   else
      action $"Stopping $subsys: " $i stop
   fi
done

Posted in Linux | 2 Comments »

 
%d bloggers like this: