Shadow Command
Installing Oracle9i on FreeBSD
Documentation Revision 1.1
By Brian C. Ledbetter

Table of Contents

  2. Before We Begin
  3. Step 1: Prerequisites
  4. Step 2: Getting Oracle9i for Linux Distribution
  5. Step 3: Preparing The Installation Process
    1. Creating /compat/linux/etc/mtab
    2. Symlink /bin/awk, /bin/sed, /sbin/chown
    3. Create /compat/linux/bin/arch
    4. Configure SYSV Shared Memory
  6. Step 4: Creating The Appropriate User Accounts
  7. Step 5: Running The Installer
  8. Step 6: Oracle Universal Installer
  9. Step 7: Starting The Database
  10. Appendix A: Credits
  11. Appendix B: References
  12. Appendix C: System As Tested
  13. Appendix D: De-Installing Oracle
  14. Appendix E: Revision History

This document is here for informational purposes only. Because Oracle will not support running their products on FreeBSD, if you choose to do so, you will be operating outside of the scope of their Professional Services and Support team, and will get no help from them if something goes wrong. If you are only interested in using the Linux version of Oracle9i for eduational or testing purposes, just be aware that things might not work exactly as planned, and you just might lose all of your data. In any event, I cannot be held responsible for anything which might occur as a result of these instructions, and cannot stress enough that until such time as Oracle releases a native FreeBSD version of their products, you should never use this as a production system!

Neither BRIAN C. LEDBETTER, nor ORACLE CORPORATION claim any inherent responsibility with regards to the accuracy of the data contained within. All installations based upon these instructions are considered unsupported by ORACLE CORPORATION, and any damages caused by following these instructions may not be attributed to the information contained within. By following these instructions, you implicitly agree that you are doing so at your own risk, and accept the risks contained in performing this procedure.

Before We Begin
In the process of poking and prodding Oracle, I have devised a somewhat straight-forward (or, as close as I could get) installation procedure for running Oracle on Intel-based FreeBSD systems. By following these steps, you will end up with a working Oracle database installation, which should be safe for you to use for any kind of development purposes. I tested my database by installing the Oracle Marvel product (now called
HTMLDB) into the instance - everything worked fine. Many people on the freebsd-database mailing list have accomplished this task before I did. My goal here is simply to consolidate all of the excellent advice passed to me from the list into an easy-to-follow guide. Full credit will be listed below to those who helped me in my quest to bring the World's Best Database to the World's Best Operating System. It is also worth noting that my examples are for installing an Oracle 9i Database, not the entire Oracle9i Application Server suite. The instructions will be somewhat different for a 9iAS installation, due to the complexity of that product. I may provide instructions for installing 9iAS at a later date, if I can get 9iAS to work correctly.

Step 1: Prerequisites
Oracle9i requires certain features to be installed on your system before it will run. For instance, in order for the automated binary relinking tools to run, you must have Linux versions of ld and gcc installed. It is also a requirement that your system be running at least FreeBSD 5.0-RELEASE. It is advised that the following ports/packages are mandatory, and should be installed before continuing:

Listing 1. Ports required by Oracle 9i.

Step 2: Getting Oracle9i for Linux Distribution
Oracle has made the Linux version of their products available for download under the condition that the product not be used in a production environment unless it is purchased and licensed for production use. Because we can't guarantee that Oracle on FreeBSD will be stable enough for a production environment (even though I think it would work ok, there is no need to take unnecessary risks with your enterprise's data), this should not pose a problem. You may sign up for an Oracle Technology Network account to download the software at Pull down the software you wish to install (for instance, Oracle 9i Database, or Oracle 9i Application Server) and unpack the files into a staging directory.

bsdbox# mkdir -p /u01/stage /u01/app/oracle \
bsdbox# cd /u01/stage
bsdbox# gzcat \
	/path/to/lnx_920_disk1.cpio.gz | cpio -idmv
bsdbox# gzcat \
	/path/to/lnx_920_disk2.cpio.gz | cpio -idmv
bsdbox# gzcat \
	/path/to/lnx_920_disk3.cpio.gz | cpio -idmv
Listing 2. Extracting Oracle 9i.

Step 3: Preparing The Installation Process
You will need to make adequate disk space available for Oracle to run on. In an ideal production environment, you would allocate space from a SAN or RAID disk array for the various Oracle-recommended directories (/u01, /u02, etc). Because we're not able to be a supported production environment, you probably don't need to worry too heavily about this - you just need to make enough disk space available for Oracle to run in. I recommend having at least 3 gigabytes of space available for Oracle Database to use, with another 2 gigabytes for data files.

Because of the plethora of differences between Linux and FreeBSD, there are a significant number of workarounds which must be performed in order for this procedure to succeed. Here is a list of what I have found is necessary:

Create /compat/linux/etc/mtab

bsdbox# cat /etc/fstab | grep -v '^#' | grep -v cd9660 | \
	grep -v proc | grep -v swap | grep -v devfs > \
bsdbox# cat /compat/linux/etc/mtab
/dev/ad0s2a /      ufs rw 1 1
/dev/ad1s1  /u01   ufs rw 1 1
Listing 3. Creating mtab.

Symbolically link awk, sed, and chown into /compat/linux/bin
While this isn't as elegant as a patch, it's much easier for us to deal with. The patch method will still work, but I don't have the time or desire to hunt down all of the Linux-specific references in Oracle's scripts.

bsdbox# ln -s /usr/bin/awk /compat/linux/bin/awk
bsdbox# ln -s /usr/bin/sed /compat/linux/bin/sed
bsdbox# ln -s /usr/sbin/chown /compat/linux/sbin/chown
Listing 4. Workarounds.

Create /compat/linux/bin/arch

bsdbox# cat > /compat/linux/bin/arch
echo i686
bsdbox# chmod +x /compat/linux/bin/arch
Listing 5. More workarounds.

Configure SYSV Shared Memory and Semaphores
Oracle consumes quite a bit of memory whilst communicating amongst its many processes. Please refer to the Oracle Installation Guide for UNIX to determine the appropriate tuning values for your environment. You will need to build yourself a kernel with some additional parameters in order to make this work. Here is an example, which will build an Oracle-enabled GENERIC kernel. You would probably want to tune the kernel config file to suit your system's configuration. Please refer to
Section 9 of the FreeBSD Handbook for details on configuring your kernel.

bsdbox# cd /usr/src/sys/i386/conf
bsdbox# cat >> ORACLE
options         SEMMAP=128
options         SEMMNI=128
options         SEMMNS=32000
options         SEMOPM=250
options         SEMMSL=250
options         SHMMAXPGS=65536
options         SHMMAX=1073741824
options         SHMMNI=4096
options         SHMSEG=4096
options         MAXDSIZ="(1024*1024*1024)"
options         MAXSSIZ="(1024*1024*1024)"
options         DFLDSIZ="(1024*1024*1024)"
bsdbox# config ORACLE
Kernel build directory is ../compile/ORACLE
Don't forget to do a ``make depend''
bsdbox# cd ../compile/ORACLE
bsdbox# make depend install
Build output
bsdbox# reboot
(System reboots)
Listing 6. Configuring your kernel.

Step 4: Creating The Appropriate User Accounts
Oracle recommends that all products be installed into a restricted user's account, to help prevent security issues. We will be creating a user account and set of groups to represent various Oracle standards on our host. In my installation, I call the user oracle, the "installation" group oracle, the "system DBA" group oradba, and the "system operator" group oraoper. You may adjust these to reflect your personal tastes, or may adjust them to conform to the Oracle recommended names.

Start by creating the necessary groups.

bsdbox# cat >> /etc/group
Listing 7. Creating groups.

Now, create the Oracle user account. We will be using this shortly.

bsdbox# adduser
Username: oracle
Full name: Oracle Superuser
Uid (Leave empty for default): 99
Login group [oracle]: <enter>
Login group is oracle. Invite oracle into other groups? []: <enter>
Login class [default]: <enter>
Shell (sh csh tcsh ksh mudsh) [sh]: <enter>
Home directory [/home/oracle]: <enter>
Use password-based authentication? [yes]: <enter>
Use an empty password? (yes/no) [no]: <enter>
Use a random password? (yes/no) [no]: no
Enter password: <some password>
Enter password again: <some password>
Lock out the account after creation? [no]: no
... OK? (yes/no): yes
adduser: INFO: Successfully added (oracle) to the user database.
Add another user? (yes/no): no
Listing 8. Creating user.

Ensure that the Oracle user owns your installation path, and create a profile containing your system's ORACLE_HOME and ORACLE_SID. I will use the SID "ORACLE" as an example here. You will want to change this to something which reflects the use your database instance will be assigned to.

bsdbox# mkdir -p /home/oracle
bsdbox# chown -R oracle:oracle /u01 /u02 \
bsdbox# cat > /home/oracle/.profile
PS1='oracle-bsd> '

bsdbox# chown oracle /home/oracle/.profile
Listing 9. Creating user.

Hostname may need to be set in /etc/hosts
If your system's hostname is not resolvable via DNS, you MUST add it to /etc/hosts. Failing to do so could cause problems later in the install.

bsdbox# echo "" >> /etc/hosts
Listing 10. /etc/hosts.

Step 5: Running The Installer
At this point, we are ready to run the installation program. One thing to watch for during this phase of the installation is the root installation scripts that Oracle prompts you to run. Be careful that you remember to run them from the Linux-mode bash shell, instead of FreeBSD's /bin/sh. This ensures that the script executes in a more Linux-like environment than is normally provided by your system. Failing to do this may cause the script to encounter errors due to some inherent differences between Linux and FreeBSD.

If you are installing Oracle on a remote system, it is best if you run Oracle Universal Installer from within an Xvnc session. This is due to the amount of traffic generated by the GUI installer, which seems to want to redraw its graphics very frequently.

(Notice: Oracle's installer will not work unless you are running within an X11R6 session. Make sure that you've logged into X, and that you have allowed local users to connect to your display. Also note that OUI launches into the background here. This is the normal operation, for some strange reason.)

bsdbox# xhost +local:oracle
bsdbox# su - oracle
oracle-bsd> export DISPLAY=:0
oracle-bsd> cd /u01/stage/Disk1
oracle-bsd> ./runInstaller
oracle-bsd> Initializing Java Virtual Machine from
Please wait...
Listing 11. Launching OUI.

Keep a root-prompt window handy. Oracle will request that you run two scripts during the installation process, /tmp/ and $ORACLE_HOME/oracle/ Please keep in mind, when you use the Linuxulator's bash instead of /bin/sh, the files created by the shell script will reside underneath /usr/compat/linux.

If your installer just disappears at a random point during the installation, check the /tmp/OraInstall* directory for *.err and *.out files. Every time I had a random disappearing installer, it was due to a missing /compat/linux/etc/mtab file.

If your hostname is not resolvable, you will get a large number of "Could not determine IP address" errors. It is possible to skip over these by continuing to press "Continue," but it is not recommended that you do that. Be sure that your computer is listed in /etc/hosts and re-start the installation program.

Step 6: Oracle Universal Installer
Once OUI has finished starting, the following window - the Welcome screen - appears. Hit "Next" on this screen to continue the installation process.

The Welcome Screen
Figure 1. Welcome to OUI.

The first time that OUI is run on your system, you will be prompted to specify a location to install the Oracle Inventory. This directory does not have to exist, but you need to make sure that the oracle user has full write privileges on the parent directory, as OUI will install additional directories alongside the oraInventory directory.

Oracle Inventory Location
Figure 2. oraInventory.

The next screen will prompt you to enter the Oracle installation group. Users who are a member of this group will be allowed to add and remove Oracle products using Oracle Universal Installer. On our installation, we will use the oracle group to do this.

Oracle Installation Group
Figure 3. Oracle group.

After entering the installation group, you will be prompted to run the /tmp/ script.

bsdbox# /compat/linux/bin/bash /tmp/
Creating Oracle Inventory pointer file (/etc/oraInst.loc)
Changing groupname of oraInventory to oracle.
Listing 12.

Next, you will need to specify the installation path for your Oracle Home.

Select Oracle Home
Figure 4. ORACLE_HOME.

After this, you will be prompted to select a product to install. Select "Oracle Database" and hit "Next". The next screen will prompt you to select an installation type. You are welcome to select any option here you like, but because FreeBSD is not really production-ready, it is probably better to do a minimal install. This can be accomplished by selecting "Custom", and deselecting all of the options on the next screen.

Minimal Installation
Figure 5. Keeping it Simple.

When OUI prompts you for the privileged groups, enter "oradba" for the OSDBA group, and "oraoper" for the OSOPER group. Users who are in the oradba group will be allowed to startup and shutdown the database, whereas users in the oraoper group are granted lesser privileges.

Figure 6. Oracle groups.

When OUI asks if you want to create a database, what it means is "Would you like for me to run Oracle Database Creation Assistant as a part of the install process?" If you want to use the GUI tool to create a database, select "Yes," otherwise select "No" and manually create your database (or run dbca later). You will eventually get to the Summary screen, from which our adventure will begin!

Figure 7. Summary.

Once the installation and linking process has been completed, you will be prompted to run the script. Here is how it should be done on FreeBSD:

bsdbox# /compat/linux/bin/bash \
Running Oracle9 script...
\nThe following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /u01/app/oracle/product/

Enter the full pathname of the local bin directory:
[/usr/local/bin]: <ENTER>
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

\nCreating /etc/oratab file...
Adding entry to /etc/oratab file...
Entries will be added to the /etc/oratab file as
needed by Database Configuration Assistant when
a database is created
Finished running generic part of script.
Now product-specific root actions will be performed.
Listing 13.

Once has been run, the post-install processes will begin to execute. The first process run is the Oracle Network Configuration Assistant. Check the "Perform typical configuration" box on this wizard and click "Next."

Network Configuration Assistant
Figure 8. netca.

After the Network Configuration Assistant closes, OUI will launch the Database Configuration Assistant - but only if you elected to create a database during the installation process. Even if you don't want to run the entire DBCA process now, you can have it create a set of SQL scripts which you can run later. I'm not going to explain DBCA in depth - much more verbose documentation can be found on Oracle Technology Network.

Database Configuration Assistant
Figure 9. dbca.

At this point, the installation is completed! If DBCA created your database, you should be able to connect to it now. If not, look in the next section for a brief set of dummy database creation scripts that you can run, just to make sure that your ORACLE instance is working.

Installation Complete
Figure 9. Done!

Step 7: Starting The Database
If you chose to create a database using DBCA during the installation process, your database will be started and running when the process has completed. If not, you will need to either use DBCA to create a new database, or use a set of your own database creation scripts.

To see if ORACLE will cooperate with you, try running SQL*Plus.

oracle-bsd> sqlplus '/ as sysdba'

SQL*Plus: Release - Production on Wed
Aug 20 12:02:07 2003

Copyright (c) 1982, 2002, Oracle Corporation.
All rights reserved.

Connected to an idle instance.

Listing 14. Running SQL*Plus.
If this command fails, here are the most common reasons:

  • ORA-01031: insufficient privileges
    Your user account is not a member of the OSDBA group. If you are logged in as "oracle," but still get this error, check to make sure that you are a member of the appropriate groups using the "id" command.

  • Message file sp1.msb not found
    Be sure that $ORACLE_HOME is set.

  • Library "" not found
    In rare cases like this, you may need to define LD_LIBRARY_PATH=$ORACLE_HOME/lib in your .profile to link the shared libraries properly.

(Obviously, please refer to Oracle Technology Network, Tom, and the "Other" manual if you encounter problems not listed here.)

Notice the message Connected to an idle instance. As anyone who has seen Oracle before will know, this indicates that my Oracle instance (which I configured to be called "ORACLE") is not running. In my case, it indicates further that my instance does not exist. I will fix this by running a database creation script, created by DBCA, on my system. Rather than list out the whole (rather long) thing, I have provided a tarball (download here) of these scripts which you can run on your own system, and will only list the bare essentials of the output here.

oracle-bsd> cd /u01/app/oracle/admin
oracle-bsd> tar xzf dbca-ORACLE.tgz
oracle-bsd> cd ORACLE/scripts
oracle-bsd> ORACLE_SID=ORACLE; export ORACLE_SID
oracle-bsd> sh
Listing 15. Using my database scripts to create your database.
If the above process fails (you'll see it scroll by quickly without any pauses - look more closely, and you'll probably see the message "ORACLE not available"), you can try a more manual process like the one below:

oracle-bsd> sqlplus '/ as sysdba'

SQL*Plus: Release - Production on Wed
Aug 20 13:19:02 2003

Copyright (c) 1982, 2002, Oracle Corporation.
All rights reserved.

Connected to an idle instance.

ORACLE instance started.

Total System Global Area  114364796 bytes
Fixed Size                   450940 bytes
Variable Size              88080384 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
DATAFILE '/u02/oradata/ORACLE/system01.dbf'
   SIZE 250M
   NEXT 10240K
TEMPFILE '/u02/oradata/ORACLE/temp01.dbf'
   SIZE 40M
   NEXT 640K
DATAFILE '/u02/oradata/ORACLE/undotbs01.dbf'
   SIZE 200M
   NEXT 5120K
   GROUP 1
      SIZE 102400K,
   GROUP 2
      SIZE 102400K,
   GROUP 3
      SIZE 102400K;
Listing 16. Doing things the hard way.
Common Errors
Here are some errors I have encountered:

  • ORA-27102: out of memory
    If your SYSVSHM kernel settings are configured correctly, this error will be due to excessive sizes in your init.ora file. Try reducing the number of processes, and some of the buffer sizes that make up the SGA.

  • LRM-00109: could not open parameter file '...'
    Your init.ora file could not be found. Make sure it exists in the location you specified.

  • ORA-07446: sdnfy: bad value '...' for parameter user_dump_dest.
    Make sure the directory specified in this error message exists.

Testing Things Out
You may want to test starting up and shutting down your database to ensure that things are working correctly. Do something like this:

oracle-bsd> sqlplus '/ as sysdba'

SQL*Plus: Release - Production on Wed
Aug 20 13:19:02 2003

Copyright (c) 1982, 2002, Oracle Corporation.
All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release
- Production
JServer Release - Production

Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.

Total System Global Area  114364796 bytes
Fixed Size                   450940 bytes
Variable Size              88080384 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
Listing 17. Doing things the hard way.

Is that the smell of success? Naw, it smells more like my processor burning itself up running this Oracle instance! If these commands ran correctly, your database should be up and running normally. At this point, you can load your database applications of choice into the system!

Assuming my next experiment goes well, I hope to have an installation guide similar to this for Oracle 9i Application Server soon. If you don't hear from me for a while, just drop me an e-mail, and I will let you know how it is going. In any event, I hope this document was useful for you! I would love to hear your feedback on the items contained here - if something didn't work for you, let me know, and I will see if I can help you work through it. Of course, if you did find the document helpful, and everything worked, I would still love to hear what you think! Feel free to e-mail me, either way.

Until later,

Brian C. Ledbetter

Appendix A: Credits
Many heartfelt and gracious thanks to the following people for their assistance with getting my Oracle 9i instance to work - without their help, I would never have gotten this figured out:

  • Berend de Boer <>
  • Valery V.Chikalov <>
  • Roberto Nunnari <>
  • Georg-W. Koltermann <>

Appendix B: References
I found the following information useful during this experiment. I trust that you will find it equally excellent.

  1. HOWTO: Oracle for Linux on FreeBSD
    This document covers Oracle8i. I used this successfully back in 1999, and hope to create a similar experience with this document.

  2. Oracle Installation Guide for UNIX
    Look here for good tuning tips and other information. An OTN account is required, and freely available.

  3. FreeBSD Handbook: Installing Oracle
    Contains much of the information from the above, but in a more concise format.
  4. The freebsd-database list
    This is where I go for help.

  5. Running Oracle on Freebsd
    In Russian, but helpful nonetheless.

Appendix C: System As Tested
This has been tested successfully on a 5.1-RELEASE system.

Appendix D: De-Installing Oracle
Once you have finished playing with Oracle, and want to remove it from your system, there is an easy way to do this. While the obvious is to simply remove the /u0* directories and everything in them, Oracle has actually placed some files in non-intuitive locations which will need to be deleted also. Assuming you followed these procedures exactly, this is what you will do:

bsdbox# rm /compat/linux/etc/oratab
bsdbox# rm /compat/linux/etc/oraInst.loc
bsdbox# rm /usr/local/bin/*ora*
bsdbox# rm /usr/local/bin/dbhome
Listing 18. Cleaning up.

Side Note: Oracle 10g
I have performed an installation of Oracle 10g on a FreeBSD 5.1 system, and from what I have seen so far, the process is much smoother. Using the Blackdown JDK 1.3.1, instead of the Sun JDK, I was able to install and run all of the basic 10g tools without any errors or fiddling with the configuration. Pretty exciting stuff! I hope to post documentation on this before too long, although from the looks of things, it will be a much simpler process than the 9i process.

Appendix E: Revision History
Revision 1 September 2002
Initially wrote this document while trying to get Oracle 9i to boot on a 4.8-RELEASE box. Gave up trying to get it to work, and shelved the document indefinitely.
Revision 1.1 August 2003
After hearing reports in March of people who have gotten 9i working on a 5.0-RELEASE system, I played around with it some, but was unable to get it working. After waiting for a while, I finally e-mailed the freebsd-database list, and got the final bit of assistance that I needed, and finished writing the document. Finally.
Revision 1.1.1 November 2003
Added an initial note about my experience in using Oracle 10g under FreeBSD. Hopefully, a followup document will be here soon!

Copyright © 2002, ShadowCom Consulting Group