Nov 092011
 

I’ve installed a basic Oracle server in a VirtualBox image, following the guide on their site and a bunch of other guides, without prior knowledge about the process. This is a basic setup, using CentOS 6, minimal install. The idea is to bring it to a working state, operating system all set up, so that the database administrator can take over without having to worry about changing things outside the Oracle environment. What follows is the steps I took, so I don’t have to spend a few days again searching.

0. System prerequisites
1. Software packages
2. Kernel parameters
3. User and shell limits
4. Install directories
5. Run the installer
6. Post-install


0. System prerequisites:

How should the OS be installed, partitions size, RAM demands, etc.

RAM: 1GB minimum, recommended 2GB or more.

SWAP: depends on the amount of RAM in the system. General guidelines:

Amount of RAM Recommended SWAP
between 1 GB and 2 GB 150% the amount of RAM
between 2 GB and 16 GB the same size as RAM
more than 16 GB 16 GB

 

TMPFS: ( aka shmfs aka /dev/shm) depends on init params MEMORY_TARGET, MEMORY_MAX_TARGET. SGA and PGA mem sizes. Those should default to zero, so whatever size tmpfs is should be fine. Basically it should be set to at least the larger value of MEMORY_TARGET or MEMORY_MAX_TARGET, otherwise oracle will error on startup with “ORA-00845: MEMORY_TARGET not supported on this system” or “ORA-01078: Failure in processing system parameters”. More info here.

DISK SPACE: /tmp must have 1 GB at least. If the current value is too low and you can’t increase it (i.e. OS already installed and no more free space), the environment variables TMP and TMPDIR of the user running oracle (usually “oracle”) can be set to somewhere else. Maximum free space needed by bin + data files is 7 GB, rounded up, for Oracle Enterprise. Depending on instalation type, less is still fine probably. Details. Also, this is just the base install. It’s recommended to keep the production databases, backups, etc. on different file systems, those should require a lot more space, so don’t allocate the whole disk to one partition. Also the database files are usually large files, so fewer inodes and larger blocks on the file system is better.

1. Software packages

The installer is a graphical installer, as in runs in X, as in X forwarding over SSH should work in order to install remotely from an X server. This would be the minimum amount of X-related packages installed on the system, rather than having a full X server. The package needed is xorg-x11-xauth with dependencies, of course, so..

To install the rest of the needed packages in one go, do..

Some of the scripts used by the installer are written for ksh, so that’s also needed. You might also want unixODBC drivers, they are in the base repository, version 2.2.11 or higher.

2. Kernel parameters

Short and fast version, add these lines to /etc/sysctl.conf then reboot the system:

Long version follows. Jump to next section if you want to skip it.

EPHEMERAL PORT RANGE

must be above 9000 for oracle, IANA suggests 49152-65535 for dynamic or private ports, increase if needed

To check the current value To make it permanent
cat /proc/sys/net/ipv4/ip_local_port_range echo “net.ipv4.ip_local_port_range = 49152 65535” >> /etc/sysctl.conf

The values here are the IANA values, although Oracle recommends setting them to 9000-65000.

will load the new values.

SEM – semaphores

To check the current value To make it permanent
/sbin/sysctl -a | grep sem echo “kernel.sem = 250 32000 100 128” >> /etc/sysctl.conf
cat /proc/sys/kernel/sem

These are recommended values. If the current (default) value of any of the four parameters is higher, keep the higher one.

SHM – shared memory

To check the current value To make it permanent
/sbin/sysctl -a | grep shm
cat /proc/sys/kernel/shmall echo “kernel.shmall = 2097152” >> /etc/sysctl.conf
cat /proc/sys/kernel/shmmax echo “kernel.shmmax = 2147483648” >> /etc/sysctl.conf
cat /proc/sys/kernel/shmmni echo “kernel.shmmni = 4096” >> /etc/sysctl.conf

 

FILE-MAX – maximum number of file handles

Basically, how many open files can there be at one time

To check the current value To make it permanent
/sbin/sysctl -a | grep file-max echo “fs.file-max = 6815744” >> /etc/sysctl.conf
cat /proc/sys/fs/file-max

 

AIO-MAX-NR – concurrent outstanding requests

should be set to avoid I/O subsystem failures

To check the current value To make it permanent
/sbin/sysctl -a | grep aio-max-nr echo “fs.aio-max-nr = 1048576” >> /etc/sysctl.conf
cat /proc/sys/fs/aio-max-nr

 

RMEM_DEFAULT

rmem and wmem are settings related to the network stack, namely the sizes of the receive and send window buffers in TCP/IP

To check the current value To make it permanent
/sbin/sysctl -a | grep rmem_default echo “net.core.rmem_default = 262144” >> /etc/sysctl.conf
cat /proc/sys/net/core/rmem_default

 

RMEM_MAX

To check the current value To make it permanent
/sbin/sysctl -a | grep rmem_max echo “net.core.rmem_max = 4194304” >> /etc/sysctl.conf
cat /proc/sys/net/core/rmem_max

 

WMEM_DEFAULT

To check the current value To make it permanent
/sbin/sysctl -a | grep wmem_default echo “net.core.wmem_default = 262144” >> /etc/sysctl.conf
cat /proc/sys/net/core/rmem_max

 

WMEM_MAX

To check the current value To make it permanent
/sbin/sysctl -a | grep wmem_max echo “net.core.wmem_max = 1048586” >> /etc/sysctl.conf
cat /proc/sys/net/core/wmem_max

 

3. User and shell limits

At this point the OS should be set up properly and we should create a new user, usually “oracle”, that will actually run the whole thing, listener and database and all. This user needs certain shell limits changed/increased from the defaults, like the number of processes it can run and the number of files it can open. Also some environment variables need to be set, that will be done in .bash_profile.

Here’s a small script that will do some of that. It creates the user and the necessary groups then checks if the shell limits are properly set. if they aren’t it’ll output the lines to add to /etc/security/limits.conf. Also checks for user “nobody”, but it doesn’t create it if it’s not there. It should be, in most linux installs, certainly in CentOS 6. Note that there are a number of ways to set the shell limits, but limits.conf works on CentOS 6 and it’s probably the easiest to do.

Sample output:

Notice the last lines, you can just add these settings to limits.conf and be done with it.

4. Install directories

This is easy enough, create the direcotries where you want it installed and set the apropriate permissions. Something like

5. Run the installer

Log in as “oracle”, set the environment variables and start the installer. ORACLE_BASE needs to be set to the base directory created above and ORACLE_SID to the name of the database. ORACLE_HOME and TNS_ADMIN need to be unset. Also, if /tmp has less than 1 GB free space, set TMP and TMPDIR to some other directory. Assuming bash:

Use setenv and unsetenv in a C shell. You will have a chance to change the location during install anyway. Now run the installer, X forwarding needs to be enabled if you’re doing it over ssh.

The program will also check if the system was properly set up, kernel parameters et al, so you can still fix things if it says something is wrong. Note that it will complain about the ephemeral ports, you can change it if you think more connections are needed or just don’t like it being there.

6. Post-install

If everything went according to plan oracle should now be started. Check for the listener by doing

If Oracle Enterprise Manager was also installed it should be running on port 1158 on https (https://hostname:1158/em/)
There’s a few more things to do, setting the environment variables for the user and setting up a script to automatically start oracle on next system boot. The installer does no such thing. Assuming the user is “oracle” and oracle’s shell is bash, add a few lines like the following to /home/oracle/.bash_profile :

ORACLE_HOME depends on the version of oracle and the database name, ORACLE_SID and ORACLE_UNQNAME contain the database name.
Now for the startup script. In /etc/oratab there’s a list of instances (databases) that oracle has. On a fresh install there will be only one, named “sales” in this document. Change the last field from “N” to “Y” for the instances that you want to start automatically. “W” means that dbstart auto-starts the database only after the Automatic Storage Management instance is started, if you have such a thing. If in doubt, use “Y”. After that a script should be added to /etc/init.d to actually start the listener and whatnot. There’s a number of them, I’m using this one:

Simple and good enough. I think i got it from here, although not sure. It also starts the Enterprise Manager, comment it out if it’s not there. Change the variables as needed, copy the thing in /etc/init.d/dbora, set it owned by root and executable

then set it to “on” when the server boots

Try stopping/starting the database using the script, reboot the system to check that everything’s in order, done.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)