Oracle 10g

Introduction
The aim of this post was originally to provide a tested installation procedure to setup an Oracle 10g Release 1 (10.1.0.3) (without RAC) utilizing x86 or amd64/em64t Gentoo Linux. This procedure has been tested on at least one computer and it works. You can try to adapt the procedures on your platform if it is different from this as there are oracle 10g available for various other Linux architectures. This document is in flux and being updated to reflect installation procedures used for Oracle 10g R2 version 10.2.0.1.0 by various interested parties. The installation of Oracle 10g R2 provides many bugfixes useful for generic installations of 10g on non Oracle certified platforms that have been fixed since this howto was originally authored.

If you need the Oracle 10g R2 database software point your browser here:

External Link: Oracle Download Center

To install Oracle 10g R2 on x86 you need to download 10201_database_linux32.zip file available here:

10201_database_linux32.zip

To install Oracle 10g R2 on amd64 you need to download 10201_database_linux_x86_64.cpio.gz file available here:

10201_database_linux_x86_64.cpio.gz

Server Base Setup
Compute a cyclic redundancy check (CRC) checksum for the downloaded files and compare the checksum numbers against the numbers posted on OTN's website. For example:

After you have downloaded the software compute a cyclic redundancy check (CRC) and compare with the following numbers (are the same posted on Oracle OTN).

Should give you:

Should give you:

Should give you:

Now uncompress the files.

that will produce file(s) matching ship.db*cpio that you can unpack with

At this point open two distinct Console windows, one with root privilege and one with your user. The last one later becomes the oracle window. From this point forward execute the root and the unprivileged operations in these windows. Having said that, let's go!

Checking Your System Environment
Oracle needs this to work.

Hardware Requirements
* This value includes 1 GB (1048576 KB) of disk space required to install the Oracle Database 10g Products from the Companion CD (optional, but recommended).

Setting Swap Size
Oracle require a system that fit the following requirements:


 * At least 512MB of RAM
 * At least 1GB of swap space or twice the size of RAM

The general rule of thumb is your swap should double your amount of RAM. But if your not running the 64bit edition of Gentoo the maximum amount of swap you will be able to use is 2GB.

The swap space will not be utilized until the system runs out of physical memory. So don't configure too much swap space. Keep in mind that if the system starts using swap space, it has a negative impact to the performance of the database. So make sure that the system has always enough physical RAM and that it doesn't use swap space continuously.

If you don't have the required swap memory, don't worry, you can add a swap file in real time to your linux box as in the following example.

Checking /tmp space
The Oracle Universal Installer requires up to 400 MB of free space in the /tmp directory. If you do not have enough space in the /tmp filesystem, you can temporarily create a tmp directory in another filesystem. Here is how you can do this (/u01 is another filesystem)

When you are done with the Oracle installation, shut down Oracle and remove the temporary directory:

Setting /tmp variable
If, as per the above, Oracle requires extra /tmp space during installation, set environment variables in the oracle login window as follows:

Checking and Setting Shared Memory
Shared memory allows processes to access common structures and data by placing them in shared memory segments. It's the fastest form of IPC (Interprocess Communication) available since no kernel involvement occurs when data is passed between the processes. In fact, data does not need to be copied between the processes. Oracle uses shared memory segments for the SGA (Shared Global Area) which is an area of memory that is shared by all Oracle background and foreground processes. The size of the SGA has a major impact to Oracle's performance since it holds database buffer cache and much more.

To see all shared memory settings, run:

To see all kernel parameters, execute:

For Oracle10g, the following kernel parameters have to be set to values greater than or equal to the recommended values which can be changed in the proc filesystem.

To change this kernel parameters at every boot you have to add the following lines to the file

/etc/sysctl.conf additions

To become sure that the new added lines in become effective immediately (and every time), execute the following command:

Creating Oracle User Account
Oracle recommends using two separate groups that maintain the software and the database. In this scenario, the group membership prevents unauthorized access to the database by personnel who maintain the software, and it prevents the database administrators from making changes to the software and the installations inventory directory.

When using oinstall during the install of the software, one must set their default group to the one that will be maintaining the database before creating the database or permission problems will arise.

oinstall is not needed when the same people will be maintaining the software and the database. In this situation, it will create more work and add an extra layer of complexity to the maintenance of the installation.

Recommendation: if you don't need the oinstall group for added security, just install using the dba group.

To create the oracle account and groups, execute the following commands in the root window:

Maybe you want to give passwords to the users (in root window):

Creating Oracle Directories
In this example, make sure that the filesystem is large enough, see Requirement for more information. If is not on a separate filesystem, then make sure the root filesystem "/" has enough space.

Setting Shell Limits for the Oracle User
Most shells like Bash provide control over various resources like the maximum allowable number of open file descriptors or the maximum number of processes available to a user.

To see all shell limits, run:

Setting Limits for the Maximum Number of Open File Descriptors for the Oracle User
After you changed and increased (see: Checking Kernel Parameters), there is still a per user limit of open file descriptors which is set to 1024 by default:

...this will probably display

To change this, you have to edit the file as root and make the following changes or add the following lines, respectively:

/etc/security/limits.conf changes

The «soft limit» in the first line defines the number of file handles or open files that the Oracle user will have after login. If the Oracle user gets error messages about running out of file handles, then the Oracle user can increase the number of file handles like in this example up to 63536 («hard limit») by running the following command:

Note that we do not recommend to set the «hard limit» for nofile for the oracle user equal to .If you do that and the user uses up all the file handles, then the system would run out of file handles. This could mean that you won't be able to initiate new remote logins any more since the system won't be able to open any PAM modules which are required for performing a login. That's why we set the hard limit to 63536 and not to 65536.

You also need to make sure that pam_limits is configured in the file. This is the PAM module that will read the /etc/security/limits.conf file. The entry should read like:

Now login to the oracle account again since the changes will become effective for new login sessions only.

...should display 

Setting Limits for the Maximum Number of Processes for the Oracle User
To see the current limit of the maximum number of processes for the oracle user, run:

To change the "soft" and "hard" limits for the maximum number of processes for the oracle user, add the following lines to the file:

/etc/security/limits.conf changes

(Remark-AW: * means for every user, using user 'oracle' or group @ora and @oinstall should also work)

Make Settings Permanent
For the Bourne, Bash, or Korn shell, add the following lines to the, or in a new file.

(The first condition checks that user is oracle, to avoid setting ulimit for all users on that system that high.)

Setup Variables
Copy the file below to your file. You probably will not have one. That's ok. Just create it.

Don't forget to alter YOURSID with the SID, you're about to create when making your database. Once that's done and this value is altered in, you should do the following as root in order to make the startup script work properly.

This way, the variable configuration is kept in one single place and it is available in Oracles's interactive shell sessions.

Before we go to install, we should check all necessary software installed in a box. We need;
 * openmotif
 * gcc 3.4 or later
 * libXtst
 * xorg-x11 (not needed if you don't want to have an X server, but only use the client)
 * glibc=2.3.x (some oracle utils may require linuxthreads, glibc 2.4 supports only NPTL)
 * libaio.

Those are which i could detect so far by now. I will report the latest changes when installation succesful. Cheers

Installing Oracle10g
Ok. Now that our environment is set, we can start the installation. Switch to the root's window and execute this command

and then from your Oracle user

wait for the Oracle Universal Installer GUI to appear and leave the default values (recommended)

Running Installer
Do NOT run the last root script yet, otherwise the script will crash.

Delete the following two lines from root.sh:

$LNS $ID/init.cssd $rc/"$RC_START"init.cssd || { $ECHO $?; exit 1; } $LNS $ID/init.cssd $rc/"$RC_KILL"init.cssd || { $ECHO $?; exit 1; }

as well as the line:

$CP $CH/css/admin/init.cssd $ID/init.cssd

Now do the following:

cp /opt/oracle/product/10.1.0.3/css/admin/init.cssd /etc/init.d/init.cssd ln -s /etc/init.d/init.cssd /etc/init.d/S96init.cssd ln -s /etc/init.d/init.cssd /etc/init.d/K96init.cssd

Then edit the /etc/init.d/init.cssd file and change the line

SU='/bin/su -l'

to

SU='/bin/su'

NOTE: This is declared multiple times - change the occurance in the $PLATFORM case statement ( ~ line 82)

ln -s /opt/oracle/product/10.1.0.3/lib/libclntsh.so /opt/oracle/product/10.1.0.3/lib/libclntsh.so.10.1 ln -s /opt/oracle/product/10.1.0.3/lib32/naedhs.o /opt/oracle/product/10.1.0.3/lib/ ln -s /opt/oracle/product/10.1.0.3/lib32/naect.o /opt/oracle/product/10.1.0.3/lib/

Make sure that you:

a) Don't create a database as part of the install

b) Ignore any errors from relinking during installation

1. add the "pic" flag to your USE flags in /etc/make.conf

2. re-emerge glibc (Not 100% sure if this is necessary, but I did the rebuild)

3. Apply the patches below to various make files and to relink

4. run relink manually:

relink oracle

relink network

relink client

relink client_sharedlib

relink interMedia

relink ctx

relink utilities

relink sqlplus

relink ldap

5. Run dbca to create a new database. (Make sure to remove any references to Enterprise Manager when configuring the database)

{{Code|Patch for $ORACLE_HOME/bin/relink| --- relink.org 2005-01-12 18:05:59.061221392 -0500 +++ relink     2005-01-12 18:11:58.346601712 -0500 @@ -56,7 +56,7 @@ #-
 * 1) make sure ORACLE_HOME is set

-if [ x${ORACLE_HOME} = x ] -o [ ${ORACLE_HOME} = "" ]; +if [ x${ORACLE_HOME} = "x" ]; then echo "ORACLE_HOME is either unset or empty." exit 1 @@ -75,7 +75,7 @@ ARGUMENTS=" " USAGE="usage:\n\t$SCRIPTNAME $ARGUMENTS" HELPMESG="\nparameters: all, oracle, network, client, client_sharedlib,\ -         interMedia,\n\tctx, precomp, utilities, oemagent, ldap" +         interMedia,\n\tctx, precomp, utilities, sqlplus, ldap"

if [ $# -ne 1 ]; then @@ -89,10 +89,10 @@ #---
 * 1) check for valid parameter

-if [ $1 != "all" -a $1 != "oracle" -a $1 != "client" -a\ +if [ $1 != "all" -a $1 != "oracle" -a $1 != "sqlplus" -a $1 != "client" -a\ $1 != "client_sharedlib" -a $1 != "network" -a $1 != "interMedia" -a\ $1 != "ctx" -a $1 != "precomp" -a $1 != "utilities" -a\ -    $1 != "oemagent" -a $1 != "ldap" ] ; then +    $1 != "ldap" ] ; then echo "No valid parameter" echo $HELPMESG exit 1 @@ -196,8 +196,6 @@                 files="$ORACLE_HOME/rdbms/lib/ins_rdbms.mk" ;; sqlplus)                 files="$ORACLE_HOME/sqlplus/lib/ins_sqlplus.mk" ;; -        oemagent) -                files="$ORACLE_HOME/sysman/lib/ins_sysman.mk" ;; ldap)                 files="$ORACLE_HOME/ldap/lib/ins_ldap.mk" ;;         all) @@ -291,9 +289,9 @@    cleanup }

-oemagent { -   call_make $param "install" -   cleanup +sqlplus { +      call_make $param "install" +      cleanup }

all { }} Patch fro $ORACLE_HOME/rdbms/lib/env_rdbms.mk $ORACLE_HOME/rdbms/lib/ins_rdbms.mk

Now you can run the root.sh script.

Wait until the script finishes and prints output similar to this:

The root.sh script output

-- Note (AlFa - aleskx at yahoo dot com): this may fail and failure can be safely ignored - it is only needed if you want to use ASM (Automatic Storage Management) - if you are using normal database files for storage, you'll be fine without this step succeding. -

Now answer the default to the network Assistant and you have finished the installation. Congratulation!

Notes from "herbert < > fischer <> gmail.com" about Oracle 10g R2 for Linux:

10g R2 is much easier to install. There is no need to that CSS hacking above. The install flow is more linear.

You may have problems with OUI Inventory. After running the two "root scripts" and before clicking OK at OUI, change the owner and permissions of /etc/oraInst.loc to be accessible by oracle user, so, OUI can read the Inventory.

After finishing the install you may run ldconfig as root to see if there is empty libraries. I don't know if this empty libs affects Oracle, but I like to see things right. If there are empty libs, you may run "relink all" as oracle and "ldconfig" as root again. I had some symlinks related errors, so I deleted some files to ldconfig create the symlinks again.

I also suggest making a full backup of the installed oracle before creating the databases, so if you run with problems after some change you can consult the backup.

[10gR2 notes and may be for all oracle versions]

[START]

1) Before continuing, do vi /etc/oratab and see if there is a row of type: 'SID':'home/dir/of/the/database':N . Do not expect to see the same row as here :) If the last letter as N, as the example above, you may wish to change it to Y ,because after reboot your database wich has SID = 'SID', will not start. And if you try to login you will get the error:

ORA-01034: ORACLE not available

ORA-27101: shared memory realm does not exist

Linux Error: 2: No such file or directory

After I has done some research with Google I found out that this ERROR is very common thing not only for Oracle 10g, but also for lower versions. Of course the solution which I posted here is only in case you forget to run properly the database.

2)  And one more thing, in order to run your Oracle 10gR2 db, see the starting script "dbstart", which is provided along with the oracle installion, i.e. the script is automatically installed. You can find it in ${ORACLE_HOME}/10.2.0/bin/. I found strange row containing the path to the oracle listener, which was wrong and if your path is wrong too you most probably will wish to make it right. :) For me the wrong row path was: ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle. You may see where is your listener located with: type tnslsnr or locate tnslsnr but MOST probably "tnslsnr" is in ${ORACLE_HOME}/10.2.0/bin/.

3) For 10gR2 you can access the enterprise manager at http://localhost:1158/em/ You can start enterprise manager with: emctl start dbconsole

4) For 10gR2 you can access isql*plus at http://localhost:5560/isqlplus You can start isqlplus with: isqlplusctl start [END]

Automatically Start / Stop the Database and Listener
First of all edit the file /etc/oratab and change from this:

/etc/oratab

to that

/etc/oratab

Then to start automatically Oracle and the listner create this files

(Note (AlFa aleskx at yahoo dot com) dbstart and dbshut scripts have ORATAB pointing to /var/opt/oracle/oratab - this has to be changed to /etc/oratab) --- /etc/init.d/ora.database

/etc/init.d/ora.listener

file /etc/init.d/ora.console

Give the execute permission with

chmod +x /etc/init.d/ora.*

To start the Database automatically on Boot-Time, create or use our Startup Scripts dbora, lsnrora and consoleora. (The oracle installer already created an instance of these processes. Make sure they are not running before using these scripts.)

rc-update add ora.database default rc-update add ora.listener default rc-update add ora.console default

...and you have finished!

Test your Database
First You should create a user. The easiest way to do this is to use Oracle Enterprise Manager. In Your web browser type:

http://localhost:5500/em/

and login using user SYS and password provided during install (select also "connect as SYSDBA"). In “Security” section select “Users” and then create a new user.


 * For me this was at http://localhost:1158/em and I didn't have to type any username or password for some reason. 216.13.217.231 23:07, 22 November 2006 (UTC)

Now verify, that ORACLE environment variables are set and You can connect to database using sqlplus utility with:

sqlplus new_user/his_password

Then You can create some test table:

CREATE TABLE “test” (“id” NUMBER, “text” VARCHAR2(10));

make some inserts:

INSERT INTO “test” VALUES (1, ‘xyz’);

and selects:

SELECT * from “test”;

NetCA and ORA files
My instance would start when I created databases, but I couldn't restart them because it didn't create any .ora files. I finally found netca which will create all the necessary ora files so you can start the database with sqlplus. Just make sure your ORACLE_SID is set.

libaio problems
If you have problems getting iSQL Plus to work, and are getting errors about not being able to find /usr/lib/libaio.so.1 or errors stating version `LIBAIO_0.4' not found such as the example below oracle@gentoo-amd64 ~ $ sqlplus /nolog SQL*Plus: Release 10.2.0.1.0 - Production on Sun Apr 23 01:14:32 2006 Copyright (c) 1982, 2005, Oracle. All rights reserved. SQL> connect / as sysdba oracleGEN1: /usr/lib/libaio.so.1: version `LIBAIO_0.4' not found (required by oracleGEN1) ERROR: ORA-12547: TNS:lost contact

then you will probably need to install >=dev-libs/libaio-0.3.1 This is generally a problem with the 10.2.* release of Oracle 10g. There are now ebuilds available in portage for libaio for both x86 and x86_64 which provide the LIBAIO_0.4 symbol iSQL Plus requires to start correctly. Kerin Millar provides some insight at http://comments.gmane.org/gmane.linux.gentoo.server/2731

As root user:

echo "dev-libs/libaio ~*">>/etc/portage/package.keywords emerge -a libaio

iSQL Plus should now be able to launch without any problems.

Extra stuff to make Oracle 10g work on AMD64
Before the install, you need to add some extra packages, and compile glibc with a specific USE flag.
 * 1) put 'pic' into your USE flags or add pic to the USE flag in make.conf

USE="pic" emerge glibc binutils app-emulation/emul-linux-x86-baselibs app-emulation/emul-linux-x86-xlibs

18 Feb 06 Stephen Prendergast : - After the linker failed on relocation errors I realised that ld also needed to be rebuilt hence added binutils.

On first linker error from the installer, modify ${ORACLE_HOME}/lib32/stubs/libc.so from this: GROUP ( libc.so.6 /usr/lib/libc_nonshared.a ) to this: GROUP ( libc.so.6 /usr/lib32/libc_nonshared.a )

Don't Ignore other linker errors. Watch make.log in /opt/oracle/product/10.1.0.3/install/make.log and search for compiling errors. Most of them are from the "libc_nonshared" problem. Try to run the command that are on the make.log before the error. After running all of them, you can click on retry.

If Oracle Net Configuration Assistant does not runs during installation, run it with the user oracle and the command bellow:

${ORACLE_HOME}/bin/relink client_sharedlib netca

And as root: ldconfig -v

When the Database Config Assistant bails, do this as the oracle user:

vi /opt/oracle/product/10.1.0.3/network/admin/listener.ora Change to "(ADDRESS = (PROTOCOL = TCP)(PORT = 1521)(HOST = your_address))"
 * 1) Find (ADDRESS = (PROTOCOL = TCP)(PORT = 1521))*
 * 1) This might only be needed if your hostname does not appear in /etc/hosts or DNS

Hit retry yet again. All should be good.

Weblinks

 * Oracle Wiki's: English German
 * Oracle FAQ
 * Oracle 10g Documentation (engl.)
 * Oracle 9i Documentation (engl.)
 * Oracle 8i Documentation (engl.)
 * Oracle 7 Documentation (engl.)
 * Oracle Certification: OCP (engl.)
 * Oracle OCP 10g Certification (engl.)

Как я Установил ORACLE 10 r2 на Gentoo 2005.1