Tutorial 1: Setting up Fedora 12 for Oracle 11g

This tutorial will discuss how to set up the Fedora 12 operating system on your computer so that you can install Oracle 11g properly.

Why Use Oracle 11g?

Before getting into the installation tasks I wanted to take a moment to explain why we are using Oracle 11g and why I'm doing tutorials on it.

First the reason I am doing tutorials on Oracle 11g is because the virtual world tutorials I will be writing require a database. Any client/server or web based application is generally data driven which requires a data source such as a database. You could use text files to store your server data but a database is a far more efficient and elegant solution. Databases offer the fastest way to access and manipulate large amounts of server-side data.

Now why choose Oracle over other database systems? The reason is simply because it is the most powerful database system in existence. The vast majority of large scale enterprise applications use Oracle for this reason. Any database written and tuned by experts will always perform better on Oracle than any other rdbms (relational database management system).

There is a considerable amount of misinformation propagated by other database companies that their databases can perform as good or better than Oracle but this is simply not true. In real world applications where millions of dollars are at stake on a daily basis companies will choose the best performing option which always ends up being Oracle. If other databases performed as well for high end applications they would be used in the technology industry, but you rarely see that. The vast majority of the time when you do see other database systems in use it is for smaller applications in which the development team couldn't afford or only understood how to code for a certain database system.

And finally Oracle is the most feature rich database in existence which is undisputed even by their competition. Currently as I write this I see other databases such as SQL Server 2008 coming out with features that Oracle had in their database over 10 years ago. Oracle is the most current and advanced database technology and I personally like to always use the best tool for everything I do.

Why Use Fedora 12?

The reason I use Fedora 12 is because it works very well with Oracle 11g and does not generate any bugs that I have seen on other Linux distributions during installation or operation of Oracle. Now with that said the differences between the other Linux distributions are very minimal and this tutorial should work for most of them. However I do not not recommend running Oracle on any other O/S (Solaris excluded). It will work on pretty much any O/S but the port of the database to other operating systems leaves quite a bit to be desired.

Obtaining Fedora 12

You can go to Fedora's website and they will provide links to mirrors that will have the DVD burnable ISO image. I downloaded the Fedora 12 x86_64 DVD ISO which is the 64bit version since I have a 64bit processor. If you have a 32 bit processor you will need to download a 32bit version.

Once downloaded you can double click the ISO file and it should start your DVD burner program and put you at the screen where it is ready to burn to a DVD. After the disk is burnt you now have a bootable DVD you can use to boot your server with.

Starting the Install

Place the DVD in the computer and boot from your DVD drive, this will bring up the Fedora 17. Select "Install to Hard Drive" from the options. You can follow the installation and select the default options for pretty much everything.

The first customization that we will want to make is on the storage options page. You will find an option that says "Use All Space", click that option. At the bottom of the page also click the check box for "Review and Modify Partitioning Layout" so we can edit the storage layout. Then click "Next"

On the next page you will see you drives listed on the left side of the screen. Click on each one and then click the arrow key in the middle area to move them over to the right side of the screen. Then click "Next".

The following screen will now show how the logical volume manager has setup a default layout for your drives. Generally it will setup some space for swap, some space for root, and the rest of the space to /home. Click on the volume group "vg" and click the "Edit" button in the bottom right corner of the screen. We can now modify how space is partitioned and add more mount points.

The first mount point we want to change is the root mount called "/". Click on "/" and press the edit button. Since a large portion of the hard drive space was allocated to this mount change the size of it back to something smaller like 30GB. Do the same with the /home mount point and make it smaller such as 10GB for now so that all the other space has been released. We will resize /home later and make it larger. Now we can create new mount points with the unallocated space. To create a new mount point click the Add button and create the following mount points with the specified sizes:

	/ora/base - 8GB

	/ora/scr1 - 4GB
	/ora/scr2 - 4GB
	/ora/scr3 - 4GB

	/ora/data - 100GB
	/ora/arch - 8GB
	/ora/temp - 16GB

	/home - remainder of the free space

I will explain the reasoning for the mount point layout. First the /ora base directory is used as the parent directory for all oracle related files regardless of how many databases we have. The /fs2000 directory is the file system for a single database. So if we have multiple databases we would create a different file system such as /fs2001 and you would know all the directories for that second database would all exist under fs2001 and the first database would all be under /fs2000.

The /s00 directory is for the oracle software. Some people use this directory for all databases on the system but this is a very bad idea. If you have separate software directories for each database it gives you the flexibility of patching each database on the server individually. If you work in a large corporation that has numerous databases on each server you generally have the problem of getting the business owners of all the databases to agree on a date to patch the database. However if you have separate software homes you can patch each individually and not require a huge amount of coordination.

The /uXX directories are where we place the data files that the database will use. I like to put the important system related data files on u01, u02, and u03. And then I use u04 and u05 for all the individual schema data files that each application on the database will need. Because of this I keep u01-u03 small and make u04 and u05 very large. In the example here they are 8GB but you may want to make them 30-50GB instead.

Now you may wonder why I create different mount points for the data files instead of a single mount point. The reason being is that a mount point is a logical entity that can disappear for various Unix O/S problems. In the last six years I personally have seen five mount points disappear, and these are servers maintained by highly qualified and experienced Unix admins. So if you separate your mount points you only have to recover 1/5 of your database instead of the entire thing when this problem shows up. And when problems like this arise and its important production data you need to be able to recover as fast as possible and sometimes your job is riding on it.

The /r0X mount points are for redo logs. I like to have three sets of redo logs so I create three mount points for them. Redo logs are small so I make these mounts just 512MB.

The /archive mount point is where the database will write archive logs that are used for database recovery. 8GB is usually fine as long as you are backing these files up somewhere else and removing them from this directory on a daily basis. If you database is incredibly busy this mount point will need to be larger.

The /export mount point is for our datapump files which we create when we want to export data from this database and copy it into another. In oracle we will set the data pump directory to this mount point and it will always write out export data files to this location. If you exports are fairly large you may want to increase the size of this mount point later on.

The /home mount point is where all the users home directories are located. I put the remainder of the disk space to this mount point.

Now some people reading this may be Oracle power users looking to get good performance in which case I recommend creating raw partitions and using ASM. Do note though in Oracle 12g and current operating systems like Redhat 6 that raw devices are deprecated and to use ASM you will need to use oracle cluster file system. But for less experienced users the regular file system is fine for your purposes.

Continuing the Install

Now that the mount points are created you can continue the install. Click on "Ok" and then click on "Next". The option will pop up so click on "Write Changes To Disk". This will format the drives and prepare the mount points. Click on Next on the boot loader screen so it uses the default settings. Now it will install fedora onto the root mount point. Once it is done click reboot. Take the CD out of the drive after the reboot so it doesn't boot off it again.

Booting up Fedora 12

After Fedora starts it will ask a couple more questions and have you create a user. Once that is done and you log in you will be presented with the desktop. From the start the network may not be online. If not you have to right click on the network icon in the upper right corner and choose network settings. CLick the "On" button beside the Wired Icon to activate the network. Click on "Options" and put a check mark in the "Connect automatically" check mark box. Also put a check mark in the "Avialble to all user" box at the bottom of the dialog.

Fedora generally requires a lot of patching so I suggest you do the patches right away. Click on Activies, then Applications, then Software Update. Make sure to install all the updates and patches.

Installing Specific Packages

Oracle requires some specific packages to be installed for it to install and create a database without errors. Here is the following list (note some packages require both 32bit and 64 bit versions or Oracle won't work):

	compat-libstdc++- (32 bit)

	glibc-2.5-12 (32 bit)
	glibc-devel-2.5-12 (32 bit)

	libaio-0.3.106 (32 bit)
	libgcc-4.1.1 (32 bit)
	libstdc++-4.1.1 (32 bit)


Most of these are installed already but some won't be. To determine if they are installed or not first use the terminal program to open a terminal prompt. Once you have a prompt switch to the root user and enter their password using the following unix command:

	su - root

Now that you are the root user you can check for installed packages by using the rpm package. For example if we wanted to see if binutils- was installed we would type in:

	rpm -q binutils-*

This will return the version of binutils installed and we can decide from there is the package is too old or if its not installed at all.

Now if it doesn't find the package you will need to use the Add/Remove Software tool that comes with Fedora. Click on System, then click Activities, and then click Add/Remove Software. Make sure to first click on filters and uncheck "Only Native Packages" so it will show 32bit versions as well. Type in the name of the package in the find box and it will search the web for all the latest packages. Check mark the ones you want and install them. Note the 32 bit versions will be called i686 and the 64 bit versions are called x86_64. Make sure to install everything from the list above or you will have troubles getting Oracle to work.

Network Setup

Oracle 10g and up require that you have a domain name. I'm not great at setting up network stuff so I'll show you what I did to get it to work for me. First thing I did was edit the /etc/hosts file as root and added the following line at the top:  craigsbox.oraguru.net  craigsbox

The first parameter is the IP address of your computer. The second parameter is your fully qualified domain name, I just made one up as anything will work. The third parameter is the machine name without the entire domain suffix. Once I set that I rebooted to make sure it was there.

Once the machine started again I went into the network settings. First click on System, then click Administration, and then click Network. From here click on the DNS tab and set the Hostname to be your fully qualified domain name. Click File and Save and then reboot again. It should now work properly. At the unix prompt you can type in hostname and it should say the hostname you put in. To test that it works use the ping command such as follows:

	ping craigsbox

If it is successful it will return the delays it takes to ping that address, press CTRL C for it to finish.

Groups and Users

Oracle requires an oracle user and two groups. To set these up use the following commands:

	su - root
	(enter the root password)

	groupadd oinstall

	groupadd dba

	useradd -g oinstall -G dba oracle

	passwd oracle
	(set the password for the oracle user now)

The oracle user and groups should now be setup.

Kernel Parameters

Oracle requires certain kernel parameters to be set for it to operate efficiently. The first are the semaphores:

	semmsl 250
	semmns 32000
	semopm 100
	semmni 128

To check if these are set correctly type in the following as root:

	sysctl -a | grep sem

If any of the values are below the recommended setting then you can edit the /etc/sysctl.conf file using any text editor and add the following line to the end:

	kernel.sem = 250 32000 100 128

The next parameters are:

	shmall 2097152
	shmmax 2147483648 (or whatever half the memory is in your server in bytes)
	shmmni 4096

The check these settings type in as root:

	sysctl -a | grep shm

If any of the values are below the recommended setting then edit the /etc/sysctl.conf file and add the following:

	kernel.shmall = 2097152
	kernel.shmmax = 2147483648
	kernel.shmmni = 4096

The next parameter is:

	file-max 6815744

The check these settings type in as root:

	sysctl -a | grep file-max

If the value is below the recommended setting then edit the /etc/sysctl.conf file and add the following:

	fs.file-max = 6815744

The next parameter is:

	ip_local_port_range min: 9000 max: 65500

The check these settings type in as root:

	sysctl -a | grep ip_local_port_range

If the value is below the recommended setting then edit the /etc/sysctl.conf file and add the following:

	net.ipv4.ip_local_port_range = 9000 65500

The next parameters are:

	rmem_default 262144
	rmem_max 4194304

The check these settings type in as root:

	sysctl -a | grep rmem

If the values are below the recommended settings then edit the /etc/sysctl.conf file and add the following:

	net.core.rmem_default = 262144
	net.core.rmem_max = 4194304

The next parameters are:

	wmem_default 262144
	wmem_max 1048576

The check these settings type in as root:

	sysctl -a | grep wmem

If the values are below the recommended settings then edit the /etc/sysctl.conf file and add the following:

	net.core.wmem_default = 262144
	net.core.wmem_max = 1048576

The final parameter is:

	aio-max-nr 1048576

The check this setting type in as root:

	sysctl -a | grep aio

If the value is below the recommended setting then edit the /etc/sysctl.conf file and add the following:

	fs.aio-max-nr = 1048576

Now that all the kernel parameters have been set correctly you can enter the following command to make them active:

	sysctl -p

Rebooting at this point is probably a good idea as well.

Shell Settings

To set the shell limits in Fedora 12 we need to first edit the file /etc/security/limits.conf and add the following 4 lines at the end as root:

	oracle  soft  nproc  2047
	oracle  hard  nproc  16384
	oracle  soft  nofile  1024
	oracle  hard  nofile  65536

After that edit the file /etc/pam.d/login and add the following line as root:

	session required pam_limits.so

And finally edit the /etc/profile file as root and add the following lines to the end:

	umask 022
	if [ $USER = "oracle" ]; then
		if [ $SHELL = "/bin/ksh" ]; then
			ulimit -p 16384
			ulimit -n 65536
			ulimit -u 16384 -n 65536

Oracle Directories

The mount points were setup already but we need to change their ownership and settings to be under the oracle user. As well we need to create the directories on each mount for the install and database installation to run without errors.

To fix the ownership and permissions type in the following as root:

	chown -R oracle:oinstall /ora
	chmod -R 775 /ora

Now switch to the oracle user and create the following directories. Replace the name CRAIG with the name of your database:





Switch back to the root user and create one more directory and fix its permissions:

	cd /var/opt/
	mkdir oracle
	chown -R oracle:oinstall /var/opt/oracle
	chmod -R 775 /var/opt/oracle

Fedora has introduced a security system that interferes with Oracle unless setup very well. I instead suggest just turning it off or Oracle won't install/start correctly. To do so go to System, then Administration, then SELinux Management. Click on the first option and select disable. You will have to reboot for it to take effect.

You are now ready to install Oracle! Continue to the next tutorial.

Back to Tutorial Index