Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
Installing
and Configuring Oracle on the Linux Platform
Roger Schrag
Database Specialists, Inc.
Introduction
This document will walk you through the steps of installing Oracle 8i
Enterprise Edition release 3 (Oracle version 8.1.7) or release 2 (8.1.6) in a
Linux environment. Everything you read in this document is hands on,
roll-up-your- sleeves-and-get-busy material for Oracle users who want to get an
Oracle database up and running quickly, but want the database to be scalable and
to perform well.
These steps are meant to get you up and running as quickly as possible, while
leveraging best practices in order to set up a scalable, robust database
environment that offers high performance. I ran my Oracle installations on a
server running Red Hat 6.2 Linux with a 2.2.16 kernel. However, Oracle’s
publications indicate that other distributions and versions of Linux are also
supported.
Oracle 8i releases 2 and 3 both install very smoothly on Linux. If you also
have a copy of Oracle version 8.0.5 or Oracle 8i release 1 (version 8.1.5) lying
around and you are wondering which version of Oracle to go with, the answer is
simple. Do not waste your time with Oracle version 8.0.5 or Oracle 8i release 1
for Linux. I’d recommend you install release 3 because it has several new
features, but release 2 is also very solid.
Please note: Oracle 8i release 3 on Linux now supports the Oracle Parallel
Server option for high availability and scalability. OPS implementation is quite
complex and will not be covered here.
There are four phases to getting Oracle up and running on your server:
- Prepare the server
- Install the Oracle software and create a simple database
- Create a scalable Oracle database (optional)
- Complete the server configuration
We will walk through these phases one at a time, detailing all the steps
involved. The end result will be a very usable database that can be scaled up
quite large. Of course, every implementation is unique, and you will need to
evaluate each step carefully against your particular requirements. However, this
document will get you off to a very solid start.
Prepare the Server
These steps configure your machine so that it will be ready to accept the
Oracle software and database. In this section, we will make sure the operating
system meets Oracle’s minimum requirements, create a Unix user and group to
“own” the software, and create some directories that will be used by the Oracle
software and database. All of the steps in this section are run as the root
user.
- Make sure that your Linux system is supported. You must have a 2.2 kernel,
GLIBC 2.1, and a supported Linux distribution. According to Oracle Support as
of March 2001, the supported Linux distributions are as follows:
Supported Linux Distributions For Oracle 8i release 2
(8.1.6) |
Red Hat 6.0 |
Red Hat 6.1 |
Red Hat 6.2 |
Red Hat 6.2 EE |
VA Linux 6.2 |
SuSE 6.3 |
SuSE 6.4 |
SuSE 7.0 |
TurboLinux 6.0 |
Miracle Linux 1.0 |
Caldera eServer 2.3 | |
Supported Linux Distributions For Oracle 8i release 3
(8.1.7) |
Red Hat 6.2 |
Red Hat 6.2 EE |
SuSE 7.0 |
TurboLinux 6.0 |
TurboLinux 6.0.5 |
TurboLinux 6.1 |
Miracle Linux 1.0 | |
I installed Oracle 8.1.7.0.1 and 8.1.6.1.0 in a Red Hat 6.2 environment; I
cannot vouch for the other distributions.
- You will need to perform the installation from an X window environment.
You cannot perform the installation from a character mode environment such as
a telnet or ssh session. There is a facility for performing non-interactive
installations, but we won’t be covering that technique here. Besides it
appears that even the non-interactive install still needs access to X
libraries. Your X environment can be the console on the database server, but
it does not need to be. You can also use a Windows X emulator like Hummingbird
Exceed, but see Oracle's release notes for possible issues with Hummingbird
Exceed.
- Make sure that your hardware is sufficient. You’ll need at least 128 Mb
RAM (but 256 Mb is recommended), a CD ROM drive, a swap space of at least 400
Mb or twice RAM (whichever is larger), and a bare minimum of 1000 Mb of disk
space for Oracle 8i release 2 and 1500 Mb for Oracle 8i release 3. This will
let you perform a “typical” software installation and create a simple database
for prototyping. A real implementation will almost always require more RAM and
more disk space.
- Make sure that the following executables exist in the /usr/bin directory:
make, ar, ld, and nm.
- Make sure that the Linux kernel has parameters set sufficiently high for
Oracle. The Oracle architecture makes extensive use of shared memory segments
for sharing data among multiple processes and semaphores for handling locking.
The relevant kernel parameters are set in the following two files:
/usr/src/linux/include/asm/shmparam.h
/usr/src/linux/include/linux/sem.h
Some sample settings to get you started are as follows:
Kernel Parameter |
Setting To Get You Started |
Purpose |
SHMMAX |
33554432 |
Maximum size of a single shared memory segment |
SHMMIN |
1 |
Minimum size of a single shared memory segment |
SHMMNI |
100 |
Maximum number of shared memory segments in entire system |
SHMSEG |
100 |
Maximum number of shared memory segments one process can
attach |
SEMMNS |
2000 |
Maximum number of semaphores in entire system |
SEMMSL |
250 |
Maximum number of semaphores per set |
SEMMNI |
512 |
Maximum number of semaphore sets in entire system |
SEMOPM |
100 |
Maximum number of operations per semop call |
SEMVMX |
32767 |
Maximum value of a semaphore |
The first four kernel parameters configure shared memory segments. The
recommended settings shown here should be appropriate for almost any Oracle
database implementation. The SHMMAX setting may seem low, but Oracle will use
multiple segments if needed, and there is no real penalty to be paid for this.
The last five kernel parameters configure semaphores. Each Oracle instance
requires one semaphore for each process, plus ten extras. Additionally, the
largest instance requires a second semaphore for each process. If you will
only be setting up one database on your server, the upshot is that you will
need two semaphores for each process plus ten extras.
The recommended settings for the first two semaphore kernel parameters,
SEMMNS and SEMMSL, should be appropriate for most Oracle implementations. For
systems with very large numbers of concurrent database connections, you may
need to increase these values. The SEMMSL setting may seem low, but Oracle
will use multiple semaphore sets if needed, and again there is no real penalty
to be paid for this. The recommended settings shown here for the last three
semaphore kernel parameters should be appropriate for just about any Oracle
database implementation.
In general, if your Linux kernel already has any of these parameters set
larger than recommended here, you should not reduce the settings. If you do
change any kernel parameter settings, then rebuild the kernel and reboot the
server so that the new settings will take effect.
I left all of the kernel parameters on my server at the default Red Hat 6.2
settings. The only dubious thing about doing this is that SEMOPM on Red Hat
6.2 defaults to 32, whereas Oracle requires this parameter be set to 100.
Although Oracle does seem to work fine with SEMOPM set to only 32, I will
recompile the kernel at some point and bump it to 100. I recommend you do the
same.
- Oracle 8i release 3 has an integrated Apache HTTP server that will be
installed at the same time as the Oracle software. Apache requires JDK 1.1.8.
You must install a JDK 1.1.8 on your database server before installing Oracle
8i release 3. Oracle recommends that you use IBM's JDK, available at .http://www.ibm.com/java/jdk/118/linux.
(Although the Oracle Installation Guide for Linux says to use JDK 1.2.2 from
Sun, you should use JDK 1.1.8 from IBM as the release notes say.) I installed
the JDK in /usr/jdk118 on my database server, but you can install it wherever
you want.
Note that you can skip this step if you will be installing Oracle 8i
release 2.
- Create a Unix group that will be used by the Oracle software owner and
database administrators. You can call it anything you like, but the standard
is “dba”. If you will be installing Oracle on multiple servers on your
network, you might want to keep the groupid the same on all servers. You can
create your dba group with a command like:
groupadd -g 300 dba
- Create a Unix group that will be used by the Oracle software owner. You
can call it anything you like, but the standard is “oinstall”. If you will be
installing Oracle on multiple servers on your network, you might want to keep
the groupid the same on all servers. You can create the oinstall group with a
command like:
groupadd -g 301 oinstall
- Create a Unix user that will be the Oracle software owner. You can call it
anything you like, but the standard is “oracle”. If you will be installing
Oracle on multiple servers on your network, you might want to keep the userid
the same on all servers. Note that this user’s home directory will not be the
ORACLE_HOME or where the actual Oracle software is installed; this user’s home
directory should be in the same place as other users’ home directories. You
should make oinstall the primary group and dba the secondary group. You can
create your oracle user with commands like:
useradd -c 'Oracle software owner' -d /home/oracle -g oinstall \
-G dba -m -u 300 -s /bin/bash oracle
passwd oracle
- For Oracle 8.1.7 installations only, create a Unix group and user that
will be used by the Apache HTTP server. Running the Apache HTTP server as the
Oracle software owner or a member of the dba group can compromise security.
You can call the group and user anything you like. At this time there seems to
be no clear standard for what to call the group and user. You can create your
group and user with commands like:
groupadd -g 302 orapache
useradd -c 'Oracle Apache user' -d /home/orapache -g orapache \
-m -u 301 -s /bin/bash orapache
passwd orapache
- Create mount points for the Oracle software and the Oracle database. Each
mount point should correspond to a separate physical device or set of devices.
You’ll need at least one mount point. Typically you use one mount point for
the Oracle software and as many as you can afford for each database. (More
physical devices allow better performance.) A nice convention is to call the
mount points /u01, /u02, and so on. Because mount points are typically owned
by root and the Oracle installer will run as the oracle user and not root, you
should create some subdirectories now to avoid permissions problems later.
Create an app subdirectory below the software mount point, and oradata
subdirectories below the mount points to be used for databases. (You can put
software and a database on the same mount point if you wish.) Make these
subdirectories owned by the oracle user and dba group, and give them 755
permissions.
- Choose a directory that the Oracle software will refer to as the “local
bin” directory. A common choice is /usr/local/bin, and your installation will
go more smoothly if you stick with this choice. Make sure this directory is on
users’ path by default.
- If you downloaded a trial version of Oracle off of the internet, then
untar the distribution. If you have the software on CD ROM, then mount the CD
ROM now. If you don’t have an automount daemon, you can mount the CD with a
command like:
mount -r -t iso9660 /dev/cdrom /mnt/cdrom
Install the Oracle Software
and Create a Simple Database
These steps install the Oracle software on your server and create a simple
“starter” database. Later you’ll have the option of blowing away this starter
database and replacing it with a robust, scalable database built for
performance. In this section, we will prepare the oracle user’s environment, run
the Oracle installer, and tidy up a few minor loose ends. All of the steps in
this section, except where noted, are run as the oracle user.
- Edit the oracle user’s login file on the database server so that the
environment will be configured automatically on login. If you are using Bourne
or Korn shell, then edit .profile. If you are using Bash, then edit the
.bash_profile file. You can also use C shell and edit .cshrc, but the syntax
will be different from the examples you see here. For now, we will hardcode
certain things. But after the Oracle software is installed we will come back
and eliminate all hardcodings. Here is what I added to my .bash_profile for an
8.1.7 install:
umask 022
# Substitute your Oracle software mount point in the line below.
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/8.1.7
export ORACLE_DOC=$ORACLE_HOME/doc
# Substitute the name of your Oracle database below.
export ORACLE_SID=DEMO
# Following line is only required for 8.1.6 installs where
# a character set other than 7-bit ASCII will be used.
# export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
# Following line is not required if you’ll be using the
# default character set, 7-bit ASCII. To use another character
# set, see the Oracle8i National Language Support Guide for a
# list of supported character sets and how to set NLS_LANG.
export NLS_LANG=american_america.UTF8
# Fill in the following line as you wish, but make sure that
# $ORACLE_HOME/bin, /usr/bin, /etc, /bin, and your local bin
# directory (usually /usr/local/bin) are all in the PATH.
export PATH=...
# Ensure that TWO_TASK is not set.
unset TWO_TASK
- Log out and log back in as the oracle user from an X window so that the
environment is set correctly.
- Set your DISPLAY variable to the IP address of your X server plus the X
server and screen numbers. If you are working from a workstation (and not the
console of the database server where you are installing Oracle) do not
accidentally set the DISPLAY variable to the IP address of your database
server. I set my DISPLAY variable as follows:
export DISPLAY=myworkstation:0.0
- If you are not using the console of the database server, then ensure that
the X server on your workstation will allow your database server to open
windows on your display. The easiest way to do this is to issue an xhost
command from a session on your workstation. (Don’t get confused and issue the
command in a window that is logged onto your database server.) You can issue a
command like:
xhost +mydatabaseserver
- Use ftp to transfer a small file from your database server to a remote
host to prove to yourself that TCP/IP networking is installed, configured, and
working properly.
- Ensure that the mount points you designated for the Oracle software and
starter database have sufficient free space. The starter database will be
created entirely on one mount point. For an Oracle 8.1.6 installation, allow
550 Mb for the software mount point and 450 Mb for the database mount point as
bare minimums. For an Oracle 8.1.7 intallation, allow 1500 Mb for the software
mount point as a bare minimum. (With Oracle 8.1.7, the starter database is
automatically created on the software mount point; you do not get to specify a
separate mount point for the starter database.)
- Double check that you are logged in as oracle and not root. Then start the
Oracle installer with these commands:
cd /mnt/cdrom
./runInstaller
We’ll walk through the installer prompts one at a time:
- The Welcome window appears. Click Next.
- The File Locations window appears. Leave the Source field unchanged. The
Destination field will show the ORACLE_HOME value you set in your
environment. Change the mount point now if you don’t like what you see, but
don’t change the app/oracle/product/8.1.7 or .../8.1.6 part. Click Next.
- If this is the first time you are installing Oracle 8.1.6 or later
software on the database server, then the Unix Group Name window appears.
Enter oinstall and click Next. If your /etc directory is not writable by the
oracle user, you will be asked to run a short script as the root user to
create an oraInst.loc file in /etc. This script is simple and harmless. (You
won’t see the Unix Group Name window the next time you run the installer
because Oracle saves this information in the /etc/oraInst.loc file.)
- The Available Products window appears. Choose Oracle 8i Enterprise
Edition 8.1.7.0.1 or 8.1.6.1.0 and click Next.
- The Installation Types window appears. We will perform a “typical”
install to get a basic set of Oracle software installed and a starter
database. You can rerun the installer again later and choose Custom to
install additional products individually. For now, choose Typical and click
Next. If you get an error that Oracle cannot determine the IP address of
your server, then make sure your server has an entry in the /etc/hosts file
and click Retry.
- For Oracle 8.1.7 installations, the Choose JDK Home Directory window
appears. Oracle needs to know where the JDK 1.1.8 is located because the
Apache HTTP server needs this. Enter the path of the JDK 1.1.8 that you
installed earlier, such as /usr/jdk118. Click Next. You will not see this
window during Oracle 8.1.6 installations.
- If you have any existing Oracle databases on your server that are at a
version prior to what you are now installing, the installer will ask if you
would like to run the Data Migration Assistant at the end of the
installation to migrate or upgrade these older databases to the newer
version. Make your decision and click Next. (We won’t be covering the Data
Migration Assistant here, but I will mention that the release notes for
Oracle 8.1.6 indicate the Data Migration Assistant is unable to upgrade
8.0.5 databases to 8.1.6; you must export and import instead.)
- The Database Identification window appears. You need to specify both a
global database name and an SID (instance name) for the starter database
that will be created. The SID will default to the setting of the ORACLE_SID
environment variable, but you can override it here if you wish. You should
give your database a global name that is the same as the SID, with your
domain name appended. Click Next.
- During Oracle 8.1.6 installations, the Database File Location window
appears. Enter the name of one of the mount points you chose for holding
your database. The starter database will have all of its files in one
directory under this mount point. This is not a good design for high
performance and availability, but is fine for a simple starter database.
Click Next. (You will not see this window during an Oracle 8.1.7
installation because the installer will automatically place all of the
starter database files in one directory under the ORACLE_BASE. Again: not
good design, but okay for a simple starter database.)
- During Oracle 8.1.6 installations, the installer may open an error
window indicating that it cannot write to the mount point you specified.
This is poor judgement on the part of the installer because you have already
created the oradata directory under the mount point and you have made the
oradata directory writable by oracle. If you get this error window then open
another window, log in to the database server as root, temporarily chmod 777
the mount point, click OK in the installer error window, click Next again on
the Database File Location window, and then put the permissions on the mount
point back to what they were before—usually 755.
- The Summary window appears. Review all of the selections you have made
to confirm they are correct. Click Install.
- During the installation a Setup Privileges window will appear. The
installation will be paused at this point, waiting for you to run a script
as root. The script will be called root.sh and can be found in the
ORACLE_HOME directory. You should open another window, log in to the
database server as root, review the root.sh script thoroughly, run the
script, and click OK in the Setup Privileges window. Note that in previous
versions of Oracle including 8.0.5 and 8.1.5, this root.sh script was a
security risk and experienced Oracle professionals would recommend you
dissect the script and run the important parts manually. I’m happy to report
that the root.sh script in 8.1.6 and 8.1.7 appears to be safe, but you
should review it thoroughly and make your own judgement call before running
it.
- A Configuration Tools window appears some time later and the Net8
Configuration Assistant launches to configure networking so that your
database will be able to accept requests from remote clients. During Oracle
8.1.6 installations no action is required on your part, and this step
completes quickly. During Oracle 8.1.7 installations, a Welcome window
appears and you are presented with installation options. Choose “Perform
typical installation” and click Next.
- The Database Configuration Assistant launches to create a starter
database. No action is required on your part. A progress window will show
you how the database creation is going. When database creation is complete,
an alert window will appear that shows you the initial passwords to the SYS
and SYSTEM database users. Click OK.
- During Oracle 8.1.7 installations, the Apache HTTP server will now
start. No action is required on your part, and this step completes quickly.
- The End of Installation window appears. You may click Exit to exit the
installer or Next Install to begin another installation. You might click
Next Install, for example, to perform a custom installation to install
individual products that did not get installed as part of the “typical”
installation—such as Pro*C/C++.
- It is important to note that the “typical” install loads certain extra
cost options, such as table partitioning, onto your database server. If you
are not licensed to use these options, then you should deinstall them. To
deinstall products, click the Deinstall Products button on the Welcome
window.
- Exit the installer when you have completed installations and
deinstallations.
- In $ORACLE_HOME/bin you will find a shell script called oraenv. This
script can be called from .profile or .bash_profile to set up a user’s
environment. Unfortunately, there are a few variables that the script does not
set— some handy, some very important. Make a backup copy of the script and
then edit it, adding the following lines to the very end:
# Begin customizations
ORACLE_BASE=`dirname $ORACLE_HOME`
ORACLE_BASE=`dirname $ORACLE_BASE`
DBA=$ORACLE_BASE/admin
# Following line is only required for 8.1.6 installs where
# a character set other than 7-bit ASCII will be used.
# export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
# Substitute character set you plan to use in following line.
NLS_LANG=american_america.UTF8
export ORACLE_BASE DBA NLS_LANG
# End customizations
- In the same directory you’ll also find a shell script called coraenv that
can be called from .cshrc. If you use C shell, you will want to back up and
edit coraenv with similar changes to the oraenv script.
- The root.sh script copied oraenv and coraenv from $ORACLE_HOME/bin to your
local bin directory. You just updated these scripts in $ORACLE_HOME/bin. Copy
the updated versions to your local bin directory.
- In $ORACLE_HOME/bin you’ll find a script called dbstart. This is a utility
that you can run to start up databases on the server. Later we will add a call
to this script from /etc/rc.d so that the databases start up automatically
whenever the server reboots. Unfortunately, the dbstart script that comes with
Oracle 8.1.6 is riddled with bugs—as is, the script will not do what it is
supposed to. The easiest way to make dbstart start Oracle 8.1.6 databases
properly is to add the following text after line 70:
VERSION="8.1"
Note that this fix assumes that all databases on your server are version
8.1.5 or later. If you have any Oracle 8.0 databases on your server, then
you’ll need to look more closely at the script and fix it properly. Also note
that the dbstart script that comes with Oracle 8.1.7 is fine as-is; no changes
should be necessary.
- In $ORACLE_HOME/bin you’ll find a script called dbshut. This is a utility
that you can run to shut down databases on the server. Unfortunately, it shuts
down databases with normal priority. This means that if any users are logged
into a database, the shutdown will hang until they log out. You might want to
change this script to shut down databases with immediate priority. To do this,
find the lines in the script that contain just the word “shutdown”. Change
these to read “shutdown immediate”.
Create a Scalable Oracle Database
These steps drop the starter Oracle database created when you installed the
Oracle software, and replaces it with an Oracle database that you can use for
more than just messing around. You can skip this entire section if initially you
just want to work with the starter database. In this section we will remove the
existing starter database, use the Oracle Database Configuration Assistant to
create an empty database, create application users and tablespaces in the
database, and configure Net8. All of the steps in this section are run as the
oracle user.
- Shut down the starter database using SQL*Plus as follows:
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate
SQL> exit
$
- Remove the directories and files that made up the starter database:
Starter Database Directories and Files |
app/oracle/admin/$ORACLE_SID under Oracle software mount point |
oradata/$ORACLE_SID under database mount point (Oracle 8.1.6) |
app/oracle/oradata/$ORACLE_SID under Oracle software mount point
(Oracle 8.1.7) |
$ORACLE_HOME/dbs/init$ORACLE_SID.ora |
$ORACLE_HOME/dbs/lk$ORACLE_SID |
$ORACLE_HOME/dbs/orapw$ORACLE_SID |
- Edit the file /etc/oratab and remove the one line entry for the starter
database.
- Choose a block size for your new Oracle database. The default is 2 Kb, and
this is appropriate only for very small databases. If you anticipate your
database growing beyond perhaps 100 Mb in size, you should use a block size of
8 Kb or 16 Kb.
- Set up your environment the same way you did when you ran the Oracle
installer. Log in as the oracle user on the database server from an X window.
Set your DISPLAY variable appropriately. Make sure that your ORACLE_HOME,
PATH, and other variables are set correctly based on your login file. In
particular ORACLE_SID should be set to the name of the database you wish to
create.
- Look over the mount points you have available to hold your new database.
You want as many mount points as possible, each corresponding to a separate
physical device or group of devices. Check the amount of free space available
on each mount point. Ensure that each mount point contains an oradata
directory that is owned by the oracle user.
- Launch the Oracle Database Configuration Assistant with the following
commands:
cd $ORACLE_HOME/bin
./dbassist
We’ll walk through the prompts one at a time:
- The Welcome window appears. Choose “Create a database” and click Next.
- Choose a database type of Custom and click Next. This will give you the
opportunity to configure your database optimally.
- Choose a primary application type of Multipurpose and click Next.
- Enter the approximate number of concurrent database users you anticipate
and click Next. How you set your semaphore kernel parameters earlier will
impact how many concurrent users your database can support. Note that this
setting is very easy to change later so you should not feel locked in by
what you choose now.
- Choose the dedicated server mode and click Next. Only consider using
shared server mode if you will be using Oracle’s JVM and IIOP, or if you
will have many (as in hundreds) of concurrent users whose database sessions
will be idle much of the time. Shared server mode (also known as
multi-threaded server or MTS) is historically less stable and is best
avoided when possible.
- Select the options you would like to have configured in your database,
such as JServer or Advanced Replication. The schema objects required to
support these features will automatically be built during database creation.
Note that some of these options require extra licensing. You should not
choose options you are not licensed to use. Click Next.
- Enter a global database name and SID for your database. These do not
seem to pick up from the ORACLE_SID environment variable, unfortunately.
Your global database name should be the same as the SID, with your domain
name added on to the end. As you enter the global database name, the SID and
initialization filename will enter automatically. Do not change the
initialization filename.
- Set the compatibility to 8.1.0 in order to be able to use newer Oracle
features to the fullest.
- You may click Change Character Set and select character set names from
lists if desired. However, these fields should default correctly from your
environment variable settings. Note that with few exceptions, you cannot
change the character set of a database after creation. The character set you
choose now is the character set you will be stuck with unless you rebuild
your database. So put some thought into choosing your character set. If you
want to use Unicode, select the UTF8 character set.
- Click Next.
- You now have the opportunity to choose filenames for the control files.
The default base names should not be changed, but you should change the
directories where these files will be located. Put the control files in the
oradata/$ORACLE_SID directory under three different mount points. Click
Next.
- You now have the opportunity to choose filenames and sizes for the six
tablespaces that will initially make up your database. Make any desired
changes and click Next. I recommend the following changes:
- The default base names for each file should not be changed, but you
should change the directories where these files will be located. Put the
files in the oradata/$ORACLE_SID directory under one or more mount points.
- I prefer to turn off the autoextend feature, but you may use it if you
wish.
- It will be easy for you to change file sizes later, but I recommend
that you start with the following:
Tablespace |
Size (Mb) |
System |
300 |
Tools |
100 |
Users |
100 |
Rollback |
500 |
Index |
100 |
Temp |
500 |
Note that the minimum required size for
the system tablespace depends on which options you have elected to
configure. Do not assume that the default system tablespace size suggested
by the Database Configuration Assistant will be sufficent, because it
might not. For example, if you choose to configure all database options
for an Oracle 8.1.6 installation, the database creation will fail if your
system tablespace is smaller than 250 Mb and autoextend is turned off.
Meanwhile, the Database Configuration Assistant suggests a system
tablespace size of only 54 Mb.
- You now have the opportunity to choose filenames and sizes for the
online redo logs. The default base names should not be changed, but you
should change the directories where these files will be located. Put the
files in the oradata/$ORACLE_SID directory under one or two mount points.
The default file size of 500 Kb is too small for almost all situations. I
recommend a size of 10240 Kb. Make all files the same size. Click Next.
- You can accept the default checkpoint interval and timeout for now. You
can also leave archive logging disabled for now. (Deal with this one when
you establish your backup and recovery plan.) Click Next.
- You now have the opportunity to set the SGA sizing parameters. The
defaults are not bad. Make sure your server has enough physical memory to
keep the entire SGA in memory at all times. I recommend the following
changes:
- Set the database block size based on the figure you decided upon
earlier, typically 8 Kb or 16 Kb. The database block size cannot be
changed after the database has been created, so choose carefully. All
other settings on this page can be changed very easily.
- Set the shared pool size to 41943040 or more. This is where Oracle
will cache data dictionary elements, SQL statements, and parsed SQL.
- Set the data block buffers to at least 1000, but probably much more.
This determines how large Oracle’s buffer cache will be for holding
frequently accessed data. The size of the buffer cache will be equal to
the number of buffers times the database block size.
- The trace file directory defaults are all good and should not be
changed. Click Next.
- Choose to create the database now and click Finish. Alternatively you
can save the information to a set of shell scripts.
- An alert window will tell you that the database creation will take some
time and will ask if you wish to proceed. Choose Yes. A progress window will
show you how the database creation is going. How long the database creation
will actually take depends on which options you have elected to configure,
how many disk devices your database will be spread across, and the processor
and memory capabilities of your database server. It took 70 minutes to
create a database with all available options configured on my little server
with a 400 Mhz processor, 256 Mb RAM, and one IDE disk. It took 20 minutes
to create a database with no options configured on the same server.
- When the database has been created, an alert window opens to show you
the SYS and SYSTEM passwords. Write these down (if you don’t already know
them by heart!) and click OK. The Oracle Database Creation Assistant exits.
- Adjust the configuration of the Net8 listener if necessary. You can edit
the listener.ora file in $ORACLE_HOME/network/admin to suit your needs,
although you may find the default file to be totally acceptable. If you
removed the starter database, then you should remove its entry from
listener.ora now. Depending on your network topology, you might want to change
the hostname or IP. (In my case my server is multi-homed, but I only want the
database to accept connections from the internal network.) You should leave
the extproc settings as they are; extproc is part of the mechanism that allows
PL/SQL to call out to procedures outside the database. My listener.ora file
looks like this:
#
# Filename: listener.ora
#
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC)))
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521)))
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 2481))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/8.1.7)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = DEMO.MYDOMAIN)
(ORACLE_HOME = /u01/app/oracle/product/8.1.7)
(SID_NAME = DEMO)
)
)
- Prepare a tnsnames.ora file in $ORACLE_HOME/network/admin on the database
server and distribute it to all clients. Edit the default file to suit your
needs. Change the hostname or IP if needed. Remove the entry for the starter
database if you got rid of the starter database. My tnsnames.ora file looks
like this:
#
# Filename: tnsnames.ora
#
DEMO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = DEMO.MYDOMAIN)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
- Shut down the database using SQL*Plus as follows:
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate
SQL> exit
$
- The default parameter file that the installer created for the database
instance is deficient in a few ways. You will find the parameter file in
$ORACLE_BASE/admin/$ORACLE_SID/pfile. Save a backup copy of this file before
you start editing it. Some of the things you should correct or improve upon
are:
- Note that much of the advice in the comments of the parameter file is
laughable and should be taken with a grain of salt. Some of these comments
were written ten years ago for Oracle 7.0 and have not been updated since
then.
- Update the sort_area_size parameter to a reasonable value based on how
much physical memory your database server has.
- You might want to reorganize the entries in your parameter file to
divide them into logical groups. This might make it more readable, but this
is a personal taste sort of thing.
Here’s the parameter file I ended up with.
#
# initDEMO.ora
# ============
#
# Parameter file for DEMO instance.
#
#
# Configuration parameters
#
control_files = (/u02/oradata/DEMO/control01.ctl,
/u03/oradata/DEMO/control02.ctl,
/u04/oradata/DEMO/control03.ctl)
background_dump_dest = /u01/app/oracle/admin/DEMO/bdump
core_dump_dest = /u01/app/oracle/admin/DEMO/cdump
user_dump_dest = /u01/app/oracle/admin/DEMO/udump
db_block_size = 8192
instance_name = DEMO
db_name = DEMO
db_domain = MYDOMAIN
service_names = DEMO.MYDOMAIN
compatible = 8.1.7
remote_login_passwordfile = exclusive
os_authent_prefix = ""
#
# Tuning parameters
#
shared_pool_size = 52428800
large_pool_size = 15728640
java_pool_size = 20971520
sort_area_size = 2097152
db_block_buffers = 5000
processes = 50
open_cursors = 300
max_enabled_roles = 30
log_checkpoint_interval = 10000
log_checkpoint_timeout = 1800
log_buffer = 163840
job_queue_processes = 4
max_dump_file_size = 10240 # limit trace file size
# to 5 Meg each
- Use SQL*Plus to restart the instance so that the new parameter settings
take effect:
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> shutdown immediate
SQL> startup
SQL> exit
$
- Adjust tablespace configurations in the database as required to improve
performance and scalability. Here are some of the things you’ll probably want
to do:
- Alter the temporary tablespace to give it appropriate default storage
parameters. This will allow Oracle to manage temp space effectively when
performing sorts. You can use a statement in SQL*Plus such as:
ALTER TABLESPACE temp DEFAULT STORAGE (INITIAL 4m NEXT 4m);
- All users including SYS and SYSTEM should have the TEMP tablespace
designated as their temporary tablespace. You can use the following query
and statement in SQL*Plus to check each user’s temporary tablespace
designation and change as necessary:
SELECT username, temporary_tablespace
FROM SYS.dba_users;
ALTER USER <username> TEMPORARY TABLESPACE temp;
- Depending on the anticipated size of your database and the expected
number and type of concurrent transactions, you may want to adjust the
number of rollback segments and their storage parameters. However, the
rollback segment configuration established by the Database Configuration
Assistant should be able to get you started.
- Change passwords for all users, particularly SYS and SYSTEM. You can do
this with statements in SQL*Plus such as:
ALTER USER <username> IDENTIFIED BY <new password>;
- At this point the database has two tablespaces available to hold your
application tables and indexes: USERS and INDX. However, I recommend that you
instead create new tablespaces for holding application segments. Create
separate tablespaces with data files on separate physical devices for tables
and indexes. You may want to split your application segments into several
tablespaces, based on object size, permanence, volatility, I/O volume, or any
of a number of other criteria. I recommend that you choose default storage
parameters for each application tablespace as follows:
- Set INITIAL to either 128k, 4m, or 128m, depending on the planned sizes
of the objects to be placed in the tablespace.
- Set NEXT the same as INITIAL.
- Set MINEXTENTS to 1 and MAXEXTENTS to 4096.
- Set PCTINCREASE to 0.
Here is a sample tablespace creation statement:
CREATE TABLESPACE small_tables
DATAFILE '/u01/oradata/DEMO/small_tables01.dbf' SIZE 500m
DEFAULT STORAGE (INITIAL 128k NEXT 128k
MINEXTENTS 1 MAXEXTENTS 4096 PCTINCREASE 0);
- Create application roles if desired. Alternatively, you can use the
default roles CONNECT, RESOURCE, and DBA.
- Create your application users that will own the application schemas. Set
the default tablespace to one of your application tablespaces designated to
hold tables, and set the temporary tablespace to TEMP. Assign quotas on all of
the application tablespaces where the user will need to be able to create
schema objects. (You can use the keyword UNLIMITED.) You should not set any
quota on the temporary tablespace. Do not plan to create any application
objects in the SYS or SYSTEM schemas, or store any application objects in the
SYSTEM or TEMP tablespaces. Here is a sample application user creation
statement:
CREATE USER bob IDENTIFIED BY bob123
DEFAULT TABLESPACE small_tables TEMPORARY TABLESPACE temp
QUOTA UNLIMITED ON small_tables QUOTA UNLIMITED ON large_tables
QUOTA UNLIMITED ON small_indexes QUOTA UNLIMITED ON large_indexes;
- Grant roles and/or system privileges to the application users. Note that
if you grant the RESOURCE role to a user, that user will also receive the
UNLIMITED TABLESPACE system privilege. This will let the user create objects
in any tablespace they wish, regardless of quotas. I recommend you revoke
UNLIMITED TABLESPACE from all application users you create. Sample statements
to grant and revoke privileges are as follows:
GRANT connect, resource TO bob;
REVOKE unlimited tablespace FROM bob;
Complete the Server Configuration
These steps complete the configuration of your server for smooth Oracle
operation. These steps could have been performed earlier, but are more
straightforward if performed after a database has been created. In this section
we will configure the server to start the database and Net8 listener
automatically whenever the server is rebooted, change the oracle user’s login
script to eliminate hardcoding, and create individual operating system accounts
for each database user.
- Edit the /etc/oratab file to verify that the entry for your database is
correct. Lines starting with a pound sign are considered comments and are
ignored. Each non-comment line contains the name of one Oracle instance, its
ORACLE_HOME, and a Y or N. A Y indicates that the database should be started
automatically on server reboot, and an N indicates that it should not. The
three fields should be separated by colons. A sample /etc/oratab file looks
like this:
#
# /etc/oratab
# ===========
#
DEMO:/u01/app/oracle/product/8.1.7:Y
- Edit the login file (.profile or .bash_profile) for the oracle user to
eliminate hardcodings and call the oraenv script to set the environment
instead. The following will work with Bourne shell, Korn shell, or Bash:
# Settings for Oracle environment
ORACLE_SID=DEMO # Put your instance name here
ORAENV_ASK=NO
export ORACLE_SID ORAENV_ASK
. oraenv
Note that this script assumes that the local bin directory
(/usr/local/bin) is on your path. Also, if you use C shell then you should
edit .cshrc and have it source coraenv.
- Create separate Unix accounts for DBAs and database users who will log
onto the database server directly. You should only log in as oracle when
installing or patching software. The Unix accounts for DBAs should be members
of the dba group, and other users should not be members of the dba group. Give
each of these accounts a login file like oracle’s so that their environment
initializes correctly when they log in.
- To make the database and Net8 listener start up automatically when the
server reboots and shut down automatically when the server shuts down, you’ll
need to create a dbora file in /etc/rc.d/init.d and link it to /etc/rc.d/rc3.d
and /etc/rc.d/rc0.d. You’ll need to do this as the root user. First create a
file called dbora in /etc/rc.d/init.d as follows:
#!/bin/sh
ORA_HOME=/u01/app/oracle/product/8.1.7
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start') # Start the Oracle databases and Net8 listener
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
# Next line for Oracle 8.1.7 only
su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl start"
;;
'stop') # Stop the Oracle databases and Net8 listener
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut"
# Next line for Oracle 8.1.7 only
su - $ORA_OWNER -c "$ORA_HOME/Apache/Apache/bin/apachectl stop"
;;
esac
After creating the dbora file, you need to link it to /etc/rc.d/rc3.d
and /etc/rc.d/rc0.d: ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc3.d/S99dbora
ln -s /etc/rc.d/init.d/dbora /etc/rc.d/rc0.d/K10dbora
Note that this script starts the Apache HTTP server as the oracle user,
which is not a good idea from the standpoint of security. Oracle recommends
that you run the Apache HTTP server from a very restricted Unix user, such as
the orapache user we created earlier. Unfortunately, this leads to file
permission problems that I have not yet had the time to resolve.
Conclusion
This document walks you through all of the intricate details of getting
Oracle up and running on a database server running Linux. It may look
complicated, but that’s only because this document goes down to a nitty gritty
level of detail.
Please keep in mind, though, that the requirements are different for every
Oracle implementation. I am extremely confident that if you follow these steps
to install Oracle 8.1.7.0.1 or 8.1.6.1.0 Enterprise Edition on a server running
Red Hat 6.2 Linux, then the process will go very smoothly for you. However, no
single document can address every specific hardware configuration and every set
of business needs. Please use this document as a starting point to get Oracle up
and running in your shop. To get the best performance and scalability, each
system needs to be considered individually.