installing and configuring oracle database 11g

Upload: fruitfulluft

Post on 05-Apr-2018

271 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    1/28

    http://www.dbspecialists.com/oracle11glinux.html

    Installing and Configuring Oracle Database 11g

    on the Linux Platform

    Introduction

    This paper will walk you through the steps of installing Oracle Database 11g release 2(Oracle version 11.2.0) in a Linux environment. About 90% of the material presented hereapplies to other platforms as well. Everything you read in this paper is hands on, roll-up-your-sleeves-and-get-busy material for Oracle users who want to get anOracle database upand running quickly without reading hundreds of pages of documentation and readmefiles.

    These steps are meant to get you up and running as fast as possible, while leveraging bestpractices in order to set up a scalable, robust database environment that offers highperformance. In order to keep the steps reasonably simple this paper does not cover RealApplication Clusters (RAC), nor does it cover Oracle Internet Directory (OID), AutomaticStorage Management (ASM), or Grid Control.

    In this paper we will install the 11.2.0.1 release of Oracle Database 11g. This is the basedistribution of Oracle Database 11g release 2. Be sure to check Oracle Supports Metalinkathttp://metalink.oracle.com to see if a newer patch set has been released since this paperwas published. You will need a valid Customer Service Identifier (CSI) number in order toaccess the Metalink website.

    We ran our Oracle installations on servers equipped with Intel Xeon processors runningRed Hat Enterprise Linux ES release 5 (Tikanga), update 4 (x86_64). Oracle Database 11gis supported on other processor architectures and Linux distributions as well. Note that withRed Hat Enterprise Linux, the ES and AS varieties are supported while WS is not.

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

    1. Prepare the server2. Install the Oracle software and latest patch set3. Create a database

    4. Complete the server configuration

    We will walk through these phases one at a time, detailing all the steps involved. The endresult will be a very usable database that can be scaled up quite large, and an Oracleinstallation that follows industry-recognized best practices. Of course, everyimplementation is unique, and you will need to evaluate each step carefully against yourparticular requirements. However, this paper will get you off to a very solid start.

    http://www.dbspecialists.com/consulting.htmlhttp://www.dbspecialists.com/consulting.htmlhttp://metalink.oracle.com/http://metalink.oracle.com/http://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#preparehttp://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#installhttp://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#createdbhttp://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#completehttp://www.dbspecialists.com/consulting.htmlhttp://metalink.oracle.com/http://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#preparehttp://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#installhttp://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#createdbhttp://c/Users/gsadler/Documents/DSI%20Docs/Sys%20Admin/Website/oracle11glinux.html#complete
  • 7/31/2019 Installing and Configuring Oracle Database 11g

    2/28

    The author wishes to acknowledge that this paper draws heavily from the previousDatabase Specialists, Inc. paper "Installing and Configuring Oracle Database 10g on theLinux Platform" by Roger Schrag - thanks Roger!

    Prepare the Server

    These steps configure your database server so that it will be ready to accept the Oraclesoftware and database. In this section, we will make sure your server meets Oraclesminimum requirements, create a Linux user and group to own the software, and createsome directories that will be used by the Oracle software and database. All of the steps inthis section are run as the root user.

    1. Make sure that your hardware platform (processor architecture) is certified byOracle Corporation for use with Oracle Database 11g release 2, and that you haveacquired the correct distribution of Oracle software for your hardware platform. Asof May 2010, the supported hardware platforms for Oracle on Linux are as follows:

    Supported Hardware Platforms for Oracle Database 11g release 2

    x86 (Intel and AMD processor chips that adhere to the x86 32-bit architecture)

    x86-64 (AMD64/EM64T and Intel processor chips that adhere to the x86-64architecture)

    2. The following commands can be used to identify the processor architecture on yourdatabase server:

    3. $ uname -m4. $ grep "model name" /proc/cpuinfo

    5.6. Make sure that your Linux distribution is certified by Oracle Corporation for use

    with Oracle Database 11g release 2. Note that certifications vary by hardwareplatform. As of May 2010, the supported Linux distributions are as follows:

    Supported Linux Distributions for Oracle Database 11g release 2

    Oracle Enterprise Linux 5 update 2, kernel 2.6.18-92 or higher

    Oracle Enterprise Linux 4 update 7

    Red Hat Enterprise Linux AS/ES 5 update 2 or later

    Red Hat Enterprise Linux AS/ES 4 update 7 or later

    SUSE Linux Enterprise Server 11.0, kernel 2.6.27.19-5 or higher

    SUSE Linux Enterprise Server 10.0 with SP2 or later, kernel 2.6.16.21-0.8 or higher

    Asianux 3.0Asianux 2.0 (update 7 required for x86)

    7. Be sure to check Oracle Supports Metalink for the latest certification information,because it is quite possible that Oracle Database 11g release 2 has been certifiedwith additional Linux distributions or hardware platforms since this paper waswritten.

    8. On systems running Red Hat distributions of Linux, you can use the followingcommand to determine exactly which version and update of Red Hat you are using:

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    3/28

    9. $ cat /etc/redhat-release

    10.11. Make sure that all of the required operating system packages have been installed on

    the database server. Which packages and versions are required will vary dependingon your Linux distribution and hardware platform. The package version specified istypically a minimum, meaning that newer versions of the package are usuallyacceptable.

    Required Packages for Red Hat

    Enterprise Linux 4

    Oracle Enterprise Linux 4 and

    Asianux 2.0

    (x86 Hardware Platform)

    binutils-2.15.92.0.2

    compat-libstdc++-33.2.3

    elfutils-libelf-0.97

    elfutils-libelf-devel-0.97gcc-3.4.6

    gcc-c++-3.4.6

    glibc-2.3.4-2.41

    glibc-common-2.3.4

    glibc-devel-2.3.4

    glibc-headers-2.3.4

    libaio-devel-0.3.105

    libaio-0.3.105

    libgcc-3.4.6

    libstdc++-3.4.6

    libstdc++-devel-3.4.6

    make-3.80

    pdksh-5.2.14

    sysstat-5.0.5

    unixODBC-2.2.11

    unixODBC-devel-2.2.11

    Required Packages for Red HatEnterprise Linux 5

    Oracle Enterprise Linux 5 and

    Asianux 3.0

    (x86 Hardware Platform)

    binutils-2.17.50.0.6

    compat-libstdc++-33-3.2.3

    elfutils-libelf-0.125

    elfutils-libelf-devel-0.125elfutils-libelf-devel-static-0.125

    gcc-4.1.2

    gcc-c++-4.1.2

    glibc-2.5-24

    glibc-common-2.5

    glibc-devel-2.5

    glibc-headers-2.5

    kernel-headers-2.6.18

    ksh-20060214

    libaio-0.3.106

    libaio-devel-0.3.106

    libgcc-4.1.2

    libgomp-4.1.2

    libstdc++-4.1.2

    libstdc++-devel 4.1.2

    make-3.81

    sysstat-7.0.2unixODBC-2.2.11

    unixODBC-devel-2.2.11

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    4/28

    Required Packages for Red Hat

    Enterprise Linux 4

    Oracle Enterprise Linux 4 and

    Asianux 2.0

    (x86-64 Hardware Platform)

    binutils-2.15.92.0.2

    compat-libstdc++-33-3.2.3 (both 32 and64 bit required)

    elfutils-libelf-0.97

    elfutils-libelf-devel-0.97

    expat-1.95.7

    gcc-3.4.6

    gcc-c++-3.4.6

    glibc-2.3.4-2.41 (both 32 and 64 bit

    required)

    glibc-common-2.3.4

    glibc-devel-2.3.4

    glibc-headers-2.3.4

    libaio-0.3.105 (both 32 and 64 bitrequired)

    libaio-devel-0.3.105 (both 32 and 64 bitrequired)

    libgcc-3.4.6 (both 32 and 64 bit

    required)libstdc++-3.4.6 (both 32 and 64 bitrequired)

    libstdc++-devel 3.4.6

    make-3.80

    pdksh-5.2.14

    sysstat-5.0.5

    unixODBC-2.2.11 (both 32 and 64 bitrequired)

    unixODBC-devel-2.2.11 (both 32 and 64bit required)

    Required Packages for Red HatEnterprise Linux 5

    Oracle Enterprise Linux 5 and

    Asianux 3.0

    (x86-64 Hardware Platform)

    binutils-2.17.50.0.6

    compat-libstdc++-33-3.2.3 (both 32 and64 bit required)

    elfutils-libelf-0.125

    elfutils-libelf-devel-0.125

    gcc-4.1.2

    gcc-c++-4.1.2

    glibc-2.5-24 (both 32 and 64 bitrequired)

    glibc-common-2.5

    glibc-devel-2.5 (both 32 and 64 bitrequired)

    glibc-headers-2.5

    ksh-20060214

    libaio-0.3.106 (both 32 and 64 bitrequired)

    libaio-devel-0.3.106 (both 32 and 64 bitrequired)

    libgcc-4.1.2 (both 32 and 64 bitrequired)

    libstdc++-4.1.2 (both 32 and 64 bitrequired)

    libstdc++-devel 4.1.2

    make-3.81

    sysstat-7.0.2

    unixODBC-2.2.11 (both 32 and 64 bitrequired)

    unixODBC-devel-2.2.11 (both 32 and 64bit required)

    Required Packages for SUSE Linux

    Enterprise Server 10.0

    (x86 Hardware Platform)

    binutils-2.16.91.0.5

    Required Packages for SUSE LinuxEnterprise Server 11.0

    (x86 Hardware Platform)

    binutils-2.19

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    5/28

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    6/28

    libgcc-4.1.2

    libstdc++-4.1.2

    libstdc++-devel-4.1.2

    make-3.80

    sysstat-8.0.4

    libstdc++33-3.3.3

    libstdc++33-32bit-3.3.3

    libstdc++43-4.3.3_20081022

    libstdc++43-32bit-4.3.3_20081022

    libstdc++43-devel-4.3.3_20081022

    libstdc++43-devel-32bit-4.3.3_20081022

    libgcc43-4.3.3_20081022

    libstdc++-devel-4.3

    make-3.81

    sysstat-8.1.5

    15. Notes: elfutils-libelf-devel has a mutual dependency with elfutils-libelf-devel-staticso they must both be installed with a single rpm command e.g. (for x86-64)

    16. rpm -ivh elfutils-libelf-devel-static-0.137-3.el5.x86_64.rpm \17. elfutils-libelf-devel-0.137-3.el5.x86_64.rpm18.

    19. Also some of these packages also have pre-reqs e.g. glibc-headers requires glibc-kernheaders, gcc (x86_64) requires libgomp, glibc-headers (x86_84) requiredkernel-headers (x86_64), etc.

    20. You can use the following command to verify that a package has been installed:21. $ rpm -q

    22. The following command will verify all of the packages required on Red HatEnterprise Linux 5 (x86_86) systems:

    23. $ rpm -q binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel \

    24. gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers ksh \

    25. libaio libaio-devel libgcc libstdc++- libstdc++-develmake \

    26. sysstat unixODBC unixODBC-devel

    27. Note that in the cases where both the 32 bit and 64 bit architecture of an RPM arerequired you should see the same package twice in the output. You can confirm thatboth have been installed with a command similar to the following:

    28. $ rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n" | grep libaio

    29. You will need to perform the Oracle installation from an X window environmentyou cannot use a character mode environment such as an SSH or telnet session.There is a facility for performing non-interactive installations (silent installs), butwe wont be covering that technique here. Your X environment can be the consoleon the database server, but it does not need to be. You can also use a Windows Xemulator like Cygwin. If the database server is in a remote location, you can useSSH to securely forward X traffic from the database server back to your desktop.You can also use VNC to install remotely. We have run installations from aWindows desktop using both Cygwin and VNC and have had no problems witheither. Over slow networks, VNC seems to be faster than X.

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    7/28

    30. Make sure that your hardware is sufficient. Youll need at least 1024 Mb RAM, aswap space at least the size of physical memory (or 1.5 times the amount ofphysical memory if you have 2 Gb or less of RAM), and a bare minimum of 6.5 Gb

    of disk space. This will let you perform a typical Enterprise or Standard Editionsoftware installation from CD or DVD and create a starter database. If you will bedownloading the Oracle software from Oracle Technology Network athttp://www.oracle.com/technology, you will need about 1.4 Gb of additional diskspace to download and unpack the Oracle software. A production implementationtypically requires more RAM and more disk space than the minimums listed here.The following commands will allow you to check physical memory and swapspace:

    31. $ grep MemTotal /proc/meminfo$ grep SwapTotal /proc/meminfo

    32. The Oracle installer will need access to a directory with at least 1 Gb of free space

    for writing temporary files during installation. Usually /tmp serves this purpose.If /tmp on your database server has less than 1 Gb of free space, then you will needto locate another directory with sufficient free space for use during the installation.You can point at this other directory by setting the TMP and TMPDIR environmentvariables in the oracle user's environment

    33. Make sure that the Linux kernel on the database server has parameters setsufficiently high for Oracle. The Oracle architecture makes extensive use of sharedmemory segments for sharing data among multiple processes and semaphores for

    handling locking. Many operating systems, including Linux, do not by default offersufficient shared memory or semaphores for optimal Oracle performance.Thankfully, you can change kernel parameters in Linux simply by editing the/etc/sysctl.conf file and rebooting the server. The following script will show thecurrent settings of the Linux kernel parameters relevant to Oracle:

    34. K="/tmp/kernelparams$"35. /sbin/sysctl -a > $K 2> /dev/null36. grep aio-max-nr $K37. grep kernel.shm $K38. echo "`grep sem $K | tr '\t' ' '` # semmsl semmns semopm

    semmni"39. grep file-max $K

    40. grep ip_local_port_range $K | tr '\t' ' '41. grep rmem_default $K42. grep rmem_max $K43. grep wmem_default $K44. grep wmem_max $K45. grep aio-max-nr $K

    rm -f $K

    http://www.oracle.com/technologyhttp://www.oracle.com/technology
  • 7/31/2019 Installing and Configuring Oracle Database 11g

    8/28

    The following table shows the purpose of each of these kernel parameters and arecommended setting to get you started:

    Kernel

    Parameter

    Setting To

    Get

    You Started

    Purpose

    aio-max-nr 1048576The total number of concurrent outstanding I/Orequests

    shmmni 4096 Maximum number of shared memory segments

    shmall 2097152 Maximum total shared memory (4 Kb pages)

    shmmax 4294967295Maximum size of a single shared memorysegment. Set to either (4GB -1) or 1/2 the size ofphysical memory (in bytes) whichever is lower

    semmsl 250 Maximum number of semaphores per set

    semmns 32000 Maximum number of semaphoressemopm 100 Maximum operations per semop call

    semmni 128 Maximum number of semaphore sets

    file-max 6815744 Maximum number of open files

    ip_local_port_range 9000 - 65500 Range of ports to use for client connections

    rmem_default 262144 Default TCP/IP receive window

    rmem_max 4194304 Maximum TCP/IP receive window

    wmem_default 262144 Maximum TCP/IP send window

    wmem_max 1048576 Maximum TCP/IP send window

    These settings will be appropriate for most systems. If you decide to configure avery large buffer cache or library cache for your database down the road, or if youchoose to run a large number of databases on one server, then you may need toincrease the shmall setting and possibly the shmmax setting as well. In addition, ifyou configure your database to allow a large number of concurrent sessions withoutusing Oracle's shared server architecture, then you may need to increase the semmsland semmns settings as well.

    Note that these recommended settings assume you have no other applicationsrunning on the database server that use shared memory segments or semaphores.

    You can view current shared memory and semaphore usage on your system withthe following command:

    $ ipcs

    In general, if your Linux kernel already has any of these parameters set larger thanrecommended here, you should not reduce the settings.

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    9/28

    We added the following lines to the end of our /etc/sysctl.conf file:

    # Kernel parameter settings for Oraclefs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152

    kernel.shmmax = 4294967295kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048586

    Depending upon your Linux version you can dynamically update the system valuesvia the command

    $ /sbin/sysctl -p

    or simply reboot the server for these parameters to take effect.

    If you are using SUSE Linux, then you must run the following command beforerebooting the server to ensure that the /etc/sysctl.conf file will be read duringreboot:

    $ /sbin/chkconfig boot.sysctl on

    46. Create a Linux group that will be used by the Oracle software owner. You can callit anything you like, but the standard is oinstall. This group is often called the

    Oracle Inventory group. If you will be installing Oracle on multiple servers onyour network, you might want to keep the groupid the same on all servers. You cancreate your oinstall group with a command like:

    $ /usr/sbin/groupadd -g 501 oinstall

    If you are using SUSE Linux, then you must also enter the GID of the oinstallgroup as the value for the parameter /proc/sys/vm/hugetlb_shm_group and addvm.hugetlb_shm_group to the /etc/sysctl.conf file. Doing this grants members ofthe oinstall group permission to create shared memory segments. For example,where the oinstall group GID is 501 (as above) enter

    $ echo 501 > /proc/sys/vm/hugetbl_shm_group

    Add add the line

    vm.hugetlb_shm_group=501

    to the /etc/sysctl.conf file.

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    10/28

    47. Create a Linux group that will be used by Oracle database administrators. You cancall it anything you like, but the standard is dba. Anybody who logs onto thedatabase server with a Linux login that belongs to this group will be able to log

    onto all databases that run from this Oracle software installation with DBAprivileges. If you will be installing Oracle on multiple servers on your network, youmight want to keep the groupid the same on all servers. You can create your dbagroup with a command like:

    $ /usr/sbin/groupadd -g 502 dba

    48. Create a Linux user that will be the Oracle software owner. You can call it anythingyou like, but the standard is oracle. If you will be installing Oracle on multipleservers on your network, you might want to keep the userid the same on all servers.Note that this users home directory will not be the ORACLE_HOME or where theactual Oracle software is installed; this users home directory should be in the sameplace as other users home directories.

    The Oracle software owner should have the oinstall group as the primary group andthe dba group as a secondary group. You can create your oracle user withcommands like:

    $ /usr/sbin/useradd -c 'Oracle software owner' -d/home/oracle \

    -g oinstall -G dba -m -u 501 -s/bin/bash oracle

    $ passwd oracle

    The useradd command shown here gives your oracle user the Bash shell. You couldjust as easily choose Korn or Bourne shell instead.

    49. It is necessary to increase limits that the shell imposes on the oracle user formaximum number of open file descriptors and processes. Follow these steps toincrease the limits:

    a. Add the following lines in the /etc/security/limits.conf file:b. oracle soft nproc 2047c. oracle hard nproc 16384d. oracle soft nofile 1024

    oracle hard nofile 65536

    e. Add the following lines to the /etc/pam.d/login file, if they are not alreadypresent:

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    11/28

    f. session required /lib/security/pam_limits.sosession required pam_limits.so

    g. Add the following lines in the /etc/profile file (or the /etc/profile.local fileon SUSE systems) if the oracle user uses the Bash, Korn or Bourne shell:

    h. if [ $USER = "oracle" ]; then

    i. if [ $SHELL = "/bin/ksh" ]; thenj. ulimit -p 16384k. ulimit -n 65536l. elsem. ulimit -u 16384 -n 65536n. fio. umask 022

    fi

    p. If the oracle user uses the C shell, then add the following lines in the/etc/csh.login file (or the /etc/csh.login.local file on SUSE systems):

    q. if ( $USER == "oracle" ) thenr. limit maxproc 16384

    s. limit descriptors 65536t. umask 022

    endif

    50. Create mount points for the Oracle software and the Oracle database. Each mountpoint should correspond to a separate physical device or set of devices. Youll needat least one mount point. Typically you use one mount point for the Oracle softwareand one or more mount points for each database. One common convention is to callthe mount points /u01, /u02, and so on. Because mount points are typically ownedby root and the Oracle installer will run as the oracle user and not as root, youshould create some subdirectories now to avoid permission problems later. Create

    an app/oracle subdirectory below the software mount point, and oradatasubdirectories below the mount points to be used for database files. (You can putsoftware and a database on the same mount point if you wish.) Make thesesubdirectories owned by the oracle user and oinstall group, and give them 775permissions, except for the datafile directory, give this 750 permissions. You canuse commands like:

    51. $ mkdir -p /u01/app /u01/app/oracle /u01/oradata52. $ chown oracle:oinstall /u01/app /u01/app/oracle

    /u01/oradata53. $ chmod 775 /u01/app /u01/app/oracle54. $ chmod 750 /u01/oradata

    55. If you downloaded the Oracle software Oracle Technology Network, then use unzip

    to unpack the distribution. If you have the software on CD or DVD, then mount theOracle Database 11g release 2 media now.

    56. As an optional step, it is suggested that you validate your configuration using thepre-install tests of Oracle's Remote Diagnostic Agent (rda.sh), you can find details

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    12/28

    of doing this in Metalink note 250262.1. The procedure is to download the latestversion of rda.sh and run its pre-install checklist via the command

    57. cd58. ./rda.sh -T hcve59.

    then choose the appropriate option 'Oracle Database 11g R2 (11.2.0) Preinstall(Linux AMD64)' option. As of May 2010 the 11gR2 pre-install option does notexist for AMD64 but does exist for Linux-x86, we expect AMD64 support will beadded shortly.

    Install the Oracle Software and Latest Patch Set

    These steps install the Oracle software and latest patch set on your server. As of thiswriting, Oracle release 11.2.0.1.0 is the only version of Oracle Database 11g release 2available for download from Oracle Technology Network or available on CD or DVDmedia. At some point in the future, Oracle will release latest patchsets (e.g. 11.2.0.2,

    11.2.0.3, etc.) however the first such patchset has not yet been release. Therefore, we willinstall Oracle release 11.2.0.1.0. Once Oracle have released a patch set you should applythe patchset on top of the base 11.2.0.1.0 release. Before proceeding with the steps in thissection, you should check Oracle Technology Network(http://www.oracle.com/technology) and Oracle Supports Metalink(http://metalink.oracle.com) to see if any 11g release 2 patch sets are available.

    The Oracle Universal Installer will suggest creating a database at the same time that itinstalls the Oracle software. Although we do not have any latest patchsets to install, we willhold off on the database creation until a later step since that is the preferred sequence ofevents once a 11g release 2 patch set is eventually released.

    In this section, we will prepare the oracle users environment, run the Oracle UniversalInstaller and tidy up a few minor loose ends. All of the steps in this section, except wherenoted, are run as the oracle user.

    1. Edit the oracle users login file on the database server so that the environment willbe configured automatically on login. If you are using Bash shell, then edit.bash_profile. If you are using Bourne or Korn shell, then edit .profile. You can alsouse C shell and edit .cshrc, but the syntax will be different from the examples yousee here. For now, we will hardcode certain things. But after we create a database,we will come back and eliminate all hard codings. Here is what we added to our

    .bash_profile for the install:2. #3. # Substitute your Oracle software mount point in the line

    below.4. export ORACLE_BASE=/u01/app/oracle5. #6. # Ensure that ORACLE_HOME and TNS_ADMIN are not set.7. unset ORACLE_HOME8. unset TNS_ADMIN

    http://www.oracle.com/technologyhttp://metalink.oracle.com/http://www.oracle.com/technologyhttp://metalink.oracle.com/
  • 7/31/2019 Installing and Configuring Oracle Database 11g

    13/28

    9. #10. # If your /tmp directory has less than 1 Gb free, then

    edit11. # and uncomment the following three lines.12. # TMP=/mount_point_with_1Gb_free13. # TMPDIR=/same_mount_point14. # export TMP TMPDIR15. #16. # The documentation does not mention how PATH should be

    set.17. # The following PATH setting worked for us:

    export PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin

    18. Log out and log back in as the oracle user from an X window so that theenvironment is set correctly. If you will be performing the installation from a PC orother workstation instead of using the database servers console directly, you maywish to forward X window traffic over an SSH connection. This offers increasedsecurity (in the case of a public network) and convenience. If you will beperforming the installation from a Windows PC, you can use PuTTY to forwardyour X window traffic by selecting the Enable X11 forwarding checkbox inPuTTYs SSH Tunnels configuration screen. As an alternative to X, you may wishinstead to start a VNC server on your database server by running the followingcommand as the oracle user:

    $ /usr/bin/vncserver

    With a VNC server running in this way, you can achieve an X environment byrunning a VNC viewer on your desktop workstation. You can shut down the VNCserver by running the following command:

    $ /usr/bin/vncserver -kill :1

    19. Make sure your DISPLAY variable is set. If you are forwarding X window trafficover an SSH connection, using VNC, or working from the servers console directly,the DISPLAY variable should already be set for you. If your DISPLAY variablehas not been set already, then you will need to set it manually to the IP address ofyour X server plus the X server and screen numbers. You can set your DISPLAYvariable with a command like:

    $ export DISPLAY=myworkstation:0.0

    20. If you had to set your DISPLAY variable manually in the previous step, then ensurethat the X server on your workstation will allow your database server to openwindows on your display. The easiest way to do this is to issue an xhost commandfrom a session on your workstation. (Dont get confused and issue the command ina window that is logged onto your database server.) You can issue a command like:

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    14/28

    $ xhost +mydatabaseserver

    21. Ensure that the mount point you plan to use for the Oracle software has sufficientfree space. For a basic Enterprise Edition and patch set installation, allow 1.6 Gbfor the software mount point as a bare minimum.

    22. Double check that you are logged in as oracle and not root, and that theenvironment variables have been set by the login script you prepared earlier. Thenchange to your home directory and start the Oracle Universal Installer with acommand like one of the following:

    $ /database/runInstaller

    or

    $ /runInstaller

    Well walk through the installer prompts one at a time:

    a. The Configure Security Updates window appears. If you wish to receivesecurity updates via email then enter your email address and your Oraclesupport password. If not, deselect the checkbox. Click Next. If youdeselected the checkbox hit 'Yes' when the popup warning that you have notprovided an email address appears.

    b. The Select Installation Option windows appears. Choose option 'Installdatabase software only'. Click Next.

    c. The Node Selection window appears. Choose Single instance databaseinstallation and then click Next.

    d. When the Select Product Languages window appears move the desiredlanguages into the right hand panel. Click Next.

    e. The Select Database Edition window appears. We will perform a typicalinstall to get a basic set of Oracle software installed. You can rerun theinstaller again later and choose Custom to install additional productsindividually. For now, choose Standard Edition or Enterprise Edition. TheEnterprise Edition of Oracle Database 11g has some very sophisticated

    features missing from Standard Edition, and the opportunity to purchaseadditional options that might be valuable to a large enterprise. However, theEnterprise Edition is much more expensive than Standard Edition. It is veryimportant that you choose the edition that matches your license, as this willbe difficult to fix later. The Select Options button display 6 extra costoptions that can only be licensed against the Enterprise Edition. Again yourspecific license agreement needs to be consulted here, it is recommended

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    15/28

    that you deselect the extra cost options that your have not purchased. ClickNext.

    f. The Specify Installation Location window appears. Oracle provides asuggested Oracle Base Path for the Oracle home (software installation) thatis about to be created. You can name this Oracle home anything you like.

    Beginning in Oracle Database 11g the standard for Oracle home locationhas changed to //app/oracle/product/11.2.0/dbhome_. In10g the dbhome string was shortened to db. The naming convention, such asdbhome_1, dbhome_2 allows you to install multiple copies of the sameOracle version on one server in a standardized way. Note that we will referback to this path frequently, calling it the Oracle home or simply$ORACLE_HOME. If you are planning to go with the path suggestionprovided by Oracle, make sure there isnt an extra occurrence of theoracle component in the path.When you are satisfied with the path ofOracle Base and the name and path for your Oracle home, click Next.

    g. If you do not have at least 4,397MB of free disk space available in your

    $ORACLE_HOME you will get an error. Make sure you have enough freespace available, otherwise you will not be able to proceed with the install.h. If the Create Inventory window appears, set the inventory directory to the

    parent of the $ORACLE_BASE directory, remember you set the value ofthe $ORACLE_BASE environment variable in the login script. In theoraInventory Group Name field, select the oinstall group. Click Next. Youwon't see this window if you have previously installed Oracle software onthis database server. Historically it was common to have the inventorydirectory located as $ORACLE_BASE/oraInventory but in 11g Oracle arerecommending against this configuration.

    i. The Privileged Operating System Groups screen appears. Set the OSDBAGroup to 'dba' and the OSOPER Group to 'oinstall'. Click Next.

    j. The Prerequisite Checks will run, if they all pass then the installer willcontinue onto the Summary window. Obviously if you have failed anyprerequisite checks you should resolve them before proceeding. Assumingyou made it to the Summary window Click Finish.

    k. During the installation an Execute Configuration Scripts window willappear. The installation will be paused at this point, waiting for you to runscripts as root. (The first time you install Oracle software on the databaseserver there will be two scripts to run as root, while additional installationsonly require one script to be run as root.) You should open another window,log in to the database server as root, review the scripts to be run thoroughly,run the scripts, and click OK in the Execute Configuration Scripts window.

    l. Once the root scripts have ran the installer will display the Finish window,click Close to end the installation.

    23. At this point we are ready to patch the Oracle software installation with the latestmaintenance release available. Log onto Oracle Oracle Supports Metalink

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    16/28

    (http://metalink.oracle.com) and download the latest patch set for Linux x86_64 orwhichever processor architecture your database server uses. As of this writing,there are no patch sets available so we will skip this step, once a patch set becomesavailable we will update this document with the instructions for the patch set.

    24. In addition to the latest maintenance release you should consider applying the latest'Critical Patch Update (CPU)' which contains the latest security patches or thecurrent 'Patch Set Update (PSU)' which contains Oracle's recommended bug fixesin addition to the latest security patches. These patches are released quarterly. Sincethe instructions may differ slightly from one patch to the next so we do not coverthe specifics here. You can find the latest patch and its install instructions on OracleSupport site.

    25. In $ORACLE_HOME/bin (the bin directory under your Oracle home) you will finda shell script called oraenv. This script can be called from .bash_profile or .profileto set up a users environment automatically whenever they log onto the databaseserver. We will customize the oraenv script because there are a few variables thatthe script should set but doesnt. Make a backup copy of the oraenv script and thenedit it, adding the following lines to the very end:

    26. # Begin customizations27. DBA=$ORACLE_BASE/admin28. # Substitute the locale and character set you plan to use

    for your29. # database in the line below. Nowadays the two main common

    choices are:30. # NLS_LANG=american_america.WE8MSWIN1252 (11gR2 Unix

    default)31. # NLS_LANG=american_america.AL32UTF8 (Unicode 5)32. NLS_LANG=american_america.WE8MSWIN125233. export DBA NLS_LANG

    # End customizations

    You should set NLS_LANG to match the character set of the database you willcreate later. The Database Configuration Assistant (dbca) now offers two primarychoices, the default character set for your platform based on the upon the languagesetting of your operating system (WE8MSWIN1252 in our install) and AL32UTF8which corresponds to Unicode 5.0 in 11g. Oracle recommend using AL32UTF8 forthe database character set e.g. see Metalink note 333489.1. You should carefullychoose your character set as it is not easy to change after the database is created.

    http://metalink.oracle.com/http://metalink.oracle.com/
  • 7/31/2019 Installing and Configuring Oracle Database 11g

    17/28

    34. In the same directory youll also find a shell script called coraenv that can be calledfrom .cshrc. If you use C shell, you will want to back up and edit coraenv withsimilar changes to the oraenv script.

    35. The root.sh script copied oraenv and coraenv from $ORACLE_HOME/bin to the/usr/local/bin directory. You just updated these scripts in $ORACLE_HOME/bin.Copy the updated versions to the /usr/local/bin directory.

    Create a Database

    These steps create an Oracle database. Everybody will have different needs for theirdatabase, but the steps here will yield a functional database that you can further tailor toyour specific needs. In this section we will use the Database Configuration Assistant tocreate a database, adjust the database in order to better comply with industry-proven best

    practices, and configure Oracle Net. All of the steps in this section are run as the oracleuser.

    1. Set up your environment the same way you did when you ran the Oracle UniversalInstaller: Log in as the oracle user on the database server from an X window orVNC session, set your DISPLAY variable appropriately, and make sure that yourORACLE_BASE variable is set correctly based on your login file.

    2. Set the ORACLE_HOME environment variable to point to your Oracle home with

    a command like:

    $ export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

    3. Choose a name for your Oracle instance, up to eight characters long. The instancename is easy to change at any time. However, you will want to keep the instancename the same as the database name in order to avoid confusion. Changing thedatabase name later is possible, but not the easiest thing to do. So pick a name forthe instance that you like. Set the ORACLE_SID variable accordingly with acommand like:

    $ export ORACLE_SID=dev11ee

    4. In the next step we will create a database and configure it using 'Database Control'.In order to do this we first need a listener configured prior to creating the database,since we have just installed the software we currently have no listener so we needto configure one. Oracle Net is the networking infrastructure that allowsapplications running on other servers to access the database. The Oracle Netlistener is a process that runs on the database server and monitors a TCP port forrequests to access the database. The Oracle Net listener is configured by creating a

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    18/28

    file called listener.ora in the $ORACLE_HOME/network/admin directory. In the$ORACLE_HOME/network/admin/samples directory you will find an examplelistener.ora file. Unfortunately, many Oracle security exploits involve the OracleNet listener, and therefore it is important that you configure it properly andsecurely. A functional listener.ora file that uses operating system authentication for

    securing the Oracle Net listener is as follows:5. #6. # Filename: listener.ora7. #8. LISTENER =9. (DESCRIPTION_LIST =10. (DESCRIPTION =11. (ADDRESS_LIST =12. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.99)

    (PORT = 1521))13. )14. )15. )

    The permissions on the listener.ora file should be 640.

    16. Start the Oracle Net listener with the following command:

    $ORACLE_HOME/bin/lsnrctl start

    Depending upon your configuration of SELinux (Security Enhanced Linux) youmay receive the error message

    cannot restore segment prot after reloc: Permission denied

    this is due to unpublished bug 6140224 (see Metalink note 454196.1 for details).The recommended workaround, until the bug is resolved, is to change SELinux toPermissive mode which is done by editing the file /etc/selinux/config and changingthe SELINUX value to "SELINUX=permissive" or "SELINUX=disabled" and thenrebooting your server. You can confirm the status of SELinux using the command

    /usr/sbin/sestatus

    17. The Oracle client libraries invoked by an application wishing to access the database

    read configuration files called sqlnet.ora and tnsnames.ora in order to figure outhow to find the Oracle Net listener and what connection parameters should be used.In the same directory where the sample listener.ora file is located, you will also finda sample sqlnet.ora and tnsnames.ora. You should create a sqlnet.ora file and atnsnames.ora file in the same directory where you created your listener.ora file. Setthe file permissions to 644. Copy these two files to all application servers or othermachines that will access the database. Functional sqlnet.ora and tnsnames.ora filesare as follows:

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    19/28

    18. #19. # Filename: sqlnet.ora20. #21. NAMES.DEFAULT_DOMAIN = dbspecialists.com22. NAMES.DIRECTORY_PATH= (TNSNAMES)23.24. #25. # Filename: tnsnames.ora26. #27. DEV11EE.DBSPECIALISTS.COM =28. (DESCRIPTION =29. (ADDRESS_LIST =30. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.99)

    (PORT = 1521))31. )32. (CONNECT_DATA =33. (SERVICE_NAME = dev11ee.dbspecialists.com)34. )35. )

    36. Now we proceed with creating the database, launch the Database Configuration

    Assistant with the following commands:37. $ cd $ORACLE_HOME/bin

    $ ./dbca

    Well walk through the prompts one at a time:

    a. The dbca Welcome window appears. Click Nextb. The Operations windows appears with the 'Create a Database' operation

    selected. Click Next.

    c. The Database Templates window appears. Here you choose a template (aset of default specifications) for the database you wish to create. Oracleprovides templates called General Purpose or Transaction Processing,Custom Database and Data Warehouse Oracle has pre-built data filesavailable for these three templates, meaning that database creation will gofaster than if Oracle has to build the database from scratch. You can alsochoose Custom and create your own template. We will choose GeneralPurpose here. Click Next.

    d. The Database Identification window appears. Here you specify the globalname and the instance name (SID) for the database. It would be nice if thesefields defaulted from the ORACLE_SID environment variable, but this may

    or may not happen. In the Global Database Name field, enter the databasename you selected, followed by a period and your domain name. Forexample, dev11ee.dbspecialists.com. The SID field will fill inautomatically from the global name. Click Next.

    e. The Management Options window appears. Here you indicate whether ornot you wish to have the Enterprise Manager tool configured. Grid Controlis Oracles enterprise-wide database management tool. This option will begrayed out if Grid Control infrastructure has not already been established.

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    20/28

    Database Control is a stand-alone management tool specifically configuredto manage one database. If Grid Control is not present, the defaults in thiswindow will specify to configure Database Control for this database. Thiswill enable you to perform many database management functions for thisdatabase from a web browser. You may optionally configure Database

    Control to send you alerts via email and to back up the database daily. Itdoes not hurt to choose Database Control configuration at this timeyoucan always shut it down later. We will not be covering the database backupfeature here. Click Next.

    f. The Database Credentials window appears. Every Oracle 11g database hasaccounts called SYS, SYSTEM, DBSNMP, and SYSMAN. You mustprovide passwords for each of these accounts, although you can choose togive all four the same password. It is easy to change passwords later, andmembers of the dba Linux group can access the database without apassword and change passwords for any database account. Enter the initialpasswords for these accounts and click Next. Your password should have a

    minimum of 8 characters in length and contain at least one upper casecharacter, one lower case character and one digit.g. The Database File Locations window appears. The files that make up an

    Oracle database can be stored on a regular file system or disks managedautomatically by Oracles Automatic Storage Management facility. We willnot be covering ASM here, so keep File System selected. Also on thisscreen you specify where on the file system the files that make up thedatabase should initially reside. It will be easy to change file locations later,and database files can be spread over multiple directories. The defaultoption on this window is to use the file location specified in the template.This is not a good idea as the location specified by the templates goesagainst standard conventions. Instead you should select Use CommonLocation for All Database Files and enter a mount point name followed bythe oradata subdirectory, such as /u01/oradata. The location you enterhere should match one of the directories you created in step 12 of the firstsection above. Click Next.

    h. The Recovery Configuration window appears. A solid backup and recoveryplan is absolutely necessary for any database that will hold data of anyimportance. However, there are many options available and needs varygreatly from one situation to the next. The flash recovery area is used by theFlashback database feature and also by Enterprise Manager if you choseto configure automatic database backups. Archiving, meanwhile, isnecessary for databases that will be backed up while they are open.Archiving can be enabled easily at a later time. Since we are not coveringbackup and recovery strategies here, we will uncheck both options and clickNext.

    i. The Database Content window appears, it appears two tabs. Typically therewill be no need for you to specify any custom scripts, and preloading thesample schemas can be helpful in a development database for seeingexamples of various techniques. Make your selections and click Next.

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    21/28

    j. The Initialization Parameters window appears. Tabs in this window let youset various initialization parameters, and a button lets you view and edit allparameters in a tabular form. Click on the Character Sets tab and select thecharacter set for the database that matches the character set name you putinto the oraenv script in an earlier step. It is hard to change the character set

    of a database, so make sure you are happy with your selection beforeproceeding. Initialization parameters, on the other hand, are easily changedlater. In this window, therefore, you should make sure the character set iscorrect but not worry too much about the other settings. (Setting thecharacter sets is very different from setting initialization parameters, so thefact that the Character Sets tab appears on a window entitled InitializationParameters may be confusing.) Click Next.

    k. The Database Storage window appears. Here you can review and edit thedetails of how the control files, online redo logs, data files, and tablespaceswill be created. If you are using one of the templates that was provided, youwill not be able to change very many settings. If you want to change the

    locations of some of the database files, you can do that here or after thedatabase has been created. The default redo log size (50 Mb) is somewhatsmall, so you might want to change it. Again, you can do that here or afterthe database has been created. When you are satisfied with the settings,click Next.

    l. The Creation Options window appears. You may choose to create thedatabase now, generate scripts to create the database later, and/or save thesettings as a template. Saving as a template allows you to create thedatabase at a later time or create many similar databases more easily. Makeyour selection and click Finish.

    m. A Confirmation window appears. Review all of your selections and clickOK.

    n. A progress window appears and database creation proceeds.o. When database creation is complete, a window will appear which indicates

    the name of the database, the location of the parameter file, and the URL foraccessing Enterprise Manager. Note this URL for future reference.Depending on what options you selected, additional accounts may havebeen created on the database besides the basic SYS, SYSTEM, DBSNMP,and SYSMAN. All additional accounts are now locked. You may click thePassword Management button to unlock these accounts and set passwords ifyou wish, but you should only unlock an account if you have a specificreason for doing so. When you are finished, click the Exit button to exit theDatabase Creation Assistant.

    38. While logged onto the database server as the oracle user, run the followingcommands to set environment variables so that you will be able to access thedatabase easily (substitute your Oracle instance name):

    39. $ export ORACLE_SID=dev11ee40. $ export ORAENV_ASK=NO

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    22/28

    $ . /usr/local/bin/oraenv

    41. Now we have a database you can verify that Oracle Net is configured correctly byattempting to access the database from an application server or other remote server,or by using commands like the following on the database server directly:

    42. $ sqlplus /nolog

    43. SQL> CONNECT system@dev11eeEnter password:

    If you receive the error ORA-12170: TNS:Connect timeout occurred you shouldcheck your Linux firewall settings, if the firewall is active you will need to open upports 1521 and 1158.

    44. If you would like to move any of the data files or online redo logs for this databaseto another directory, use commands like the following:

    45. $ sqlplus /nolog46.47. SQL> CONNECT / AS SYSDBA48. SQL> SHUTDOWN IMMEDIATE49. SQL> STARTUP MOUNT50. SQL> HOST mv -i /u01/oradata/dev11ee/users01.dbf

    /u02/oradata/dev11ee/users01.dbf51. SQL> ALTER DATABASE RENAME FILE52. 2 '/u01/oradata/dev11ee/users01.dbf' TO53. 3 '/u02/oradata/dev11ee/users01.dbf';54. SQL> HOST mv -i /u01/oradata/dev11ee/redo01.log

    /u02/oradata/dev11ee/redo01.log55. SQL> ALTER DATABASE RENAME FILE56. 2 '/u01/oradata/dev11ee/redo01.log' TO57. 3 '/u02/oradata/dev11ee/redo01.log';58. SQL> ALTER DATABASE OPEN;

    SQL> EXIT

    Note that this procedure does not work for control files. Relocating database controlfiles will be covered in a later step.

    59. In databases created with supplied templates, all data files have the auto-extendfeature turned on. This means that when a data file becomes full, it will

    automatically grow larger as needed. The problem with this is that an applicationcan get out of control and fill up an entire disk partition. It also means that you needto manage your free space at the operating system level. Many DBAs prefer tomanage free space at the database level by pre-allocating space to data files and notusing the auto-extend feature. You may resize data files and disable auto-extendwith commands like:

    60. $ sqlplus /nolog61.62. SQL> CONNECT / AS SYSDBA

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    23/28

    63. SQL> ALTER DATABASE DATAFILE '/u01/oradata/dev11ee/system01.dbf'AUTOEXTEND OFF;

    64. SQL> ALTER DATABASE DATAFILE '/u01/oradata/dev11ee/sysaux01.dbf'AUTOEXTEND OFF;

    65. SQL> ALTER DATABASE DATAFILE'/u01/oradata/dev11ee/undotbs01.dbf' AUTOEXTEND OFF;

    66. SQL> ALTER DATABASE DATAFILE '/u01/oradata/dev11ee/users01.dbf'AUTOEXTEND OFF;

    67. SQL> ALTER DATABASE TEMPFILE '/u01/oradata/dev11ee/temp01.dbf'AUTOEXTEND OFF;

    68.69. SQL> ALTER DATABASE DATAFILE '/u01/oradata/dev11ee/system01.dbf'

    RESIZE 850m;70. SQL> ALTER DATABASE DATAFILE '/u01/oradata/dev11ee/sysaux01.dbf'

    RESIZE 700m;71. SQL> ALTER DATABASE DATAFILE

    '/u01/oradata/dev11ee/undotbs01.dbf' RESIZE 50m;72. SQL> ALTER DATABASE DATAFILE '/u01/oradata/dev11ee/users01.dbf'

    RESIZE 20m;SQL> ALTER DATABASE TEMPFILE '/u01/oradata/dev11ee/temp01.dbf'

    RESIZE 50m;

    73. Oracle uses a server parameter file or spfile to store the initialization parameterssettings that affect the instance. The default parameter settings provided by theDatabase Configuration Assistant are not bad, but you may want to make somechanges. Unfortunately, you cannot edit the spfile. Instead, you must export thecontents of the spfile to a plain text file called a pfile. You can then edit the pfileand convert it back to an spfile for use on your database. (This might soundconfusing, but is actually pretty straightforward.)

    Shut down the database and export the contents of the spfile into a pfile that you

    can edit with commands like:

    $ sqlplus /nolog

    SQL> CONNECT / AS SYSDBASQL> CREATE PFILE='/home/oracle/dev11ee-params.txt'2 FROM SPFILE;

    SQL> SHUTDOWN IMMEDIATE

    74. Make a backup copy of the pfile you created in the previous step and edit the pfileto change parameters as you wish, based on your needs and your serverscapabilities. You can always change parameters again in the future, so you are not

    locking yourself into anything right now. Here is the pfile that we ended up with:75. *.audit_file_dest='/u01/app/oracle/admin/dev11ee/adump'76. *.audit_trail='db'77. *.compatible='11.2.0.0.0'78. *.control_files='/u01/oradata/dev11ee/control01.ctl',79. '/u01/oradata/dev11ee/control02.ctl'80. *.db_block_size=819281. *.db_domain='dbspecialists.com'82. *.db_name='dev11ee'83. *.diagnostic_dest='/u01/app/oracle'

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    24/28

    84. *.memory_target=44249907285. *.open_cursors=30086. *.processes=15087. *.remote_login_passwordfile='EXCLUSIVE'

    *.undo_tablespace='UNDOTBS1

    88. The database is created with two control files. The control file is a pretty small filethat contains crucial configuration and synchronization information that Oracleneeds in order to locate all the files that make up the database and keep themconsistent. All copies of the control file are kept identical; whatever Oracle writesto one control file it also writes to the others. (Think of it like software mirroring.)It is a good idea to move one of the control files to another location. With thedatabase shut down, you can go ahead and move the control files around as youwish. Be sure to change the control_files entry in your pfile accordingly.

    89. Remove the existing spfile that the Database Configuration Assistant created, andthe bogus pfile that it left behind, with the following commands:

    90. $ rm -i $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora$ rm -i $ORACLE_HOME/dbs/init.ora

    91. Create a symbolic link from the location where Oracle looks for the spfile to thelocation where you will actually maintain the spfile:

    92. $ ln -s $ORACLE_BASE/admin/$ORACLE_SID/pfile/spfile$ORACLE_SID.ora \

    $ORACLE_HOME/dbs/spfile$ORACLE_SID.ora

    93. Now convert the pfile that you edited back into an spfile that Oracle can use with

    the following commands:94. $ sqlplus /nolog95. SQL> CONNECT / AS SYSDBA96. SQL> CREATE SPFILE='$ORACLE_BASE/admin/

    $ORACLE_SID/pfile/spfile$ORACLE_SID.ora'2 FROM PFILE='/home/oracle/dev11ee-params.txt';

    97. You are now ready to restart your database using your newly created spfile. Use thefollowing commands to start the database and view the parameters that are in effect.These settings should match what you put in your pfile a few steps back:

    98. $ sqlplus /nolog99. SQL> CONNECT / AS SYSDBA100. SQL> STARTUP

    101. SQL> SET PAGESIZE 100102. SQL> SELECT name, value, isdefault103. 2 FROM v$parameter

    3 ORDER BY isdefault, name;

    104. You can follow the above few steps at any time to make further changes tothe parameters. However, if you only have a few changes to make, there is a much

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    25/28

    easier way than exporting the spfile into a pfile, editing the pfile, and convertingback to an spfile. You can simply:

    105. $ sqlplus /nolog106. SQL> CONNECT / AS SYSDBA107. SQL> ALTER SYSTEM SET parameter = value

    2 SCOPE = SPFILE;

    This will update the setting in your spfile, and the change will take effect the nexttime you restart the instance. Many parameters are dynamic, meaning that you canchange them on the fly without restarting the instance. For dynamic parameters,you can omit the SCOPE = line above and Oracle will change the parameter settingimmediately and in the spfile. If you wish to unset a parameter use the followingsyntax

    SQL> ALTER SYSTEM RESET SCOPE=SPFILE SID='*'

    108. At this point you are ready to create tablespaceslogical groupings of datafilesto hold your application data. You can put all of your data into onetablespace, or you can separate data into multiple tablespaces based on object type,object size, permanence, volatility, I/O volume, or any of a number of other criteria.In the past, choosing storage parameters and allocation schemes for databaseobjects was rather tedious. Now it is quite simple because you can have Oracle dothe space allocation and management automatically and it will do a pretty good job.Here is a sample tablespace creation statement for an application called Flex:

    109. CREATE TABLESPACE flex_data110. DATAFILE '/u02/oradata/dev11ee/flex_data01.dbf' SIZE 500m

    SEGMENT SPACE MANAGEMENT AUTO;

    111. Create application roles if desired. Alternatively, you can use the defaultroles CONNECT, RESOURCE, and DBA.

    112. Create your application accounts that will own the application schemas. Setthe default tablespace to one of your application tablespaces designated to holdtables. Assign quotas on all of the application tablespaces where the account willneed to be able to create schema objects. (You can use the keyword UNLIMITED.)You should not set any quota on the SYSTEM, SYSAUX, or TEMP tablespaces.

    Do not plan to create any application objects in the SYS or SYSTEM schemas, orstore any application objects in the SYSTEM, SYSAUX, or TEMP tablespaces.Here is a sample application account creation statement:

    113. CREATE USER bob IDENTIFIED BY bob123114. DEFAULT TABLESPACE flex_data

    QUOTA UNLIMITED ON flex_data;

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    26/28

    115. Grant roles and/or system privileges to the application accounts. Note that ifyou grant the RESOURCE role to an account, that account will also receive theUNLIMITED TABLESPACE system privilege. This will let the account createobjects in any tablespace, regardless of quotas. Think very carefully before grantingthe DBA role or allowing any accounts that have the UNLIMITED TABLESPACE

    privilege. Sample statements to grant and revoke privileges are as follows:116. GRANT connect, resource TO bob;REVOKE unlimited tablespace FROM bob;

    117. Review the overall security of your database. Oracle Corporation haspublished a very detailed 25 page listing of recommended security checks.Download it from Oracle Technology Network athttp://www.oracle.com/technology/deploy/security/database-security/pdf/twp_security_checklist_database.pdf.

    Complete the Server Configuration

    These steps complete the configuration of your server for smooth Oracle operation. In thissection we will change the oracle users login script to eliminate hardcoding, createindividual operating system accounts for each database user, and configure the server tostart the database and listeners automatically whenever the server is rebooted.

    1. Edit the login file (.bash_profile or .profile) for the oracle user to eliminatehardcodings and call the oraenv script to set the environment instead. The followingwill work with Bash, Bourne, or Korn shell:

    2. # Settings for Oracle environment3. ORACLE_SID=dev11ee # Put your instance name here4. ORAENV_ASK=NO

    5. export ORACLE_SID ORAENV_ASK6. . oraenv7. ORAENV_ASK=YES8.

    Note that this script assumes that the /usr/local/bin directory is on your path. Also,if you use C shell then you should edit .cshrc and have it source coraenv.

    9. Create separate Linux accounts for DBAs and database users who will log onto thedatabase server directly. You should only log in as oracle when installing or

    patching software or stopping/starting the database. The Linux accounts for DBAsshould be members of the dba group, and other users should not be members of thedba group. Give each of these accounts a login file like oracles so that theirenvironment initializes correctly when they log in.

    http://www.oracle.com/technology/deploy/security/database-security/pdf/twp_security_checklist_database.pdfhttp://www.oracle.com/technology/deploy/security/database-security/pdf/twp_security_checklist_database.pdfhttp://www.oracle.com/technology/deploy/security/database-security/pdf/twp_security_checklist_database.pdfhttp://www.oracle.com/technology/deploy/security/database-security/pdf/twp_security_checklist_database.pdf
  • 7/31/2019 Installing and Configuring Oracle Database 11g

    27/28

  • 7/31/2019 Installing and Configuring Oracle Database 11g

    28/28

    $ ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora$ ln -s /etc/init.d/dbora /etc/rc0.d/K10dbora$ ln -s /etc/init.d/dbora /etc/rc1.d/K10dbora$ ln -s /etc/init.d/dbora /etc/rc2.d/K10dbora$ ln -s /etc/init.d/dbora /etc/rc4.d/K10dbora$ ln -s /etc/init.d/dbora /etc/rc6.d/K10dbora

    Alternatively, you may use the chkconfig command to create the links as follows:

    $ cd /etc/init.d$ /sbin/chkconfig --add dbora

    Conclusion

    This paper walks you through the intricate details of getting Oracle Database 11g release 2up and running on a database server running Linux. It may look complicated, but thatsonly because this paper goes down to a nitty-gritty level of detail.

    Please keep in mind, though, that the requirements are different for every Oracleimplementation. We are extremely confident that if you follow these steps to install OracleDatabase 11g release 2 (Oracle version 11.2.0) on a server with Red Hat Enterprise Linuxand an x86_64 hardware platform, the process will go very smoothly for you. Thingsshould go nearly as smoothly if you use another Linux distribution certified by Oracle oranother hardware platform such as x86. However, no single document can address everyspecific hardware configuration and every set of business needs. Please use this paper as astarting point to get Oracle up and running in your shop. To get the best performance andscalability, each system needs to be considered individually.