Sunday, June 17, 2007

oerr "tool" for windows

Hi,
This is an old post I wrote, but I'm rewriting it because I just had a customer that needed this tool.

I've created a small oerr "tool" for use in windows. I don't have databases on windows machines, but i do use windows as a client and when I get an error in sqlplus i don't wish to ssh to a linux/unix server and run oerr there.

The "tool" is a batch file with gawk and the message files from a 10g oracle installation. The zip file contain information about how to use other oracle version messages.

You can get the file from here.

Saturday, June 16, 2007

Know your regular expressions

New article from IBM - Know your regular expressions, shows how few techniques that helps in creating regular expressions.

Unistall Oracle Clusterware+ASM+ASMLib+Database 10.2.0.2

Hi,
This week I've installed Oracle RAC + ASM + ASMLib on RHEL4 (update 5), and it was exhausting!
I've done the linux administration part of the installation, but I also participated in the Oracle aspect.
Well, the first thing that I would like to talk about is the oracle Clusterware voting & CRS disks,
Oracle Clusterware needs raw access to the disks, also, specific privileges on the raw devices.
Linux raw devices are deprecated! The other way to do this job is that the application will open the devices with O_DIRECT. Oracle database supports O_DIRECT by using OCFS or ASM with ASMLib but not for the Clusterware disks.

So we will need to use raw devices if we are using RAC with Oracle Clusterware.
The problem with the raw devices is:
- It's deprecated
- Need to create the devices on every boot and change the devices permissions for oracle usage
- depends on the device name (sda, sdb...)

Why depending on the device name is a problem? Because there is no way to assure that the device sda will still be sda after reboot or after storage changes (Ex. adding a new disk).

Well, the way to do all of this and assure that the Clusterware will load and start the instances is:
- Use Udev to map the devices name to be something like /dev/vote1, /dev/ocr1
- Use Udev to change the raw device privileges on boot
- Use /etc/sysconfig/rawdevices file to create the raw devices when the server starts

One more thing is the cluvfy script in the Clusterware installation disk, the script is good for RHEL3 and partially for RHEL4, the last step of the script is to check the rpms needed by the installation, the rpm list is for RHEL3 and not for RHEL4 so you can ignore this check and start the installation.

The other thing is the uninstall of the Oracle Clusterware, the way to fully uninstall oracle is:
- Run the universal installer to uninstall the software for the database, ASM and Clusterware.
- Manually remove the files remains in the installation directories ($ORACLE_HOME, $ASM_HOME & $CRS_HOME).
- remove /etc/oracle directory.
- remove "/etc/oratab".
- remove "/etc/oraInst.loc".
- remove "/etc/crstab*".
- remove "/etc/init.d/init.*".
- edit /etc/inittab and remove the lines oracle added (usually 3 lines at the end).
- remove the ASM disks using "/etc/init.d/oracleasm deletedisk".
- For the finale dd the first 50MB of the voting disks and the crs disks (Without this the cluster will use the old configuration!!).
- Just to make sure also dd the first 50MB of the ASM disks.

After that you can start the installation again...

Oded.

Saturday, June 09, 2007

Rehdat Linux kickstart file for Oracle database server

I've created a kickstart file for RHEL that will install and configure your Redhat linux server for Oracle database installation.

You can get the file from here or copy & paste this:

#############################################################################
# This Kickstart file generated by Oded Maimon - Tangram Soft Ltd.
# License: Do what ever you wish to do with this file, I don't care
#
# This Kickstart file is used to install the minimum RHEL server for use with
# Oracle database. It also removes unnedded services.
#
# The defualt root password is: password
#
# Values to change before using are:
# - Set the network - The hostname & Network configuration (DHCP/Static)
# - Partitioning & Swap size
# - Set a different timezone if not located in israel
# - If going to use rawdevices comment the "chkconfig rawdevices off" line
# - Set the shmmax kernel parameter to the correct value
# - If you are not going to install Oracle RAC, you can comment the hangcheck
# line in this file
#
# Things to do after the server is installed:
# Change the root and oracle accounts password
# Create the needed filesystem and set the owner to oracle
# Change the ORACLE_BASE, ORACLE_SID environment variables in
# ~oracle/.bash_profile to the correct values
# Set the server default run level to 3 or 4 (if using NFS/CIFS)
#############################################################################

# Uncomment the next line to enable interactive installation
#interactive

# Comment the next line to use GUI installation
text

install

# From where to get the installation disks
cdrom
#url --url http://myserver/redhat/

lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
xconfig --resolution 800x600 --depth 16 --defaultdesktop gnome

# Change the hostname and peek the best eth configuration for you
network --device eth0 --bootproto dhcp --hostname srvoracle01
#network --device eth0 --bootproto static --ip x.y.z.v --netmask 255.255.255.0 --gateway x.y.z.v --nameserver x.y.z.t,x.y.z.v --hostname srvoracle01

rootpw --iscrypted $1$uKWECPhN$Im66UG8MpWd2/kpcHoyuy/
firewall --disabled
selinux --disabled
authconfig --enableshadow --enablemd5

# Set a different timezone if not located in israel
timezone Asia/Jerusalem

bootloader --location=mbr --append="rhgb quiet"


# Create a Volgroup device sda
clearpart --all --drives=sda
part /boot --fstype ext3 --size=100 --ondisk=sda
part pv.3 --size=0 --grow --ondisk=sda
volgroup vg00 --pesize=32768 pv.3

# Create the filesystems and logical volumes
logvol / --fstype ext3 --name=lvol00 --vgname=vg00 --size=2048
logvol /tmp --fstype ext3 --name=lvol01 --vgname=vg00 --size=2048
logvol /usr --fstype ext3 --name=lvol02 --vgname=vg00 --size=3500
logvol /usr/local --fstype ext3 --name=lvol03 --vgname=vg00 --size=1024
logvol /var --fstype ext3 --name=lvol04 --vgname=vg00 --size=1024
logvol /var/log --fstype ext3 --name=lvol05 --vgname=vg00 --size=1024
logvol /opt --fstype ext3 --name=lvol06 --vgname=vg00 --size=1024
logvol /home --fstype ext3 --name=lvol07 --vgname=vg00 --size=512

# Edit the swap space to be twice the size of the machine RAM, if you have 8GB of RAM or more set the swap to the same size as the RAM
logvol swap --fstype swap --name=lvol08 --vgname=vg00 --size=2048


# All packages needed by Oracle installation include Gnome desktop
%packages
@ system-tools
@ gnome-desktop
@ dialup
@ compat-arch-support
-openldap-clients
-ckermit
-wireshark
-bluez-pin
-OpenIPMI-tools
-samba-client
e2fsprogs
-screen
-xdelta
-zsh
-nmap
lvm2
sysstat
-open
kernel-smp
grub
binutils
compat-db
control-center
gcc
gcc-c++
glibc
glibc-common
gnome-libs
libstdc++
libstdc++-devel
make
pdksh
sysstat
xscreensaver


# This post script modify all the Oracle database prerequisites, includes oracle user and dba,oinstall groups
%post

# create user and groups
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle

# Change kernel parameters
cat >> /etc/sysctl.conf << EOF

##############################
# Oracle Database requirements
##############################

# The max value for shmmax on a 32bit machine is 4294967295
#kernel.shmmax = 536870912

kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 658576
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 1048536
net.core.wmem_max = 1048536
EOF

# Change ulimits for user oracle
cat >> /etc/security/limits.conf << EOF
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 65536
oracle hard nofile 65536
EOF


# Add hangcheck-timer module for RAC
echo "options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" >> /etc/modprobe.conf
echo "modprobe hangcheck-timer" >> /etc/rc.local


# Set oracle account environment variables
cat >> /home/oracle/.bash_profile << EOF

# Oracle environment variables
export ORACLE_BASE=/software/oracle
#export ORACLE_HOME=\$ORACLE_BASE/10g
#export TNS_ADMIN=\$ORACLE_HOME/network/admin
export ORACLE_SID=orcl1
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib
export PATH=\$PATH:\$ORACLE_HOME/bin

if [ "`ls -ld \$ORACLE_HOME | awk '{print \$3" "\$4}'`" != "oracle oinstall" ]
then
echo "The ORACLE_HOME (\$ORACLE_HOME) is not owned by oracle:oinstall"
fi
EOF

#############################
# Remove unneeded services!!!
#############################

# Comment this line if you are using Oracle Clusterware
chkconfig rawdevices off

# Enable Network filesystems support for run level 4 only
chkconfig --level 12356 portmap off
chkconfig --level 12356 nfslock off
chkconfig --level 12356 rpcgssd off
chkconfig --level 12356 rpcidmapd off
chkconfig --level 12356 autofs off
chkconfig --level 4 portmap on
chkconfig --level 4 nfslock on
chkconfig --level 4 rpcgssd on
chkconfig --level 4 rpcidmapd on
chkconfig --level 4 autofs on

# Enable xfs support for run level 5 only
chkconfig --level 12346 xfs off
chkconfig --level 5 xfs on

chkconfig sendmaill off
chkconfig cups off
chkconfig hplip off
chkconfig anacron off
chkconfig apmd off
chkconfig arptables_jf off
chkconfig atd off
chkconfig bluetooth off
chkconfig canna off
chkconfig cups-config-daemon off
chkconfig gpm off
chkconfig hidd off
chkconfig hpoj off
chkconfig iiim off
chkconfig isdn off
chkconfig pcmcia off

chkconfig rhnsd off
chkconfig auth off

# RHEL 5 only services
chkconfig yum-updatesd off
chkconfig setroubleshoot off
chkconfig restorecond off
chkconfig pcscd off
chkconfig mcstrans off
chkconfig avahi-dnsconfd off
chkconfig avahi-daemon off

##########################################################
##########################################################



Enjoy.
I'm trying to get this blog alive again, with a different blog name and a different purpose.
In the blog i will talk about Linux, open source, oracle and more.