Installing and Configuring Oracle on the Solaris Platform

by Roger Schrag
Database Specialists, Inc.

About Database Specialists, Inc.
Database Specialists, Inc. provides remote DBA services and onsite database support for your mission critical Oracle systems. Since 1995, we have been providing Oracle database consulting in Solaris, HP-UX, Linux, AIX, and Windows environments. We are DBAs, speakers, educators, and authors. Our team is continually recognized by Oracle, at national conferences and by leading trade publications. Learn more about our remote DBA, database tuning, and consulting services. Or, call us at 415-344-0500 or 888-648-0500.

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 Sun Solaris SPARC 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. In order to keep the steps as simple as possible, this document does not cover Oracle Parallel Server implementations or Legato Storage Manager installation.

There are four phases to getting Oracle up and running on your server:

  1. Prepare the server
  2. Install the Oracle software and create a simple database
  3. Create a scalable Oracle database (optional)
  4. 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.

  1. Make sure that your Solaris system has all of the required operating system patches installed. You must have Solaris 2.6 or Solaris 7 to run Oracle 8.1.6. Oracle 8.1.7, meanwhile, is certified with Solaris 2.6, 7, and 8. Unfortunately, I have not been able to find documentation of which patches are required for installing Oracle 8.1.7 on Solaris 8. At the very least, make sure you have applied a recent kernel jumbo patch. For Solaris 2.6 and 7, the patch requirements are as follows:

    Patches for Solaris 2.6Status
    106040-11 X Input and Output Method patch Required
    105181-15 Kernel patch Required
    105284-25 Motif Runtime Library Patch Recommended
    105490-07 Dynamic linker patch Recommended
    105633-21 OpenWindows 3.6: Xsun patch Recommended
    105568-13 Libthread patch Recommended
    105210-19 LibC patch Recommended
    105669-07 CDE 1.2: libDTSvc patch (dtmail) Recommended
    106409-01 Chinese TrueType fonts patch Recommended

    Patches for Solaris 7Status
    107636-01 X Input and Output Method patch Required
    106980-05 Libthread patch Recommended
    107607-01 Motif fontlist, fontset, libxm Recommended
    107078-10 Open Windows 3.6.1 Xsun patch Recommended

    You can verify your operating system version and see which patches are installed with the following commands:

          uname -a
          showrev -p
    
  2. Oracle 8.1.7 has an integrated Apache HTTP server that will be installed at the same time as the Oracle software. Apache requires JDK 1.2.2 and the following Solaris patches:

    Patches for Solaris 2.6Status
    105490-07 Linker patch Required
    105568-16 Libthread patch Required
    105210-27 Libc patch Required
    106040-13 X Input and Output Method patch Required
    105633-36 OpenWindows 3.6: Xsun patch Required
    106409-01 Fixes the Chinese TrueType fonts Required
    108091-03 SunOS 5.6: ssJDK 1.2.1_03 fails
    with fatal error in ISO8859-01 Locales
    Required
    105181-19 Kernel Update (socket close/hang) Recommended
    105669-10 CDE 1.2: libDTSvc patch (dtmail) Recommended
    105284-31 Motif 1.2.7: Runtime Library patch Recommended

    Patches for Solaris 7Status
    106980-10 Libthread patch Required
    107636-03 X Input & Output Method Patch Required
    107081-11 Motif 1.2.7 and 2.1.1: Runtime library patch for Solaris 7 Required
    108376-03 OpenWindows 3.6.1 Xsun Patch Required

    Again, the patches required for Solaris 8 do not appear to be documented as of this writing.

  3. Make sure that the following software packages have been installed.

    Required Packages
    SUNWarc
    SUNWbtool
    SUNWhea
    SUNWlibm
    SUNWlibms
    SUNWsprot
    SUNWtoo

    You can use the following command to verify that a package has been installed:

          pkginfo -i <package name>
    
  4. 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.

  5. The following executables must be present in the /usr/ccs/bin directory: make, ar, ld, nm.

  6. Make sure that your hardware is sufficient. You’ll need at least 128 Mb RAM, a CD ROM drive, a swap space of at least 400 Mb or twice RAM (whichever is larger), and a bare minimum of 1300 Mb of disk space. 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. The following commands will allow you to check RAM and swap space:
          /usr/sbin/prtconf | grep size
          swap -l
    
  7. Oracle supports files larger than 2 Gb, but your shell must not impose a 2 Gb file size limit for this to work. Note that Oracle does limit database data files to 4,194,304 Oracle blocks. You choose the Oracle block size when creating a database, and the options range from 2 Kb to 16 Kb. This means that Oracle database data files are limited to 8 Gb to 64 Gb, depending on the database block size. It is also important to note that certain Oracle utilities, notably the export utility, are still limited to 2 Gb files. Use the following commands to ensure that the shell imposes no limits on file size:
          ulimit -Sa
          ulimit -Ha
    
  8. Make sure that the Solaris 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. Many operating systems, including Solaris, do not by default offer sufficient shared memory or semaphores for maintaining an Oracle database. Happily, you can change kernel parameters in Solaris simply by editing the /etc/system file and rebooting the server.

    Kernel ParameterSetting To Get
    You Started
    Purpose
    SHMMAX4294967295 Maximum size of a single shared memory segment
    SHMMIN1 Minimum size of a single shared memory segment
    SHMMNI100 Maximum number of shared memory segments in entire system
    SHMSEG10 Maximum number of shared memory segments one process can attach
    SEMMNS2000 Maximum number of semaphores in entire system
    SEMMSL1000 Maximum number of semaphores per set
    SEMMNI100 Maximum number of semaphore sets in entire system
    SEMOPM100 Maximum number of operations per semop call
    SEMVMX32767 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 excessive, but there is no penalty to be paid by setting SHMMAX larger than you actually need.

    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 large numbers of concurrent database connections, you may need to increase these values. 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 Solaris 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 in /etc/system, then reboot the server so that the new settings will take effect.

    I added the following lines to the end of my /etc/system file:

          set shmsys:shminfo_shmmax=4294967295
          set shmsys:shminfo_shmmin=1
          set shmsys:shminfo_shmmni=100
          set shmsys:shminfo_shmseg=10
          set semsys:seminfo_semmns=2000
          set semsys:seminfo_semmsl=1000
          set semsys:seminfo_semmni=100
          set semsys:seminfo_semopm=100
          set semsys:seminfo_semvmx=32767
    
  9. 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 use the admintool, or you can create your dba group with a command like:
          groupadd -g 300 dba
    
  10. 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 use the admintool, or you can create your oinstall group with a command like:
          groupadd -g 301 oinstall
    
  11. 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 the admin tool, or with commands like:
          useradd -c 'Oracle software owner' -d /home/oracle \
                  -g oinstall -G dba -m -u 300 -s /bin/ksh oracle
          passwd oracle
    
  12. 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 the admin tool, or with commands like:
          groupadd -g 302 orapache
          useradd -c 'Oracle Apache user' -d /home/orapache -g orapache \
                  -m -u 301 -s /bin/ksh orapache
          passwd orapache
    
  13. 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.

  14. 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.

  15. 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. Most Solaris systems will automatically mount CDs, but alternatively you can use a command like:
          mount -r -F hsfs device_name /cdrom
    
  16. Create the /var/opt/oracle directory and make it owned by the oracle user. After installation, this directory will contain a few small text files that briefly describe the Oracle software installations and databases on the server. These commands will create the directory and give it appropriate permissions:
          mkdir /var/opt/oracle
          chown oracle:oinstall /var/opt/oracle
          chmod 755 /var/opt/oracle
    

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.

  1. 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 .bashrc 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 .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, /usr/ccs/bin, /usr/openwin/bin,
          # and your local bin directory (usually /usr/local/bin) are all in
          # the PATH.
          # If you will be installing Pro*C/C++ then the C compiler must be
          # on your path. The usual compiler executable on Solaris is located
          # in /opt/SUNWspro/bin.
          export PATH=...
          # Ensure that TWO_TASK is not set.
          unset TWO_TASK
    
  2. Log out and log back in as the oracle user from an X window so that the environment is set correctly.

  3. 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
    
  4. 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
    
  5. 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.

  6. 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. Allow 850 Mb for the software mount point and 450 Mb for the database mount point as bare minimums.

  7. Double check that you are logged in as oracle and not root. Then start the Oracle installer with these commands:
          cd /cdrom/oracle8i
          ./runInstaller
    
    We’ll walk through the installer prompts one at a time:

    1. The Welcome window appears. Click Next.
    2. 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.
    3. If this is the first time you are installing Oracle 8.1.6 software or later on the database server, then the Unix Group Name window appears. Enter oinstall and click Next. (You won’t see this window the next time you run the installer because Oracle saves this information in the /var/opt/oracle/oraInst.loc file.)
    4. The Available Products window appears. Choose Oracle 8i Enterprise Edition 8.1.7.0.0 or 8.1.6.0.0 and click Next.
    5. 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.
    6. 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.)
    7. 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.
    8. 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.
    9. 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.
    10. The Summary window appears. Review all of the selections you have made to confirm they are correct. Click Install.
    11. 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.
    12. 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.
    13. 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.
    14. 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.
    15. 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++.
    16. 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.
    17. Exit the installer when you have completed installations and deinstallations.

  8. In $ORACLE_HOME/bin you will find a shell script called oraenv. This script can be called from .profile or .bashrc 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
    
  9. 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.

  10. 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.

  11. 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/rc2.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 7.3 or 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.

  12. 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 replace 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.

  1. Shut down the starter database using SQL*Plus as follows:
          $ sqlplus /nolog
          SQL> connect / as sysdba
          SQL> shutdown immediate
          SQL> exit
          $
    
  2. 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_HOME/dbs/init$ORACLE_SID.ora
    $ORACLE_HOME/dbs/lk$ORACLE_SID
    $ORACLE_HOME/dbs/orapw$ORACLE_SID

  3. Edit the file /var/opt/oracle/oratab and remove the one line entry for the starter database.

  4. Choose a block size for your new Oracle database. The minimum is 2 Kb, and this is appropriate only for very small databases. If you anticipate your database growing beyond perhaps 500 Mb in size, you should use a block size of 8 Kb or 16 Kb.

  5. 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.

  6. 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.

  7. 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:
    1. The Welcome window appears. Choose “Create a database” and click Next.
    2. Choose a database type of Custom and click Next. This will give you the opportunity to configure your database optimally.
    3. Choose a primary application type of Multipurpose and click Next.
    4. Enter the approximate number of concurrent database users you anticipate and click Next. How you set your semaphore kernel parameters in /etc/system 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.
    5. 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.
    6. Select the options you would like to have configured in your database, such as interMedia Text 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.
    7. 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.
    8. Set the compatibility to 8.1.0 in order to be able to use newer Oracle features to the fullest.
    9. 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.
    10. Click Next.
    11. 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.
    12. 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:
        TablespaceSize (Mb)
        System300
        Tools100
        Users100
        Rollback500
        Index100
        Temp500
        Note that the minimum required size for the system tablespace depends on which options you have elected to configure.
    13. 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.
    14. 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.
    15. 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.
    16. The trace file directory defaults are all good and should not be changed. Click Next.
    17. Choose to create the database now and click Finish. Alternatively you can save the information to a set of shell scripts.
    18. 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.
    19. 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.

  8. 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)
              )
            )
    
  9. 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)
              )
            )
    
  10. Shut down the database using SQL*Plus as follows:
          $ sqlplus /nolog
          SQL> connect / as sysdba
          SQL> shutdown immediate
          SQL> exit
          $
    
  11. 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:

    1. 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.
    2. Update the sort_area_size parameter to a reasonable value based on how much physical memory your database server has.
    3. 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                = 0
          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
    
  12. 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
          $
    
  13. 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:

    1. 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);
      
    2. 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;
      
    3. 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.

    4. 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>;
      
  14. 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:

    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);
    
  15. Create application roles if desired. Alternatively, you can use the default roles CONNECT, RESOURCE, and DBA.

  16. 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;
    
  17. 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.

  1. Edit the /var/opt/oracle/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 /var/opt/oracle/oratab file looks like this:
          #
          # /var/opt/oracle/oratab
          # ======================
          #
          DEMO:/u01/app/oracle/product/8.1.7:Y
    
  2. Edit the login file (.profile or .bashrc) 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.

  3. 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.

  4. 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/init.d and link it to /etc/rc2.d and /etc/rc0.d. You’ll need to do this as the root user. First create a file called dbora in /etc/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/rc2.d and /etc/rc0.d:
          ln -s /etc/init.d/dbora /etc/rc2.d/S99dbora
          ln -s /etc/init.d/dbora /etc/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, you might find that doing so leads to file permission problems. Another option would be to start the Apache HTTP server as the root user and have it hand off ownership to the orapache user and orapache group by setting the User and Group parameters in the Apache configuration file $ORACLE_HOME/Apache/Apache/conf/httpd.conf.

Conclusion

This document walks you through all of the intricate details of getting Oracle up and running on a database server running SPARC Solaris. 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.6 or 8.1.7 Enterprise Edition on a server running SPARC Solaris 2.6 or 7, 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.

About the Author

Roger Schrag has been an Oracle DBA and application architect for over twelve years. He started out at Oracle Corporation on the Oracle Financials development team and moved into the roles of production DBA and database architect at various companies in the San Francisco Bay Area. Roger is a frequent speaker at Oracle OpenWorld and the IOUG Live! conferences. He is also vice-president of the Northern California Oracle Users Group. In 1995, Roger founded Database Specialists, Inc.

Still Looking for Help on this Subject?

Get a Consultation
We would be happy to talk with you about our services and how our senior-level database team might help you. Call Database Specialists at 415-344-0500 or 888-648-0500 or fill out a free consultation request form.
Complimentary Newsletter
If you'd like to receive our complimentary monthly newsletter with database tips and new white paper announcements, sign up for The Specialist.


Copyright © 2005 Database Specialists, Inc. http://www.dbspecialists.com