Tuesday, February 23, 2010

hard limit for "maximum open file descriptors"

In some cases when installing some software in Linux you might need to change the hard limit for "maximum open file descriptors". There are two levels of control on Linux maximum number of open files (or file descriptors), system limit and per-user/group/process limit. /etc/sysctl.conf is to set system-wide amount for kernel, /etc/security/limits.conf is to assign specific limits on per-user/group or process.

You may make changes by either issuing commands online or modifying the configuration files. Please bear in mind, online modification is usually temporary (the settings will be gone after reboot of system), change by modifying the configuration files is permanent.

Each user has per-user file descriptor limits. It includes soft and hard limits. hard limit is the absolute limit, user can set its soft limit freely to any value up to hard limit (use command: ulimit -n xxxx). Per-user limit defaults to 1024. Only root can increase the hard limit.

To change this you can add a line like the one below to your /etc/security/limits.conf
jolouwer hard nofile 65536

In this case I changed the hard limit for the user jolouwer

aio-max-nr parameter for Oracle database 11G R12 on Ubuntu

When installing a Oracle database on a Linux server, for example Ubuntu you can come across a warning during the installation that you have to change your aio-max-nr parameter. This warning will most likely come in a format like below:

This is a prerequisite condition to test whether the OS kernel parameter "aio-max-nr" is properly set.
Expected Value : 1048576
Actual Value : 65536

The /proc/sys/fs/aio-max-nr file is the maximum number of allowable concurrent requests. The maximum is commonly 64KB, which is adequate for most applications. This is related to asynchronous I/O usage on your system. IBM is running a great article on this which you can find here at the IBM website where they dive into the POSIX AIO API.

To solve the problem in hand you have to add the below line to your /etc/sysctl.conf file.

fs.aio-max-nr = 1048576

After you have done so you can activate your settings by executing the following command:

sysctl -p /etc/sysctl.conf

When this is done you should be set and ready to continue the installation of your database.

mem parameter for Oracle database 11G R12 on Ubuntu

When installing Oracle database 11G release 2 on a Ubuntu Linux you can come accross some mem related parameters which you have to set correctly.

Most likely those will be:
- rmem_default
- rmem_max
- wmem_default
- wmem_max

The Oracle database installer will check those and expects certain values for those parameteres.

- rmem_default = 262144
- rmem_max = 4194304
- wmem_default = 262144
- wmem_max = 1048576

To set those parameters in such a way that it will stay after a reboot you will have to make some changes to the file /etc/sysctl.conf . You will have to add the following:

net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576

after you have added those lines you can activate them without a reboot by executing the following command:

sysctl -p /etc/sysctl.conf

After this your database should be able to install.

ip_local_port_range parameter for Oracle database 11G R12 on Ubuntu

When installing a Oracle database on a Ubuntu linux system the installer can ask you to change the settings of your ip_local_port_range parameter. This will most likely be presented to you in the following format:

OS Kernel parameter: ip_local_port_range
This is a prerequisite condition to test whether the OS kernel parameter "ip_local_port_range" is properly set.
Expected Value : between 9000 & 65500
Actual Value : between 32768 & 61000

The /proc/sys/net/ipv4/ip_local_port_range defines the local port range that is used by TCP and UDP traffic to choose the local port. You will see in the parameters of this file two numbers: The first number is the first local port allowed for TCP and UDP traffic on the server, the second is the last local port number. For high-usage systems you may change its default parameters to 32768-61000 -first-last.


echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

This should solve your problem and you should be able to install the Oracle database on your system.

shmmax parameter for Oracle database 11G R12 on Ubuntu

When installing a Oracle database 11G release 2 on a Linux system you can encounter the following error:

OS Kernel Parameter: shmmax
This is a prerequisite condition to test whether the OS kernel parameter "shmmax" is properly set.
Expected Value : 536870912
Actual Value : 33554432

The SHMMAX parameter is used to define the maximum size (in bytes) for a shared memory segment and should be set large enough for the largest SGA size. If the SHMMAX is set incorrectly (too low), it is possible that the Oracle SGA (which is held in shared segments) may be limited in size.

The way to solve this issue is executing the following commands:

echo "kernel.shmmax=536870912" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

This should resolve your issue and make sure you can install your database.

semopm parameter for Oracle database 11G R12 on Ubuntu

When installing a Oracle database 11G release 2 database on Linux you can encounter the following error. I received this when installing Oracle database 11G release 2 on a Ubuntu Linux system.

OS Kernel Parameter: semopm

This is a prerequisite condition to test whether the OS kernel parameter "semopm" is properly set. (more details)
Expected Value : 100
Actual Value : 32


The SEMOPM kernel parameter is used to control the number of semaphore operations that can be performed per semop system call.

The semop system call (function) provides the ability to do operations for multiple semaphores with one semop system call. A semaphore set can have the maximum number of SEMMSL semaphores per semaphore set and is therefore recommended to set SEMOPM equal to SEMMSL. Oracle recommends setting the SEMOPM to a value of no less than 100. When you need to change the semopm value you can do the following:

echo "kernel.sem=250 32000 100 128" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

This should solve this issue and you should be able to install the database.

file-max parameter for Oracle database 11G R12 on Ubuntu

While installing a Oracle 11G release 2 database on Ubuntu Linux I encountered the following error:

OS Kernel Parameter: file-max

This is a prerequisite condition to test whether the OS kernel parameter "file-max" is properly set.
Expected Value
: 6815744
Actual Value
: 198903

Stating that the file-max kernel setting should read 6815744. The solution to this is to edit the file /etc/sysctl.conf and add the (or change a existing line to) line to the following:

fs.file-max = 6815744

After you have done so you will have to activate the new file-max setting. One can do so by a reboot or you can do it on the fly by executing the following command:

sysctl -p /etc/sysctl.conf

This should have resolved your issue. You can check it by executing the oracle database installer or you can directly check from the command line by executing the following command:

cat /proc/sys/fs/file-max

The result of this should now list 6815744

Wednesday, February 17, 2010

Steven Feuerstein at Capgemini NL

Within some time we get Steven Feuerstein as a guest speaker at one our Capgemini events and I was asked to write something in our newsletter to warm the people to come… One of the things I have been writing is a reference to the below youtube movie which is partially made by Steven.

"You did WHAT?

You wrote an explicit cursor? You declared a variable using the VARCHAR2 datatype? You raised an exception to skip over unnecessary lines of code?

If slip-ups like these sound familiar (or if you don't know why these are mistakes), join Quest for a one-hour Webcast featuring guest speaker, Steven Feuerstein, as he examines common mistakes in Oracle PL/SQL programming. Learn how to correct mistakes to improve the maintainability and performance of your application.

This Webcast will also demonstrate CodeXpert — a powerful feature available within Toad® that will help you avoid common mistakes and ensure you implement PL/SQL best practices in your daily activities. "




Friday, February 12, 2010

Create logical volumes in HP-UX

I have been requested some time ago by one of our DBA’s to assist in building some test environments. We do currently have some HP-UX systems available as test environments. Problem is that those servers have been used in the past couple of years for all kind of test environments and for some reason people decided to organize the disks and logical volumes in a strange way by dividing them all in small parts where we will be in need of some large logical volumes to be able to install Oracle EBS R12.

To be able to get a large /u01 mount to be able to install Oracle EBS R12 on HP-UX I have taken the following steps:

(1) Identify how the disks are currently arranged. You can use the standard df command for this.


cjibu601:root-/ # df -k
/appora/cjibow (/dev/vg00/dbsoft ) : 19662197 total allocated Kb
19639976 free allocated Kb
22221 used allocated Kb
0 % allocation used
/asmbck (/dev/vg00/asmbck ) : 62916663 total allocated Kb
62883134 free allocated Kb
33529 used allocated Kb
0 % allocation used
/backup (/dev/vg00/backup ) : 97305244 total allocated Kb
77897028 free allocated Kb
19408216 used allocated Kb
19 % allocation used
/home (/dev/vg00/lvol5 ) : 130920 total allocated Kb
22928 free allocated Kb
107992 used allocated Kb
82 % allocation used
/mnt/test (/dev/vg00/test ) : 19662196 total allocated Kb
19639975 free allocated Kb
22221 used allocated Kb
0 % allocation used
/opt (/dev/vg00/lvol6 ) : 6533208 total allocated Kb
2597920 free allocated Kb
3935288 used allocated Kb
60 % allocation used
/oradata (/dev/vg00/oradata ) : 98306681 total allocated Kb
98263900 free allocated Kb
42781 used allocated Kb
0 % allocation used
/tmp (/dev/vg00/lvol4 ) : 521568 total allocated Kb
458424 free allocated Kb
63144 used allocated Kb
12 % allocation used
/usr (/dev/vg00/lvol7 ) : 6392288 total allocated Kb
3854232 free allocated Kb
2538056 used allocated Kb
39 % allocation used
/var (/dev/vg00/lvol8 ) : 4710776 total allocated Kb
1003760 free allocated Kb
3707016 used allocated Kb
78 % allocation used
/stand (/dev/vg00/lvol1 ) : 391712 total allocated Kb
204008 free allocated Kb
187704 used allocated Kb
47 % allocation used
/ (/dev/vg00/lvol3 ) : 654256 total allocated Kb
214200 free allocated Kb
440056 used allocated Kb
67 % allocation used
cjibu601:root-/ #



(2) Now we do know what is mounted and where they are mounted so we will be able to take a closer look at the logical volumes. You can check the settings of a logical volume in HP-UX by using the lvdisplay command. For example a lvdisplay on /dev/vg00/backup


cjibu601:root-/tmp # lvdisplay /dev/vg00/backup
--- Logical volumes ---
LV Name /dev/vg00/backup
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 100096
Current LE 782
Allocated PE 782
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default



(3) After we have found all the information we needed we can remove the logical volumes. First you have to unmount them by using umount. When the logical volumes you want to remove are dismounted you can remove them by using lvremove. For example lvremove /dev/vg00/backup


(4) After removing all the unwanted logical volumes you want to do some housekeeping by removing all the references in /etc/fstab and removing the mountpoint on your filesystem. This will prevent you system from trying to mount a logical volume in the future which is no longer existing because you just removed it.


(5) Now you can create a large new logical volume. One can do so by using the command lvcreate. When executing lvcreate you need to give some extra information. –L is the size you want it to have in MB’s, -n is the name you want your logical volume to have. In our case that is u01 and you have to state what logical volume group it will be part of. This last one is in our case /dev/vg00

This will end up in the following:


cjibu601:root-/dev/vg00 # lvcreate -L 319232 -n u01 /dev/vg00
Logical volume "/dev/vg00/u01" has been successfully created with
character device "/dev/vg00/ru01".
Logical volume "/dev/vg00/u01" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
cjibu601:root-/dev/vg00 #



(6) Now we have a new logical volume named u01 which is located at /dev/vg00/u01 all we have to do now is to make sure we get a filesystem on this one. One can do so by executing the newfs command. Please note that we do NOT use /dev/vg00/u01 we do use in this case /dev/vg00/ru01 .


cjibu601:root-/dev/vg00 # newfs -F vxfs /dev/vg00/ru01
version 6 layout
326893568 sectors, 326893568 blocks of size 1024, log size 16384 blocks
largefiles supported
cjibu601:root-/dev/vg00 #



(7) Now you can add this to your /etc/fstab file and mount your new logical volume.

Deserted island testing Linux and Oracle 11G database

Within some time I will try something new, a exiting exercise. For some reason some people around me decided we had to go for a ski and snowboard trip. I tried to fight this and make sure I did not have to be part of this trip as I do not like snowboarding and such. However, with some help from alcohol, they convinced me to join them on the trip. I agreed on a couple of conditions, they should not worry about me having no fun if I not joined them while they were snowboarding and they should leave me in peace when I decided to stay behind.

So I will be a long weekend in somewhere in Europe most of the time alone and honestly I am looking forward to it. When we go my new house should have finished and I should have moved over. No more builders asking me all kind of questions about what type of solution I would like for a particular building problem and it will give me some time to relax from a hectic time at work before the next phase of hectic projects start. Finally some time to keep up with my reading and most important do the island test of my Linux laptop.

The island test is, in my opinion, that you test an installation and your own knowledge and problem solving capabilities like you where on a deserted island. I am already prepping my laptop for this by installing a Oracle database and some tools I will need for the project I hope to finish in this long weekend. I will have no access to the internet or to people who will be capable of helping me solving the issues I encounter.

The project I will be undertaking, besides reading a 500+ page book I like to read is a script that will create the documentation on database installations I need to provide from time to time. All the settings that are applied, a database relation diagram, etc etc… Customers do expect those documents from time to time and it is always a hassle to create those documents so I decided to create a script that will create a docx document for me.

If it is any good I will post it into the public domain so everyone can benefit from this.