part_1_install os and oracle.docx

96
Install Oracle Database 11g R2 on Linux - (RHEL 6) Rearranged by Oracle Users Group Unindra (OUGU) Contents Introduction Example Configuration Install the Linux Operating System Install Required Linux Packages for Oracle Create oracle User and Directories Configure the Linux Operating System for Oracle Network Configuration Download Oracle Database Software Pre-Installation Tasks Install Oracle Database Install Oracle Database Examples Configure Oracle Networking Create the Oracle Database Post Database Creation Tasks - (Optional) Configure Automatic Database Starting and Stopping Miscellaneous Options About the Author Introduction This article is a comprehensive guide for installing Oracle Database 11g Release 2 (11.2.0.1) on the Red Hat Enterprise Linux 6 (RHEL6) operating environment. The example database created in this guide will use the local file system for all physical database file storage (data files, control files, online redo log files, fast recovery area). Supported Platforms Both 32-bit (x86) and 64-bit (x86_64) architectures are covered in this guide. Unless otherwise noted, the installation steps are the same for either. Having said that, one of the first decisions to make ::: ORACLE USERS GROUP UNINDRA

Upload: djono

Post on 30-Oct-2014

19 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Part_1_Install OS and Oracle.docx

Install Oracle Database 11g R2 on Linux - (RHEL 6)Rearranged by Oracle Users Group Unindra (OUGU)

Contents

Introduction Example Configuration Install the Linux Operating System Install Required Linux Packages for Oracle Create oracle User and Directories Configure the Linux Operating System for Oracle Network Configuration Download Oracle Database Software Pre-Installation Tasks Install Oracle Database Install Oracle Database Examples Configure Oracle Networking Create the Oracle Database Post Database Creation Tasks - (Optional) Configure Automatic Database Starting and Stopping Miscellaneous Options About the Author

Introduction

This article is a comprehensive guide for installing Oracle Database 11g Release 2 (11.2.0.1) on the Red Hat Enterprise Linux 6 (RHEL6) operating environment. The example database created in this guide will use the local file system for all physical database file storage (data files, control files, online redo log files, fast recovery area).

Supported Platforms

Both 32-bit (x86) and 64-bit (x86_64) architectures are covered in this guide. Unless otherwise noted, the installation steps are the same for either. Having said that, one of the first decisions to make before continuing with this guide is which architecture you will be using. Both Oracle and Linux must be installed on the same operating system architecture. For example, 32-bit Oracle is only supported to run on 32-bit Linux OS and 64-bit Oracle is only supported to run on 64-bit Linux OS.

Oracle Documentation

While this guide provides detailed instructions for successfully installing a complete Oracle Database 11g Release 2 system, it is by no means a substitute for the official Oracle documentation (see list below). In addition to this guide, users should also consult the

::: ORACLE USERS GROUP UNINDRA

Page 2: Part_1_Install OS and Oracle.docx

following Oracle documents to gain a full understanding of alternative configuration options, installation, and administration with Oracle Database. Oracle's official documentation site is docs.oracle.com.

Goals for this Article

By the time you finish this article; the following will be installed and configured.

Oracle Database 11g Release 2 (11.2) software installed on a local file system (namely /u01/app/oracle/product/11.2.0/dbhome_1).

Oracle Database 11g Examples (formerly Companion). Default Oracle Net Listener running on the system. A fully configured general-purpose Oracle 11g database that makes use of the local file

system for physical database file storage (data files, control files, online redo log files, fast recovery area).

Optional instructions are included to put the new database into Archive Log Mode. Oracle Enterprise Manager Database Control running and can be accessed using a

Web browser.

Example Configuration

This section describes the hardware and Oracle configuration parameters that will be used in this guide.

Hardware

The machine used for this guide will consist of an AMD Athlon™ 64 X2 Dual Core Processor 3800+ running CentOS Release 6.2 (x86_64). The server has 4GB of memory and contains four (4) internal hard disks that will be configured using Logical Volume Manager (LVM). Four LVM Volume Groups will be created along with separate logical volumes used to store the Linux operating system, swap, Oracle Database Software, database files, and the fast recovery area.

::: ORACLE USERS GROUP UNINDRA

Page 3: Part_1_Install OS and Oracle.docx

Oracle Server Configuration

Machine Name IP Address Processor Operation Environment Memory

testnode1.idevelopment.info 192.168.1.106 1 x AMD Athlon™ 64 X2 Dual Core Processor 3800+ CentOS Release 6.2 - (64-bit) 4GB

Physical Disks

Hard Drive Partition Size - (MB) Type Usage Mount Point

   /dev/sda /dev/sda1 500 ext4 Boot Volume /boot

/dev/sda2 36,363 Physical Volume (LVM) LVM    vg_testnode1

   /dev/sdb /dev/sdb1 36,863 Physical Volume (LVM) LVM    vg_orasoftware

   /dev/sdc /dev/sdc1 36,863 Physical Volume (LVM) LVM    vg_oradata

   /dev/sdd /dev/sdd1 36,863 Physical Volume (LVM) LVM    vg_orafra

Logical Volumes

LVM Volume Group Logical Volume Size - (MB) Type Usage Mount Point

   vg_testnode1 lv_root 30,248 ext4 Linux OS /

lv_swap 6,112 swap Swap  

   vg_orasoftware lv_orasoftware 36,860 ext4 Oracle Database Software /u01

   vg_oradata lv_oradata 36,860 ext4 Database Files /u02

   vg_orafra lv_orafra 36,860 ext4 Fast Recovery Area /u03

::: ORACLE USERS GROUP UNINDRA

Page 4: Part_1_Install OS and Oracle.docx

Oracle Configuration

The following is an introduction to some of the configuration parameters and directory paths that will be used for installing the Oracle Database Software and creating a fully functional Oracle 11g database.

Oracle Software Owner

O/S User Primary Group Supplementary Groups Home Directory

oracle (501) oinstall (501) dba (502), oper (503) /home/oracle

Oracle Software Components

Software Component Version

Oracle Database Oracle Database 11g Release 2 (11.2.0.1.0) for Linux x86-64

Oracle Database Names

Software Component Oracle SID Global Database Name

Oracle Database testdb1 testdb1.idevelopment.info

Oracle Software and Database Storage Paths

Description Directory

Oracle Base directory /u01/app/oracle

Oracle Home directory for Oracle Database /u01/app/oracle/product/11.2.0/dbhome_1

Oracle Data directory /u02/app/oracle/oradata

Data files for db_name1 database /u02/app/oracle/oradata/db_name1

Sub-tree for Recovery files /u03/app/oracle/fast_recovery_area

Recovery files for db_name1 database /u03/app/oracle/fast_recovery_area/db_name1

This guide adheres to the latest Optimal Flexible Architecture (OFA) standard for Oracle Database 11g Release 2 (11.2) for Linux.

::: ORACLE USERS GROUP UNINDRA

Page 5: Part_1_Install OS and Oracle.docx

Install the Linux Operating System

This section provides a summary of the steps used to install the Linux operating system. This guide is designed to work with CentOS 6, Oracle Linux 6, or Red Hat Enterprise Linux 6 and follows Oracle's suggestion of performing a "Basic Server" installation type to ensure all expected Linux OS packages are present for a successful Oracle Database installation.

The CentOS project takes the Red Hat Enterprise Linux source RPMs and compiles them into a free clone of the Red Hat Enterprise Server product. This provides a free and stable version of the Red Hat Enterprise Linux (AS/ES) operating environment that I can use for Oracle testing and development.

Download CentOS

Use the links below to download CentOS 6.2 for either x86 or x86_64 depending on your hardware architecture.

64-bit (x86_64) Installations

CentOS-6.2-x86_64-bin-DVD1.iso    (4.1 GB) CentOS-6.2-x86_64-bin-DVD2.iso    (1.2 GB)

32-bit (x86) Installations

CentOS-6.2-i386-bin-DVD1.iso    (3.6 GB) CentOS-6.2-i386-bin-DVD2.iso    (1.0 GB)

Burn Binary Image to DVD

If you are downloading the above ISO files to a MS Windows machine, there are many options for burning these images (ISO files) to a DVD. You may already be familiar with and have the proper software to burn images to DVD. If you are not familiar with this process and do not have the required software to burn images to DVD, here are just three of the many software packages that can be used.

InfraRecorder

UltraISO

Magic ISO Maker

::: ORACLE USERS GROUP UNINDRA

Page 6: Part_1_Install OS and Oracle.docx

Install CentOS

After downloading and burning the CentOS images (ISO files) to a DVD, insert CentOS Disk #1 into the server, power it on, and answer the installation screen prompts as noted below.

Screen Name Response

Boot Screen

The first screen is the CentOS 6.2 boot screen. Select the option Install or upgrade an existing system.

Media Test

When asked to test the CD media, tab over to [Skip] and hit [Enter]. If there were any errors, the media burning software would have warned us. After several seconds, the installer should then detect the video card, monitor, and mouse. The installer then goes into GUI mode.

Welcome to CentOS At the welcome screen, click [Next] to continue.

::: ORACLE USERS GROUP UNINDRA

Page 7: Part_1_Install OS and Oracle.docx

Screen Name Response

Language Selection

Select the appropriate language for your configuration and click [Next] to continue.

Keyboard Selection Select the appropriate keyboard for your configuration and click [Next] to continue.

::: ORACLE USERS GROUP UNINDRA

Page 8: Part_1_Install OS and Oracle.docx

Screen Name Response

Storage Options

This example will use local internal disks for the OS installation and therefore only requires the "Basic Storage Devices" option. Select the appropriate storage option for your configuration and click [Next] to continue.

Storage Device Warning The installer will display a warning dialog which indicates that the storage device may contain important data or that the device may need to be re-initialized. Select the option to discard any data or to re-initialize the device.

::: ORACLE USERS GROUP UNINDRA

Page 9: Part_1_Install OS and Oracle.docx

Screen Name Response

Host Name

Enter a fully qualified host name for this computer, then click the [Configure Network] button.

Select Connection The installer should have successfully detected the installed network device(s) and listed them as connections. Highlight the relevant connection and click the [Edit] button.

::: ORACLE USERS GROUP UNINDRA

Page 10: Part_1_Install OS and Oracle.docx

Screen Name Response

Manually ConfigureIP Address

Check the "Connect automatically" check-box.It is not recommended to use DHCP for an Oracle Database server so this guide will use the traditional method of manually assigning a static IP address. The settings you make here will, of course, depend on your network configuration.

To manually configure an IP address, click on the "IPv4 Settings" tab, set the method to "Manual", click the [Add] button and enter the appropriate network details. After verifying the network configuration, click the [Apply] and [Close] buttons to return to the host name screen, then click the [Next] button.

::: ORACLE USERS GROUP UNINDRA

Page 11: Part_1_Install OS and Oracle.docx

Screen Name Response

Time Zone

Select the appropriate time zone for your environment and click [Next] to continue.

Set Root Password

Select a root password and click [Next] to continue.

Partition Type Select the appropriate partition type for your configuration. In order to modify the default partitioning layout, check the "Review and modify partitioning layout" option. Click [Next] to continue.

::: ORACLE USERS GROUP UNINDRA

Page 12: Part_1_Install OS and Oracle.docx

Screen Name Response

Select SystemDrive(s) — (optional)

If the machine is configured with multiple storage devices, select which device (or devices) to include as system drives. Any selected devices will be used as system drives and will be formatted by the installer and included as the target for the OS install.

After selecting which devices will be system drives, indicate which of them will have the bootloader installed. In this guide, only one of the devices will be used for the system drive.

Disk Partitioning The installer will present a default partitioning scheme for the current disk sizes. Modify any volumes as required. The settings you make here will, of course, depend on your

::: ORACLE USERS GROUP UNINDRA

Page 13: Part_1_Install OS and Oracle.docx

Screen Name Response

storage configuration.

Ensure enough swap space is allocated as required by Oracle (which is a multiple of the available RAM). The following is Oracle's minimum requirement for swap space:

Available RAM Swap Space Required

Between 1 GB and 2 GB 1.5 times the size of RAM

Between 2 GB and 16 GB Equal to the size of RAM

More than 16 GB 16 GB

Once you are satisfied with the disk layout, click [Next] to continue, then the [Format] and [Write changes to disk] buttons on the following warning dialogs.

Boot Loader In almost all cases, the installer will choose the correct boot loader options. Accept the boot loader settings by clicking the [Next] button to continue.

::: ORACLE USERS GROUP UNINDRA

Page 14: Part_1_Install OS and Oracle.docx

Screen Name Response

Installation Type

Choose the "Basic Server" installation, check the "Customize now" option, and then click [Next] to continue.

Package Group Selection

By default, CentOS installs most of the software required for a typical server. There are, however, several other packages (RPMs) that are required to successfully install the Oracle database software. By choosing the "Customize now" option in the previous screen, the installer brings up the "Package Group Selection" screen which allows you to select the required package groups and individual packages within the details section

::: ORACLE USERS GROUP UNINDRA

Page 15: Part_1_Install OS and Oracle.docx

Screen Name Response

(Optional packages).

Choose the following package groups to prepare the machine for an Oracle database install as well as setting up a typical gnome desktop. Note that alternative installations may require more packages to be loaded in addition to the ones listed below.

Applications > Emacs *Applications > Internet Browser *Base System > BaseBase System > Client management toolsBase System > Compatibility librariesBase System > Console internet tools *Base System > Console internet tools > ftp *Base System > Hardware monitoring utilitiesBase System > Large Systems PerformanceBase System > Network file system clientBase System > Performance ToolsBase System > Perl SupportBase System > iSCSI Storage Client *Desktops > DesktopDesktops > Desktop PlatformDesktops > FontsDesktops > General Purpose DesktopDesktops > Graphical Administration ToolsDesktops > Input MethodsDesktops > X Window SystemDevelopment > Additional DevelopmentDevelopment > Development ToolsServers > Server PlatformServers > System administration tools* — Optional packageAfter selecting the appropriate package groups, click [Next] to continue.

::: ORACLE USERS GROUP UNINDRA

Page 16: Part_1_Install OS and Oracle.docx

Screen Name Response

Installation Process

The CentOS install process will start immediately. Wait for the installation to complete.

Reboot System

After all of the packages and bootloader have been installed, the installer will eject the DVD from the drive. Take out the DVD and click [Reboot] to reboot the system and complete the installation.

Post Installation WizardWelcome Screen

When the system boots into CentOS Linux for the first time, it will prompt you with another welcome screen for the "Post Installation Wizard". The post installation wizard allows you to make final OS configuration settings. On the "Welcome screen", click [Forward] to continue.

::: ORACLE USERS GROUP UNINDRA

Page 17: Part_1_Install OS and Oracle.docx

Screen Name Response

License Agreement

Accept the license agreement and click [Forward] to continue.

Create User Create any additional (non-oracle) operating system user accounts if desired and click [Forward] to continue.If you chose not to define any additional operating system user accounts, click [Yes] to acknowledge the warning dialog.

::: ORACLE USERS GROUP UNINDRA

Page 18: Part_1_Install OS and Oracle.docx

Screen Name Response

Date and Time

Adjust the date and time settings if necessary and click [Forward] to continue.

Kdump Accept the default setting on the Kdump screen and click [Forward] to continue.

::: ORACLE USERS GROUP UNINDRA

Page 19: Part_1_Install OS and Oracle.docx

Screen Name Response

Reboot System

Enabling Kdump requires the machine to be rebooted in order to reallocate memory accordingly. Click [Yes] on the warning dialog to reboot the system.

Login Screen After the machine boots, you are presented with the login screen. Log in to the system by clicking on a user in the login screen or choose "Other..." to log in as root.

::: ORACLE USERS GROUP UNINDRA

Page 20: Part_1_Install OS and Oracle.docx

Screen Name Response

User Desktop

After successfully logging in to the system, you are ready to start using the desktop.

::: ORACLE USERS GROUP UNINDRA

Page 21: Part_1_Install OS and Oracle.docx

Disable Firewall

Use the following steps to disable the firewall.

1. Open the "Firewall Configuration" dialog (System > Administration > Firewall).2. Click the [Close] button on the startup dialog and type in the "root" password if requested.3. On the resulting dialog, click the [Disable] button, followed by the [Apply] button on the

toolbar.

     

Figure 1: Disable Firewall

4. Click the [Yes] button on the confirmation dialog.5. Quit the "Firewall Configuration" dialog.

Or use following via command line:

1. Login as root user

2. /etc/init.d/iptables stop

3. chkconfig iptables off

::: ORACLE USERS GROUP UNINDRA

Page 22: Part_1_Install OS and Oracle.docx

Disable SELinux

Disable SELinux by editing the "/etc/selinux/config" file, making sure the SELINUX flag

is set as follows.

SELINUX=disabled

Once the change is complete, restart the server.

Install Required Linux Packages for Oracle

After installing the Linux OS, the next step is to verify and install all packages required for Oracle Database 11g Release 2. The Oracle Universal Installer (OUI) performs checks on the machine during installation to verify that it meets the appropriate operating system package requirements. To ensure that these checks complete successfully, verify the software requirements documented in this section before starting the Oracle install.

Although many of the required packages for Oracle were installed during the Linux installation, several will be missing either because they were considered optional within the package group or simply didn't exist in any package group.

The packages listed in this section (or later versions) are required for Oracle database 11g Release 2 running on the Red Hat Enterprise Linux 6, Oracle Linux 6, or CentOS 6 platform.

While it is possible to query each individual package to determine which ones are missing and need to be installed, an easier method is to run the rpm -Uvh PackageName command from

the DVD. For packages that already exist and are up to date, the RPM command will simply ignore the install and print a warning message to the console that the package is already installed.

64-bit (x86_64) Installations

binutils-2.20.51.0.2compat-libcap1-1.10compat-libcap1-1.10 (32-bit)compat-libstdc++-33-3.2.3

::: ORACLE USERS GROUP UNINDRA

[root@testnode1 ~]# reboot

Page 23: Part_1_Install OS and Oracle.docx

compat-libstdc++-33-3.2.3 (32 bit)elfutils-libelf-0.148elfutils-libelf-devel-0.148gcc-4.4.4gcc-c++-4.4.4glibc-2.12-1glibc-2.12-1 (32 bit)glibc-common-2.12glibc-devel-2.12glibc-devel-2.12 (32 bit)glibc-headers-2.12ksh-20100621libaio-0.3.107libaio-0.3.107 (32 bit)libaio-devel-0.3.107libaio-devel-0.3.107 (32 bit)libgcc-4.4.4libgcc-4.4.4 (32 bit)libstdc++-4.4.4libstdc++-4.4.4 (32 bit)libstdc++-devel-4.4.4libstdc++-devel-4.4.4 (32 bit)make-3.81numactl-devel-2.0.3sysstat-9.0.4unixODBC-2.2.14unixODBC-2.2.14 (32 bit)unixODBC-devel-2.2.14

Each of the packages listed above can be found on the CentOS 6 for x86_64 DVDs.

32-bit (x86) Installations

binutils-2.20.51.0.2compat-libcap1-1.10compat-libstdc++-33-3.2.3elfutils-libelf-0.148elfutils-libelf-devel-0.148elfutils-libelf-devel-static-0.148gcc-4.4.4gcc-c++-4.4.4glibc-2.12-1glibc-common-2.12glibc-devel-2.12glibc-headers-2.12kernel-headers-2.6.32ksh-20100621libaio-0.3.107libaio-devel-0.3.107 libgcc-4.4.4libgomp-4.4.4

::: ORACLE USERS GROUP UNINDRA

Page 24: Part_1_Install OS and Oracle.docx

libstdc++-4.4.4libstdc++-devel-4.4.4make-3.81numactl-devel-2.0.3sysstat-9.0.4unixODBC-2.2.14unixODBC-devel-2.2.14

Each of the packages listed above can be found on the CentOS 6 for x86 DVDs.

Create oracle User and Directories

This section provides instructions on how to create the operating system user and groups that will be used to install and manage the Oracle Database 11g Release 2 software. In addition to the Oracle software owner, another OS user (jhunter) will be configured with the appropriate DBA related OS groups to manage the Oracle database.

The following OS groups will be created.

DescriptionOS

Group Name

OS Group

ID

OS Users Assigned to this

Group

Oracle Privileg

e

Oracle Group Name

Oracle Inventory and Software Owner

oinstall

501 oracle    

Database Administrator dba 502 oracle,

jhunterSYSDBA

OSDBA

Database Operator oper 503 oracle, jhunter

SYSOPER

OSOPER

OS Group Descriptions

Oracle Inventory Group (typically oinstall)

This group must be created the first time you install Oracle software on the system. Members of the OINSTALL group are considered the "owners" of the Oracle software and are granted privileges to write to the Oracle central inventory (oraInventory). When you install Oracle software on a Linux system for the first time, OUI creates the /etc/oraInst.loc file. This file identifies the name of the Oracle Inventory group (by default, oinstall), and the path of the Oracle Central Inventory directory.

Ensure that this group is available as a primary group for all planned Oracle software installation owners. For the purpose of this guide, the oracle installation owner will be configured with oinstall as its primary group.

Database Administrator (OSDBA, typically dba)

::: ORACLE USERS GROUP UNINDRA

Page 25: Part_1_Install OS and Oracle.docx

Members of the OSDBA group can use SQL to connect to an Oracle instance as SYSDBA using operating system authentication. Members of this group can perform critical database administration tasks, such as creating the database and instance startup and shutdown. The default name for this group is dba. The SYSDBA system privilege allows access to a database instance even when the database is not open. Control of this privilege is totally outside of the database itself.

The oracle installation owner should be a member of the OSDBA group (configured as a secondary group) along with any other DBA user accounts (i.e. jhunter) needing access to an Oracle instance asSYSDBA using operating system authentication.

The SYSDBA system privilege should not be confused with the database role DBA. The DBA role does not include the SYSDBA or SYSOPER system privileges.

Database Operator (OSOPER, typically oper)

Members of the OSOPER group can use SQL to connect to an Oracle instance as SYSOPER using operating system authentication. Members of this optional group have a limited set of database administrative privileges such as managing and running backups. The default name for this group is oper. The SYSOPER system privilege allows access to a database instance even when the database is not open. Control of this privilege is totally outside of the database itself. To use this group, choose the Advanced installation type to install the Oracle database software.

Create Groups and User for Oracle Database Software

Create the recommended OS groups and user for the Oracle Database software owner.

[root@testnode1 ~]# groupadd -g 501 oinstall[root@testnode1 ~]# groupadd -g 502 dba[root@testnode1 ~]# groupadd -g 503 oper[root@testnode1 ~]# useradd -m -u 501 -g oinstall -G dba,oper -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle

[root@testnode1 ~]# id oracleuid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper)

Create a new password for the oracle account.

[root@testnode1 ~]# passwd oracleChanging password for user oracle.New password: xxxxxxxxxxxRetype new password: xxxxxxxxxxxpasswd: all authentication tokens updated successfully.

Optionally, configure any other OS users with the appropriate DBA related OS groups to manage the Oracle database. Remember to use the append option (-a) to the usermod command so that the user will not be removed from groups not listed.

::: ORACLE USERS GROUP UNINDRA

Page 26: Part_1_Install OS and Oracle.docx

[root@testnode1 ~]# usermod -a -G dba,oper jhunter

[root@testnode1 ~]# id jhunteruid=500(jhunter) gid=500(jhunter) groups=500(jhunter),502(dba),503(oper)

Create Login Script for the oracle User Account

Log in to machine as the oracle user account and create the following login script (.bash_profile). Values marked in red should be customized for your environment.

[root@testnode1 ~]# su - oracle

# ---------------------------------------------------# .bash_profile# ---------------------------------------------------# OS User: oracle# Application: Oracle Database Software Owner# Version: Oracle 11g Release 2# ---------------------------------------------------

# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi

alias ls="ls -FA"

# ---------------------------------------------------# ORACLE_SID# ---------------------------------------------------# Specifies the Oracle system identifier (SID) for# the Oracle instance running on this node. When# using RAC, each node must have a unique ORACLE_SID.# (i.e. racdb1, racdb2,...)# ---------------------------------------------------ORACLE_SID=testdb1; export ORACLE_SID

# ---------------------------------------------------# ORACLE_UNQNAME and ORACLE_HOSTNAME# ---------------------------------------------------# In previous releases of Oracle Database, you were # required to set environment variables for# ORACLE_HOME and ORACLE_SID to start, stop, and# check the status of Enterprise Manager. With# Oracle Database 11g Release 2 (11.2) and later, you# need to set the environment variables ORACLE_HOME, # ORACLE_UNQNAME, and ORACLE_HOSTNAME to use# Enterprise Manager. Set ORACLE_UNQNAME equal to# the database unique name and ORACLE_HOSTNAME to# the hostname of the machine.# ---------------------------------------------------

::: ORACLE USERS GROUP UNINDRA

Page 27: Part_1_Install OS and Oracle.docx

ORACLE_UNQNAME=testdb1; export ORACLE_UNQNAMEORACLE_HOSTNAME=testnode1.idevelopment.info; export ORACLE_HOSTNAME

# ---------------------------------------------------# JAVA_HOME# ---------------------------------------------------# Specifies the directory of the Java SDK and Runtime# Environment.# ---------------------------------------------------JAVA_HOME=/usr/local/java; export JAVA_HOME

# ---------------------------------------------------# ORACLE_BASE# ---------------------------------------------------# Specifies the base of the Oracle directory structure# for Optimal Flexible Architecture (OFA) compliant# database software installations.# ---------------------------------------------------ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

# ---------------------------------------------------# ORACLE_HOME# ---------------------------------------------------# Specifies the directory containing the Oracle# Database software.# ---------------------------------------------------ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME

# ---------------------------------------------------# ORACLE_PATH# ---------------------------------------------------# Specifies the search path for files used by Oracle# applications such as SQL*Plus. If the full path to# the file is not specified, or if the file is not# in the current directory, the Oracle application# uses ORACLE_PATH to locate the file.# This variable is used by SQL*Plus, Forms and Menu.# ---------------------------------------------------ORACLE_PATH=/u01/app/oracle/dba_scripts/sql:$ORACLE_HOME/rdbms/admin; export ORACLE_PATH

# ---------------------------------------------------# SQLPATH# ---------------------------------------------------# Specifies the directory or list of directories that# SQL*Plus searches for a login.sql file.# ---------------------------------------------------# SQLPATH=/u01/app/oracle/dba_scripts/sql; export SQLPATH

# ---------------------------------------------------# ORACLE_TERM# ---------------------------------------------------# Defines a terminal definition. If not set, it# defaults to the value of your TERM environment# variable. Used by all character mode products.

::: ORACLE USERS GROUP UNINDRA

Page 28: Part_1_Install OS and Oracle.docx

# ---------------------------------------------------ORACLE_TERM=xterm; export ORACLE_TERM

# ---------------------------------------------------# NLS_DATE_FORMAT# ---------------------------------------------------# Specifies the default date format to use with the# TO_CHAR and TO_DATE functions. The default value of# this parameter is determined by NLS_TERRITORY. The# value of this parameter can be any valid date# format mask, and the value must be surrounded by # double quotation marks. For example:## NLS_DATE_FORMAT = "MM/DD/YYYY"## ---------------------------------------------------NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT

# ---------------------------------------------------# TNS_ADMIN# ---------------------------------------------------# Specifies the directory containing the Oracle Net# Services configuration files like listener.ora, # tnsnames.ora, and sqlnet.ora.# ---------------------------------------------------TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN

# ---------------------------------------------------# ORA_NLS11# ---------------------------------------------------# Specifies the directory where the language,# territory, character set, and linguistic definition# files are stored.# ---------------------------------------------------ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11

# ---------------------------------------------------# PATH# ---------------------------------------------------# Used by the shell to locate executable programs;# must include the $ORACLE_HOME/bin directory.# ---------------------------------------------------PATH=.:${JAVA_HOME}/bin:$JAVA_HOME/db/bin:${PATH}:$HOME/bin:$ORACLE_HOME/binPATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/binPATH=${PATH}:/u01/app/oracle/dba_scripts/binexport PATH

# ---------------------------------------------------# LD_LIBRARY_PATH# ---------------------------------------------------# Specifies the list of directories that the shared# library loader searches to locate shared object# libraries at runtime.# ---------------------------------------------------

::: ORACLE USERS GROUP UNINDRA

Page 29: Part_1_Install OS and Oracle.docx

LD_LIBRARY_PATH=$ORACLE_HOME/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/libLD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/libexport LD_LIBRARY_PATH

# ---------------------------------------------------# CLASSPATH# ---------------------------------------------------# Specifies the directory or list of directories that# contain compiled Java classes.# ---------------------------------------------------CLASSPATH=$ORACLE_HOME/JRECLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlibCLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant.jarCLASSPATH=${CLASSPATH}:$ORACLE_HOME/oc4j/ant/lib/ant-launcher.jarCLASSPATH=${CLASSPATH}:$JAVA_HOME/db/lib/derby.jarCLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlibexport CLASSPATH

# ---------------------------------------------------# THREADS_FLAG# ---------------------------------------------------# All the tools in the JDK use green threads as a# default. To specify that native threads should be# used, set the THREADS_FLAG environment variable to# "native". You can revert to the use of green# threads by setting THREADS_FLAG to the value# "green".# ---------------------------------------------------THREADS_FLAG=native; export THREADS_FLAG

# ---------------------------------------------------# TEMP, TMP, and TMPDIR# ---------------------------------------------------# Specify the default directories for temporary# files; if set, tools that create temporary files# create them in one of these directories.# ---------------------------------------------------export TEMP=/tmpexport TMPDIR=/tmp

# ---------------------------------------------------# UMASK# ---------------------------------------------------# Set the default file mode creation mask# (umask) to 022 to ensure that the user performing# the Oracle software installation creates files# with 644 permissions.# ---------------------------------------------------umask 022

Verify That the User nobody Exists

::: ORACLE USERS GROUP UNINDRA

Page 30: Part_1_Install OS and Oracle.docx

Before installing the software, complete the following procedure to verify that the user nobody exists on the system.

1. To determine if the user exists, enter the following command.

[root@testnode1 ~]# id nobodyuid=99(nobody) gid=99(nobody) groups=99(nobody)

2. If this command displays information about the nobody user, then you do not have to create that user.

3. If the user nobody does not exist, then enter the following command to create it.

[root@testnode1 ~]# /usr/sbin/useradd nobody

Create the Oracle Base Directory Path

The next step is to configure an Oracle base path compliant with an Optimal Flexible Architecture (OFA) structure and correct permissions. The Oracle base path will be used to store the Oracle Database software.

[root@testnode1 ~]# mkdir -p /u01/app/oracle[root@testnode1 ~]# chown -R oracle:oinstall /u01/app[root@testnode1 ~]# chmod -R 775 /u01/app

Create the Data Files Directory Path

Create the directory that will be used to store the Oracle data files.

[root@testnode1 ~]# mkdir -p /u02/app/oracle/oradata[root@testnode1 ~]# chown -R oracle:oinstall /u02/app[root@testnode1 ~]# chmod -R 775 /u02/app

Create the Fast Recovery Area Directory Path

Create the directory that will be used to store the Oracle recovery files.

[root@testnode1 ~]# mkdir -p /u03/app/oracle/fast_recovery_area[root@testnode1 ~]# chown -R oracle:oinstall /u03/app[root@testnode1 ~]# chmod -R 775 /u03/app

At the end of this section, you should have the following user, groups, and directory path configuration.

::: ORACLE USERS GROUP UNINDRA

Page 31: Part_1_Install OS and Oracle.docx

An Oracle central inventory group, or oraInventory group (oinstall), whose members include oracle. Members of this group have the central inventory group as their primary group and are granted permissions to write to the oraInventory directory.

A separate OSDBA group (dba), whose members include oracle, and who are granted the SYSDBA privilege to administer the Oracle Database.

A separate OSOPER group (oper), whose members include oracle, and who are granted limited Oracle database administrator privileges.

An Oracle Database software owner (oracle), with the oraInventory group as its primary group, and with the OSDBA (dba) and OSOPER (oper) group as its secondary group.

OFA-compliant mount points /u01, /u02, and /u03 that will be used for the Oracle software installation, data files, and recovery files.

During installation, OUI creates the Oracle Inventory directory in the path /u01/app/oraInventory. This path remains owned by oracle:oinstall, to enable other Oracle software owners to write to the central inventory.

An Oracle base /u01/app/oracle owned by oracle:oinstall with 775 permissions. OFA-compliant data directory /u02/app/oracle/oradata owned

by oracle:oinstall with 775 permissions. OFA-compliant recovery files directory /u03/app/oracle/fast_recovery_area owned

by oracle:oinstall with 775 permissions.

Set Resource Limits for the Oracle Software Installation Users

To improve the performance of the software on Linux systems, you must increase the following resource limits for the Oracle software owner (oracle).

Resource Shell LimitItem in

limits.conf

Soft Limit Hard Limit

Open file descriptors nofile at least 1024 at least 65536

Number of processes available to a single user

nproc at least 2047 at least 16384

Size of the stack segment of the process stack

at least 10240 KB

at least 10240 KB, and at most 32768 KB

Use the following to check resource limits.

1. Log in as an Oracle installation owner.2. Check the soft and hard limits for the file descriptor setting. Ensure that the result is in the

recommended range. For example:

[oracle@testnode1 ~]$ ulimit -Sn1024

[oracle@testnode1 ~]$ ulimit -Hn1024

::: ORACLE USERS GROUP UNINDRA

Page 32: Part_1_Install OS and Oracle.docx

3. Check the soft and hard limits for the number of processes available to a user. Ensure that the result is in the recommended range. For example:

[oracle@testnode1 ~]$ ulimit -Su1024

[oracle@testnode1 ~]$ ulimit -Hu31296

4. Check the soft limit for the stack setting. Ensure that the result is in the recommended range. For example:

[oracle@testnode1 ~]$ ulimit -Ss10240

[oracle@testnode1 ~]$ ulimit -Hsunlimited

5. If necessary, update the resource limits in the /etc/security/limits.conf configuration file for the Oracle installation owner by adding the following lines.

oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240

Add the following line to the /etc/pam.d/login file, if it does not already exist.

session required pam_limits.so

Depending on your shell environment, make the following changes to the default shell startup file in order to change ulimit settings for the Oracle installation owner.

For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile file.

if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi

For the C shell (csh or tcsh), add the following lines to the /etc/csh.login file.

::: ORACLE USERS GROUP UNINDRA

Page 33: Part_1_Install OS and Oracle.docx

if ( $USER == "oracle" ) then limit maxproc 16384 limit descriptors 65536endif

Configure the Linux Operating System for Oracle

This section focuses on preparing the Linux operating system for the Oracle Database 11g Release 2 installation. This includes verifying enough memory and swap space, setting shared memory and semaphores, setting the maximum number of file handles, setting the IP local port range, and how to activate all kernel parameters for the system.

The kernel parameters discussed in this section will need to persist through machine reboots. Although there are several methods used to set these parameters, I will be making all changes permanent through reboots by placing all values in the /etc/sysctl.conf file.

Kernel Parameters

The kernel parameters presented in this section are only recommended values as documented by Oracle. For production database systems, Oracle recommends that you tune these values to optimize the performance of the system.

Verify that the kernel parameters described in this section are set to values greater than or equal to the recommended values. Also note that when setting the four semaphore values that all four values need to be entered on one line.

Oracle Database 11g Release 2 for Linux requires the kernel parameter settings shown below. The values given are minimums, so if your system uses a larger value, do not change it.

kernel.shmmax = 4294967295kernel.shmall = 2097152kernel.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 = 1048576fs.file-max = 6815744fs.aio-max-nr = 1048576

Add or amend the following lines in the /etc/sysctl.conf file.

# +---------------------------------------------------------+# | KERNEL PARAMETERS FOR ORACLE DATABASE 11g R2 ON LINUX |# +---------------------------------------------------------+

::: ORACLE USERS GROUP UNINDRA

Page 34: Part_1_Install OS and Oracle.docx

# +---------------------------------------------------------+# | SHARED MEMORY |# +---------------------------------------------------------+

# Maximum size (in bytes) for a shared memory segmentkernel.shmmax = 4294967295

# Maximum amount of shared memory (in pages) that# can be used at one time on the system and should be at# least ceil(SHMMAX/PAGE_SIZE)kernel.shmall = 2097152

# Maximum number of shared memory segments system widekernel.shmmni = 4096

# +---------------------------------------------------------+# | SEMAPHORES |# +---------------------------------------------------------+

# SEMMSL_value SEMMNS_value SEMOPM_value SEMMNI_valuekernel.sem = 250 32000 100 128

# +---------------------------------------------------------+# | NETWORKING |# ----------------------------------------------------------+

# Defines the local port range that is used by TCP and UDP# traffic to choose the local portnet.ipv4.ip_local_port_range = 9000 65500

# Default setting in bytes of the socket "receive" buffer which# may be set by using the SO_RCVBUF socket optionnet.core.rmem_default = 262144

# Maximum setting in bytes of the socket "receive" buffer which# may be set by using the SO_RCVBUF socket optionnet.core.rmem_max = 4194304

# Default setting in bytes of the socket "send" buffer which# may be set by using the SO_SNDBUF socket optionnet.core.wmem_default = 262144

# Maximum setting in bytes of the socket "send" buffer which # may be set by using the SO_SNDBUF socket optionnet.core.wmem_max = 1048576

# +---------------------------------------------------------+# | FILE HANDLES |# ----------------------------------------------------------+

# Maximum number of file-handles that the Linux kernel will allocatefs.file-max = 6815744

# Maximum number of allowable concurrent asynchronous I/O requests

::: ORACLE USERS GROUP UNINDRA

Page 35: Part_1_Install OS and Oracle.docx

requestsfs.aio-max-nr = 1048576

Placing the kernel parameters in the /etc/sysctl.conf startup file persists the required kernel parameters through reboots. Linux allows modification of these kernel parameters to the current system while it is up and running, so there's no need to reboot the system after making kernel parameter changes. To activate the new kernel parameter values for the currently running system, run the following as root.

[root@testnode1 ~]# sysctl -pnet.ipv4.ip_forward = 0net.ipv4.conf.default.rp_filter = 1net.ipv4.conf.default.accept_source_route = 0kernel.sysrq = 0kernel.core_uses_pid = 1net.ipv4.tcp_syncookies = 1net.bridge.bridge-nf-call-ip6tables = 0net.bridge.bridge-nf-call-iptables = 0net.bridge.bridge-nf-call-arptables = 0kernel.msgmnb = 65536kernel.msgmax = 65536kernel.shmmax = 4294967295kernel.shmall = 2097152kernel.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 = 1048576fs.file-max = 6815744fs.aio-max-nr = 1048576

Verify the new kernel parameter values by running the following.

[root@testnode1 ~]# /sbin/sysctl -a | grep shm | sortkernel.shmall = 2097152kernel.shmmax = 4294967295kernel.shmmni = 4096vm.hugetlb_shm_group = 0

[root@testnode1 ~]# /sbin/sysctl -a | grep semkernel.sem = 250 32000 100 128

[root@testnode1 ~]# /sbin/sysctl -a | grep ip_local_port_rangenet.ipv4.ip_local_port_range = 9000 65500

[root@testnode1 ~]# /sbin/sysctl -a | grep 'core\.[rw]mem' | sortnet.core.rmem_default = 262144net.core.rmem_max = 4194304

::: ORACLE USERS GROUP UNINDRA

Page 36: Part_1_Install OS and Oracle.docx

net.core.wmem_default = 262144net.core.wmem_max = 1048576

[root@testnode1 ~]# /sbin/sysctl -a | egrep 'file-max|aio-max' | sortfs.aio-max-nr = 1048576fs.file-max = 6815744

::: ORACLE USERS GROUP UNINDRA

Page 37: Part_1_Install OS and Oracle.docx

Memory

The minimum required RAM for Oracle Database 11g Release 2 running on the Linux platform is 1 GB (although 2 GB or more of RAM is highly recommended).

Use the following command to check the amount of installed RAM on the system.

[root@testnode1 ~]# cat /proc/meminfo | grep MemTotalMemTotal: 4020892 kB

If the size of the installed RAM is less than the required size, then you must install more memory before continuing.

Swap Space

The following table describes the relationship between installed RAM and the configured swap space recommendation.

Available RAM Swap Space Required

Between 1 GB and 2 GB 1.5 times the size of RAM

Between 2 GB and 16 GB Equal to the size of RAM

More than 16 GB 16 GB

Use the following command to determine the size of the configured swap space.

[root@testnode1 ~]# grep SwapTotal /proc/meminfoSwapTotal: 6258680 kB

If necessary, additional swap space can be configured by creating a temporary swap file and adding it to the current swap. This way you do not have to use a raw device or even more drastic, rebuild your system.

1. As root, make a file that will act as additional swap space, let's say about 500MB.

[root@testnode1 ~]# dd if=/dev/zero of=tempswap bs=1k count=500000

2. Next, change the file permissions.

[root@testnode1 ~]# chmod 600 tempswap

3. Finally, format the "partition" as swap and add it to the swap space:

::: ORACLE USERS GROUP UNINDRA

Page 38: Part_1_Install OS and Oracle.docx

[root@testnode1 ~]# mke2fs tempswap[root@testnode1 ~]# mkswap tempswap[root@testnode1 ~]# swapon tempswap

To determine the available RAM and swap space, enter the following command.

[root@testnode1 ~]# free total used free shared buffers cachedMem: 4020892 1209360 2811532 0 49456 925752-/+ buffers/cache: 234152 3786740Swap: 6258680 0 6258680

Automatic Memory Management

Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm) and file descriptors. The shared memory should be sized to be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer.

To determine the amount of shared memory available, enter the following command.

[root@testnode1 ~]# df -h /dev/shm/Filesystem Size Used Avail Use% Mounted ontmpfs 2.0G 288K 2.0G 1% /dev/shm

Network Configuration

During the Linux OS install, we already configured the IP address and host name for the database node. This section contains additional network configuration steps that will prepare the machine to run the Oracle database.

Note that the Oracle database server should have a static IP address configured for the public network (eth0 for this guide). Do not use DHCP naming for the public IP address; you need a static IP address.

Confirm the Node Name is Not Listed in Loopback Address

Ensure that the node name (testnode1) is not included for the loopback address in the /etc/hosts file. If the machine name is listed in the in the loopback address entry as below:

127.0.0.1 testnode1 localhost localhost.localdomain localhost4

::: ORACLE USERS GROUP UNINDRA

Page 39: Part_1_Install OS and Oracle.docx

localhost4.localdomain4

It will need to be removed as shown below:

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4

Confirm Fully Qualified Name for the Server in /etc/hosts

The /etc/hosts file must contain a fully qualified name for the server.

<IP-address> <fully-qualified-machine-name> <machine-name>

For example.

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4192.168.1.106 testnode1.idevelopment.info testnode1

Check and turn off UDP ICMP rejections

During the Linux OS install, I indicated to disable the firewall. By default the option to configure a firewall is selected by the installer. This has burned me several times so I like to do a double-check that the firewall option is not configured and to ensure udp ICMP filtering is turned off.

1. Check to ensure that the firewall option is turned off. If the firewall option is stopped (like it is in my example below) you do not have to proceed with the following steps.

[root@testnode1 ~]# /etc/rc.d/init.d/iptables statusiptables: Firewall is not running.

2. If the firewall option is operating, you will need to first manually disable UDP ICMP rejections.

[root@testnode1 ~]# /etc/rc.d/init.d/iptables stopFlushing firewall rules: [ OK ]Setting chains to policy ACCEPT: filter [ OK ]Unloading iptables modules: [ OK ]

3. Then, turn UDP ICMP rejections off for all subsequent server reboots (which should always be turned off).

[root@testnode1 ~]# chkconfig iptables off

::: ORACLE USERS GROUP UNINDRA

Page 40: Part_1_Install OS and Oracle.docx

::: ORACLE USERS GROUP UNINDRA

Page 41: Part_1_Install OS and Oracle.docx

Download Oracle Database Software

Download and extract the required Oracle software packages from the Oracle Technology Network (OTN), Oracle Software Delivery Cloud (eDelivery), or My Oracle Support (MOS) website depending on your support status.

Oracle Database

OTN : Oracle Database 11 g  Release 2 (11.2.0.1.0) for Linux x86 OTN : Oracle Database 11 g  Release 2 (11.2.0.1.0) for Linux x86-64 eDelivery : Oracle Database 11 g  Release 2 (11.2.0.1) MOS : Oracle Database 11 g  Release 2 (11.2.0.2 or 11.2.0.3)

Oracle Database 11g Release 2 base release (11.2.0.1) is available through the Oracle Software Delivery Cloud (eDelivery) or OTN. If you do not currently have an account with Oracle OTN or eDelivery, you will need to create one. This is a free account. Oracle offers a development and testing license free of charge. No support, however, is provided and the license does not permit production use. A full description of the license agreement is available on OTN.

Oracle Database 11g Release 2 (11.2.0.2) and (11.2.0.3) are only available through My Oracle Support (MOS) and are listed as patch sets in this section.

Access to MOS requires an Oracle Single Sign On (SSO) account (which is the same account used for OTN) and a valid Customer Support Identifier (or CSI). MOS requires a paid software license and support contract and is the only place to download critical updates and patch sets. Starting with the release of the 11.2.0.2 patch set for Oracle Database 11g Release 2, Oracle Database patch sets are full installations of the Oracle Database software (you do not need to download and install 11.2.0.1 first).

Log in as the Oracle software owner (oracle) and download the Oracle Database and Oracle Examples (optional) software to an install directory.

For example /home/oracle/software/oracle.

Oracle Database 11g Release 2 for Linux Oracle Database 11g Release 2 Examples (optional)

Oracle Release 11.2.0.1

Oracle Software Component Release Location Associated Zip File(s)

Oracle Database 11g Release 2

11.2.0.1 OTN / eDelivery / MOSlinux.x64_11gR2_database_1of2.ziplinux.x64_11gR2_database_2of2.zip

Oracle Database 11g Release 2 Examples

11.2.0.1 OTN / eDelivery / MOS linux.x64_11gR2_examples.zip

[oracle@testnode1 ~]$ mkdir -p /home/oracle/software/oracle

::: ORACLE USERS GROUP UNINDRA

Page 42: Part_1_Install OS and Oracle.docx

[oracle@testnode1 ~]$ mv linux.x64_11gR2_database_1of2.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ mv linux.x64_11gR2_database_2of2.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ mv linux.x64_11gR2_examples.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ cd /home/oracle/software/oracle[oracle@testnode1 oracle]$ unzip linux.x64_11gR2_database_1of2.zip[oracle@testnode1 oracle]$ unzip linux.x64_11gR2_database_2of2.zip[oracle@testnode1 oracle]$ unzip linux.x64_11gR2_examples.zip

Oracle Release 11.2.0.2 Patch Set

Oracle Software Component Release MOS Patch Set Associated Zip File(s)

Oracle Database 11g Release 2

11.2.0.2 10098816p10098816_112020_Linux-x86-64_1of7.zipp10098816_112020_Linux-x86-64_2of7.zip

Oracle Database 11g Release 2 Examples

11.2.0.2 10098816 p10098816_112020_Linux-x86-64_6of7.zip

[oracle@testnode1 ~]$ mkdir -p /home/oracle/software/oracle[oracle@testnode1 ~]$ mv p10098816_112020_Linux-x86-64_1of7.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ mv p10098816_112020_Linux-x86-64_2of7.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ mv p10098816_112020_Linux-x86-64_6of7.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ cd /home/oracle/software/oracle[oracle@testnode1 oracle]$ unzip p10098816_112020_Linux-x86-64_1of7.zip[oracle@testnode1 oracle]$ unzip p10098816_112020_Linux-x86-64_2of7.zip[oracle@testnode1 oracle]$ unzip p10098816_112020_Linux-x86-64_6of7.zip

Oracle Release 11.2.0.3 Patch Set

Oracle Software Component Release MOS Patch Set Associated Zip File(s)

Oracle Database 11g Release 2

11.2.0.3 10404530p10404530_112030_Linux-x86-64_1of7.zipp10404530_112030_Linux-x86-64_2of7.zip

Oracle Database 11g Release 2 Examples

11.2.0.3 10404530 p10404530_112030_Linux-x86-64_6of7.zip

[oracle@testnode1 ~]$ mkdir -p /home/oracle/software/oracle[oracle@testnode1 ~]$ mv p10404530_112030_Linux-x86-64_1of7.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ mv p10404530_112030_Linux-x86-64_2of7.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ mv p10404530_112030_Linux-x86-64_6of7.zip /home/oracle/software/oracle[oracle@testnode1 ~]$ cd /home/oracle/software/oracle[oracle@testnode1 oracle]$ unzip p10404530_112030_Linux-x86-64_1of7.zip[oracle@testnode1 oracle]$ unzip p10404530_112030_Linux-x86-64_2of7.zip[oracle@testnode1 oracle]$ unzip p10404530_112030_Linux-x86-64_6of7.zip

::: ORACLE USERS GROUP UNINDRA

Page 43: Part_1_Install OS and Oracle.docx

You should now have a single directory called database and the optional examples directory containing the Oracle installation files.

Install Oracle Database

For the purpose of this example, we will forgo the "Create Database" option when installing the Oracle Database software. The database will be created later in this guide using the Database Configuration Assistant (DBCA) after all installs have been completed.

Log into the node as the Oracle software owner (oracle). If you are using X emulation then

set the DISPLAY environmental variable accordingly.

DISPLAY=<machine-name>:0.0; export DISPLAY

Start the Oracle Universal Installer (OUI) by issuing the following command in the database install directory.

[oracle@testnode1 ~]$ iduid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper)

[oracle@testnode1 ~]$ cd /home/oracle/software/oracle/database[oracle@testnode1 database]$ ./runInstaller

At any time during installation, if you have a question about what you are being asked to do, click the Help button on the OUI page.

The prerequisites checks will fail for the following version-dependent reasons. As mentioned at the beginning of this guide, RHEL6 and OL6 are not certified or supported for use with any Oracle Database version at the time of this writing.

11.2.0.1: The installer shows multiple "missing package" failures because it does not recognize several of the newer version packages that were installed. These "missing package" failures can be ignored as the packages are present. The failure for the "pdksh" package can be ignored because it is no longer part of RHEL6 and we installed the "ksh" package in its place.

11.2.0.2: The installer should only show a single "missing package" failure for the "pdksh" package. The failure for the "pdksh" package can be ignored because it is no longer part of RHEL6 and we installed the "ksh" package in its place.

11.2.0.3: The installer shows no failures and continues normally.

Screen Name Response

Configure Security Updates

To stay informed with the latest security issues, enter your e-mail address, preferably your My Oracle Support e-mail address or user name in the Email field. You can select the "I wish to receive security updates via My Oracle Support" check box to receive security updates. Enter

::: ORACLE USERS GROUP UNINDRA

Page 44: Part_1_Install OS and Oracle.docx

Screen Name Response

your My Oracle Support password in the "My Oracle Support Password" field.For the purpose of this example, un-check the security updates check-box and click the [Next] button to continue.Acknowledge the warning dialog indicating you have not provided an email address by clicking the [Yes] button.

Installation Option

Select "Install database software only".

Grid Options Select "Single instance database installation".

::: ORACLE USERS GROUP UNINDRA

Page 45: Part_1_Install OS and Oracle.docx

Screen Name Response

Product Languages

Make the appropriate selection(s) for your environment.

Database Edition Select "Enterprise Edition".

::: ORACLE USERS GROUP UNINDRA

Page 46: Part_1_Install OS and Oracle.docx

Screen Name Response

Installation Location

Specify the Oracle base and Software location (Oracle home) as follows.   Oracle Base: /u01/app/oracle   Software Location: /u01/app/oracle/product/11.2.0/dbhome_1

Create Inventory Since this is the first install on the host, you will need to create the Oracle Inventory. Use the default values provided by the OUI.

::: ORACLE USERS GROUP UNINDRA

Page 47: Part_1_Install OS and Oracle.docx

Screen Name Response

   Inventory Directory: /u01/app/oraInventory   oraInventory Group Name: oinstall

Operating System Groups

Select the OS groups to be used for the SYSDBA and SYSOPER privileges.   Database Administrator (OSDBA) Group: dba   Database Operator (OSOPER) Group: oper

::: ORACLE USERS GROUP UNINDRA

Page 48: Part_1_Install OS and Oracle.docx

Screen Name Response

Prerequisite Checks

The installer will run through a series of checks to determine if the machine and OS configuration meet the minimum requirements for installing the Oracle Database software.Starting with 11g Release 2, if any checks fail, the installer (OUI) will create shell script programs called fixup scripts to resolve many incomplete system configuration requirements. If OUI detects an incomplete task that is marked "fixable", then you can easily fix the issue by generating the

fixup script by clicking the [Fix & Check Again] button.

The fixup script is generated during installation. You will be prompted to run the script

as root in a separate terminal session. When you run the script, it raises kernel values to

required minimums, if necessary, and completes other operating system configuration tasks.If all prerequisite checks pass, the OUI continues to the Summary screen. If the OUI detected any failed checks, take the appropriate action to resolve it or click the "Ignore All" check box to acknowledge it is safe to continue with the installation without resolving the issue (the "pdksh-5.2.-14" missing package, for example).

Summary Click [Finish] to start the installation.

::: ORACLE USERS GROUP UNINDRA

Page 49: Part_1_Install OS and Oracle.docx

Screen Name Response

Install Product

The installer performs the Oracle Database software installation.

Execute Configuration scripts

After the installation completes, you will be prompted to run the /u01/app/oraInventory/orainstRoot.sh an

d/u01/app/oracle/product/11.2.0/dbhome_1/root.sh scripts. Open a

new console window as the root user account and execute theorainstRoot.sh script.

::: ORACLE USERS GROUP UNINDRA

Page 50: Part_1_Install OS and Oracle.docx

Screen Name Response

[root@testnode1 ~]# /u01/app/oraInventory/orainstRoot.sh Within the same console window stay logged in as the root user account and execute

the root.sh script.

[root@testnode1 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh [11.2.0.1.0] [root@testnode1 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh [11.2.0.2.0] [root@testnode1 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh [11.2.0.3.0] Go back to OUI and acknowledge the "Execute Configuration scripts" dialog window.

Finish At the end of the installation, click the [Close] button to exit the OUI.

::: ORACLE USERS GROUP UNINDRA

Page 51: Part_1_Install OS and Oracle.docx

Screen Name Response

Install Oracle Database Examples

Now that the Oracle Database 11g Release 2 software is installed, you have the option to install the Oracle Database 11g Release 2 Examples.

Start the Oracle Universal Installer (OUI) by issuing the following command in the examples install directory as the Oracle software owner (oracle).

[oracle@testnode1 ~]$ cd /home/oracle/software/oracle/examples[oracle@testnode1 examples]$ ./runInstaller

At any time during installation, if you have a question about what you are being asked to do, click the Help button on the OUI page.

The prerequisites checks will fail for the following version-dependent reasons. As mentioned at the beginning of this guide, RHEL6 and OL6 are not certified or supported for use with any Oracle Database version at the time of this writing.

11.2.0.1: The installer shows multiple "missing package" failures because it does not recognize several of the newer version packages that were installed. These "missing package" failures can be ignored as the packages are present. The failure for the

::: ORACLE USERS GROUP UNINDRA

Page 52: Part_1_Install OS and Oracle.docx

"pdksh" package can be ignored because it is no longer part of RHEL6 and we installed the "ksh" package in its place.

11.2.0.2: The installer should only show a single "missing package" failure for the "pdksh" package. The failure for the "pdksh" package can be ignored because it is no longer part of RHEL6 and we installed the "ksh" package in its place.

11.2.0.3: The installer shows no failures and continues normally.

Screen Name Response

Installation Location

Specify the Oracle base and Software location (Oracle home) as follows.   Oracle Base: /u01/app/oracle   Software Location: /u01/app/oracle/product/11.2.0/dbhome_1

Prerequisite Checks

The installer will run through a series of checks to determine if the machine and OS configuration meet the minimum requirements for installing the Oracle Database Examples software.Starting with 11g Release 2, if any checks fail, the installer (OUI) will create shell script programs called fixup scripts to resolve many incomplete system configuration requirements. If OUI detects an incomplete task that is marked "fixable", then you can easily fix the issue by generating the fixup script by clicking the [Fix & Check Again] button.

The fixup script is generated during installation. You will be prompted to run the script as root in a separate terminal session. When you run the script, it raises kernel values to required minimums, if necessary, and completes other operating system configuration tasks.If all prerequisite checks pass, the OUI continues to the Summary screen. If the OUI detected any failed checks, take the appropriate action to resolve it or click the "Ignore All" check box to acknowledge it is safe to continue with the installation without resolving the issue (the "pdksh-5.2.-14" missing package, for example).

::: ORACLE USERS GROUP UNINDRA

Page 53: Part_1_Install OS and Oracle.docx

Screen Name Response

Summary

Click [Finish] to start the installation.

Install Product The installer performs the Oracle Database Examples software installation.

::: ORACLE USERS GROUP UNINDRA

Page 54: Part_1_Install OS and Oracle.docx

Screen Name Response

Finish

At the end of the installation, click the [Close] button to exit the OUI.

::: ORACLE USERS GROUP UNINDRA

Page 55: Part_1_Install OS and Oracle.docx

Configure Oracle Networking

The Database Configuration Assistant (DBCA) requires the Oracle TNS Listener process to be configured and running on the machine before it can create the database.

As the Oracle software owner (oracle), start the Network Configuration Assistant (NETCA)

and run through the process of creating a new TNS listener process and to also configure the node for local access.

[oracle@testnode1 ~]$ netca &

At any time during the network configuration, if you have a question about what you are being asked to do, click the Help button on the configuration screen.

Screen Name Response

Welcome

Select Listener configuration.

Listener Action Select what you want to do: Add

::: ORACLE USERS GROUP UNINDRA

Page 56: Part_1_Install OS and Oracle.docx

Screen Name Response

Oracle NetListener Name

Listener name: LISTENER

Select Protocols Selected protocols: TCP

::: ORACLE USERS GROUP UNINDRA

Page 57: Part_1_Install OS and Oracle.docx

Screen Name Response

TCP/IP Protocol

Select Use the standard port number of 1521

More Listeners? Would you like to configure another listener? No

::: ORACLE USERS GROUP UNINDRA

Page 58: Part_1_Install OS and Oracle.docx

Screen Name Response

Listener Configuration Done

Listener configuration complete! Click [Next] to continue. You will be returned to the Welcome screen.

Welcome Select Naming Methods configuration.

::: ORACLE USERS GROUP UNINDRA

Page 59: Part_1_Install OS and Oracle.docx

Screen Name Response

Select Naming Methods

Selected Naming Methods: Local Naming

Naming Methods Configuration Done

Naming Methods configuration complete! Click [Next] to continue. You will be returned to the Welcome screen.

::: ORACLE USERS GROUP UNINDRA

Page 60: Part_1_Install OS and Oracle.docx

Screen Name Response

Welcome

Click [Finish] to exit the NETCA.

The Oracle TNS listener process should now be running.

[oracle@testnode1 ~]$ ps -ef | grep lsnr | grep -v 'grep' | awk '{print $9}'LISTENER

[oracle@testnode1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 31-DEC-2011 22:32:27

::: ORACLE USERS GROUP UNINDRA

Page 61: Part_1_Install OS and Oracle.docx

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=testnode1.idevelopment.info)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 31-DEC-2011 22:14:25Uptime 0 days 0 hr. 18 min. 3 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.oraListener Log File /u01/app/oracle/diag/tnslsnr/testnode1/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=testnode1.idevelopment.info)(PORT=1521)))The listener supports no servicesThe command completed successfully

::: ORACLE USERS GROUP UNINDRA

Page 62: Part_1_Install OS and Oracle.docx

Create the Oracle Database

Use the Oracle Database Configuration Assistant (DBCA) to create the database.

Before executing the DBCA, make certain that the $ORACLE_HOME and $PATH are set

appropriately for the $ORACLE_BASE/product/11.2.0/dbhome_1 environment. Setting

environment variables in the login script for the oracle user account was covered in the

section "Create Login Script for the oracle User Account".

You should also verify that the Oracle TNS listener service is running before attempting to start the database creation process.

Create the Database

To start the database creation process, run the following as the Oracle software owner (oracle).

[oracle@testnode1 ~]$ dbca &

Screen Name Response

Welcome Screen

Click [Next] to continue.

Operations Select Create a Database.

::: ORACLE USERS GROUP UNINDRA

Page 63: Part_1_Install OS and Oracle.docx

Screen Name Response

Database Templates

Select Custom Database.

Database Identification

Database naming.   Global Database Name: testdb1.idevelopment.info   SID Prefix: testdb1

::: ORACLE USERS GROUP UNINDRA

Page 64: Part_1_Install OS and Oracle.docx

Screen Name Response

Management Options

From the "Enterprise Manager" tab, you can leave the default option here which is to Configure Enterprise Manager / Configure Database Control for local management.Using the "Automatic Maintenance Tasks" tab, leave the default option which is to Enable automatic maintenance tasks.

::: ORACLE USERS GROUP UNINDRA

Page 65: Part_1_Install OS and Oracle.docx

Screen Name Response

Database Credentials

I selected to Use the Same Administrative Password for All Accounts. Enter the password (twice) and make sure the password does not start with a digit number.

Database File Locations

Specify storage type and locations for database files.   Storage Type: File System   Storage Locations: Use Oracle-Managed Files     Database Area: /u02/app/oracle/oradata

::: ORACLE USERS GROUP UNINDRA

Page 66: Part_1_Install OS and Oracle.docx

Screen Name Response

Recovery Configuration

Check the option for Specify Flash Recovery Area.   Flash Recovery Area: /u03/app/oracle/fast_recovery_area   Flash Recovery Area Size: Use Oracle-Managed FilesMy disk group has a size of about 36GB. When defining the Fast Recovery Area size, use the entire volume minus 10% for overhead — (36-10%=32 GB). I used aFast Recovery Area Size of 32 GB (32768 MB).

Database Content I left all of the Database Components (and destination tablespaces) set to their default value although it is perfectly OK to select the Sample Schemas. This option is available since we installed the Oracle Database 11g Examples.

::: ORACLE USERS GROUP UNINDRA

Page 67: Part_1_Install OS and Oracle.docx

Screen Name Response

Initialization Parameters

Change any parameters for your environment. I left them all at their default settings for this example.

Database Storage Change any parameters for your environment. I left them all at their default settings for this example.

::: ORACLE USERS GROUP UNINDRA

Page 68: Part_1_Install OS and Oracle.docx

Screen Name Response

Creation Options

Keep the default option Create Database selected. I also always select to Generate Database Creation Scripts. Click Finish to start the database creation process. After acknowledging the database creation report and script generation dialog, the database creation will start.Click OK on the "Summary" screen.

Database Creation Process

Wait for the database process to complete.

::: ORACLE USERS GROUP UNINDRA

Page 69: Part_1_Install OS and Oracle.docx

Screen Name Response

End of Database Creation

At the end of the database creation, exit from the DBCA.

When the DBCA has completed, you will have a fully functional Oracle Database 11g Release 2 database running.

::: ORACLE USERS GROUP UNINDRA

Page 70: Part_1_Install OS and Oracle.docx

Test Database Connectivity

Verify that the TNS listener is running (lsnrctl status) then log in to the new instance to

verify database connectivity and perform a few queries.

[oracle@testnode1 ~]$ sqlplus system/*******@testdb1

SQL> SELECT user FROM dual;

USER------------------------------SYSTEM

SQL> SELECT systimestamp FROM dual;

SYSTIMESTAMP-----------------------------------------02-JAN-12 05.30.59.996107 PM -05:00

SQL> SELECT owner, COUNT(owner) AS "OBJECT_COUNT" FROM dba_objects GROUP BY owner;

OWNER OBJECT_COUNT------------------------------ ------------OWBSYS_AUDIT 12MDSYS 1509PUBLIC 27702OUTLN 9CTXSYS 366OLAPSYS 719HR 34FLOWS_FILES 12OWBSYS 2SYSTEM 529ORACLE_OCM 8EXFSYS 310APEX_030200 2406DBSNMP 65ORDSYS 2532ORDPLUGINS 10OE 127PM 27SH 306SYSMAN 3491APPQOSSYS 3XDB 844ORDDATA 248IX 55BI 8SYS 30796WMSYS 316

::: ORACLE USERS GROUP UNINDRA

Page 71: Part_1_Install OS and Oracle.docx

SI_INFORMTN_SCHEMA 8

28 rows selected.

Oracle Enterprise Manager

If you configured Oracle Enterprise Manager (Database Control), it can be used to view the database configuration and current status of the database.

The URL for this example is: https://testnode1.idevelopment.info:1158/em/

[oracle@testnode1 ~]$ emctl status dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://testnode1.idevelopment.info:1158/em/console/aboutApplicationOracle Enterprise Manager 11g is running.------------------------------------------------------------------Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/testnode1.idevelopment.info_testdb1/sysman/log

::: ORACLE USERS GROUP UNINDRA

Page 73: Part_1_Install OS and Oracle.docx

Post Database Creation Tasks - (Optional)

This section offers several optional tasks that can be performed on your new Oracle 11g environment in order to enhance availability as well as database management.

Re-compile Invalid Objects

Run the utlrp.sql script to recompile all invalid PL/SQL packages now instead of when the

packages are accessed for the first time. This step is optional but recommended.

[oracle@testnode1 ~]$ sqlplus / as sysdbaSQL> @?/rdbms/admin/utlrp.sql

Enabling Archive Logs

Whether a single instance or clustered database, Oracle tracks and logs all changes to database blocks in online redolog files. An Oracle instance will use its group of online redologs in a circular manner. Once an online redolog fills, Oracle moves to the next one. If the database is in "Archive Log Mode", Oracle will make a copy of the online redo log before it gets reused. A thread (an Oracle instance) must contain at least two online redologs (or online redolog groups).

As already mentioned, Oracle writes to its online redolog files in a circular manner. When the current online redolog fills, Oracle will switch to the next one. To facilitate media recovery, Oracle allows the DBA to put the database into "Archive Log Mode" which makes a copy of the online redolog after it fills (and before it gets reused). This is a process known as archiving.

The Database Configuration Assistant (DBCA) allows users to configure a new database to be in archive log mode within the Recovery Configuration section; however most DBA's opt to bypass this option during initial database creation. In cases like this where the database is in no archive log mode, it is a simple task to put the database into archive log mode. Note however that this will require a short database outage.

1. Log in to the database as a user with SYSDBA privileges and shut down the instance.

[oracle@testnode1 ~]$ sqlplus / as sysdba

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.

2. After shutting down the instance, mount the database.

SQL> startup mountORACLE instance started.

::: ORACLE USERS GROUP UNINDRA

Page 74: Part_1_Install OS and Oracle.docx

Total System Global Area 1657225216 bytesFixed Size 1336904 bytesVariable Size 973081016 bytesDatabase Buffers 671088640 bytesRedo Buffers 11718656 bytes

3. Enable archiving.

SQL> alter database archivelog;

Database altered.

4. Open the database.

SQL> alter database open;

Database altered.

5. Verify Archive Log Mode is enabled.

SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 74Next log sequence to archive 76Current log sequence 76

Download and Install Custom Oracle Database Scripts

DBA's rely on Oracle's data dictionary views and dynamic performance views in order to support and better manage their databases. Although these views provide a simple and easy mechanism to query critical information regarding the database, it helps to have a collection of accurate and readily available SQL scripts to query these views.

In this section you will download and install a collection of Oracle DBA scripts that can be used to manage many aspects of your database including space management, performance, backups, security, and session management. The DBA Scripts Archive for Oracle can be downloaded using the following link http://www.idevelopment.info/data/Oracle/DBA_scripts/dba_scripts_archive_Oracle.zip.

As the Oracle software owner (oracle), download

the dba_scripts_archive_Oracle.zip archive to the $ORACLE_BASE directory. For the

purpose of this example, the dba_scripts_archive_Oracle.zip archive will be copied

to/u01/app/oracle. Next, unzip the archive file to the $ORACLE_BASE directory.

::: ORACLE USERS GROUP UNINDRA

Page 75: Part_1_Install OS and Oracle.docx

For example:

[oracle@testnode1 ~]$ cp Downloads/dba_scripts_archive_Oracle.zip /u01/app/oracle[oracle@testnode1 ~]$ cd /u01/app/oracle[oracle@testnode1 oracle]$ unzip dba_scripts_archive_Oracle.zip

The final step is to verify (or set) the appropriate environment variable for the current UNIX shell to ensure the Oracle SQL scripts can be run from within SQL*Plus while in any directory. For UNIX, verify the following environment variable is set and included in your login shell script:

ORACLE_PATH=$ORACLE_BASE/dba_scripts/sql:.:$ORACLE_HOME/rdbms/adminexport ORACLE_PATH

Now that the DBA Scripts Archive for Oracle has been unzipped and the UNIX environment variable ($ORACLE_PATH) has been set to the appropriate directory, you should now be able to

run any of the SQL scripts in the $ORACLE_BASE/dba_scripts/sql while logged into

SQL*Plus from any directory. For example, to query tablespace information while logged into the Oracle database as a DBA user:

SQL> @dba_tablespaces

Status Tablespace Name TS Type Ext. Mgt. Seg. Mgt. Tablespace Size Used (in bytes) Pct. Used-------- ------------------ ------------ ---------- --------- ------------------ ------------------ ---------ONLINE EXAMPLE PERMANENT LOCAL AUTO 157,286,400 85,131,264 54ONLINE SYSAUX PERMANENT LOCAL AUTO 629,145,600 487,718,912 78ONLINE SYSTEM PERMANENT LOCAL MANUAL 734,003,200 705,953,792 96ONLINE TEMP TEMPORARY LOCAL MANUAL 67,108,864 66,060,288 98ONLINE UNDOTBS1 UNDO LOCAL MANUAL 560,988,160 419,102,720 75ONLINE USERS PERMANENT LOCAL AUTO 5,242,880 1,048,576 20 ------------------ ------------------ ---------avg 70sum 2,153,775,104 1,765,015,552

6 rows selected.

To obtain a list of all available Oracle DBA scripts while logged into SQL*Plus, run the help.sql script.

SQL> @help.sql

========================================Automatic Shared Memory Management========================================asmm_components.sql

========================================Automatic Storage Management========================================asm_alias.sqlasm_clients.sqlasm_diskgroups.sqlasm_disks.sql

::: ORACLE USERS GROUP UNINDRA

Page 76: Part_1_Install OS and Oracle.docx

asm_disks_perf.sqlasm_drop_files.sqlasm_files.sqlasm_files2.sqlasm_templates.sql

< --- SNIP --- > perf_top_sql_by_buffer_gets.sqlperf_top_sql_by_disk_reads.sql

========================================Workspace Manager========================================wm_create_workspace.sqlwm_disable_versioning.sqlwm_enable_versioning.sqlwm_freeze_workspace.sqlwm_get_workspace.sqlwm_goto_workspace.sqlwm_merge_workspace.sqlwm_refresh_workspace.sqlwm_remove_workspace.sqlwm_unfreeze_workspace.sqlwm_workspaces.sql

Configure Automatic Database Starting and Stopping

Oracle Restart

Starting with Oracle Database 11g Release 2, the dbstart and dbshut scripts that were

used to automate database startup and shutdown in previous Oracle versions are deprecated. Oracle now recommends configuring Oracle Database with the Oracle Restart feature to automatically restart the database, the listener, Oracle Automatic Storage Management (Oracle ASM), and other Oracle components after a hardware or software failure or when the database host computer restarts.

When using Oracle Restart, you can use Service Control Utility (SRVCTL), a command-line interface, to manage Oracle processes (database instance, listener, ASM instance). With SRVCTL, you can manage the Oracle Restart configuration, see the status of processes managed by Oracle Restart, and start or stop processes such as the Oracle Database. SRVCTL has been enhanced to support single instance databases with Oracle Restart on standalone servers and on clusters with Oracle Clusterware.

Oracle Restart is a component of Oracle Grid Infrastructure for a Standalone Server which is a separate install from the Oracle Database software. Installing Oracle Grid Infrastructure for a Standalone Server is required in order to use Oracle Restart and must be installed in a separate home (known as Grid home) from the database Oracle home. Using the latest Optimal Flexible Architecture (OFA), Oracle Grid Infrastructure for a Standalone Server

::: ORACLE USERS GROUP UNINDRA

Page 77: Part_1_Install OS and Oracle.docx

would be installed as the Oracle software owner (oracle) and the Oracle home directory

would be /u01/app/oracle/product/11.2.0/grid. Note that you can install Oracle Grid

Infrastructure for a Standalone Server first and the database later or vice-versa. If Oracle Grid Infrastructure for a Standalone Server is installed first, then components like the database and TNS listener get automatically added to the Oracle Restart configuration. In the case where the database is configured first and Grid later, the components will need to be manually added to the Oracle Restart configuration.

 If you want to use Oracle ASM or Oracle Restart, then you must install Oracle Grid Infrastructure for a Standalone Server before you install and create the database. Otherwise, you must manually register the database with Oracle Restart.

Also note that Oracle Restart is used in single-instance (non-clustered) environments only.

Although the Oracle grid infrastructure for a Standalone Server install is fairly straightforward, I opted to forgo discussing how to use Oracle Restart to automatically start/stop the Oracle instance in this guide. I provide a separate guide on configuring Oracle Restart on a standalone server. Although now deprecated, automatic database startup and shutdown using the su command method is still available in Oracle Database 11gRelease 2.

Automatic Database Startup/Shutdown using "su" Command

This section contains the recommended method defined by Oracle for automating database startup and shutdown of Oracle Database 10g and Oracle Database 11g Release 1 (11.1) instances on Linux. The method described in this section is referred to as the "su" command method. This method can be used with any RHEL or RHEL clone distribution, including Oracle Linux, up to and including RHEL 6.

Edit the /etc/oratab file and set the restart flag (the last field) to "Y" for the instance you

want to automatically startup and shutdown. For the purpose of this example, the only instance defined in the/etc/oratab file is testdb1:

...testdb1:/u01/app/oracle/product/11.2.0/dbhome_1:Y...

Next, create a text file named /etc/init.d/dbora as the root user, containing the following.

#!/bin/sh# chkconfig: 345 99 10# description: Oracle auto start-stop script.## Set ORA_HOME to be equivalent to the $ORACLE_HOME# from which you wish to execute dbstart and dbshut;#

::: ORACLE USERS GROUP UNINDRA

Page 78: Part_1_Install OS and Oracle.docx

# Set ORA_OWNER to the user id of the owner of the # Oracle database in ORA_HOME.

ORA_HOME=/u01/app/oracle/product/11.2.0/dbhome_1ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]then echo "Oracle startup: cannot start" exitfi

case "$1" in 'start') # Start the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" ;; 'stop') # Stop the Oracle databases: # The following command assumes that the oracle login # will not prompt the user for any values su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME" ;;esac

 Note that the /etc/init.d/dbora script listed above may look a little different from a similar one used for Oracle9i — most notably the omission of the commands to start/stop the Oracle TNS listener process. As of Oracle Database 10g Release 2, the dbstart script includes the commands to automatically start/stop the listener.

Use the chmod command to set the privileges to 750.

[root@testnode1 ~]# chmod 750 /etc/init.d/dbora

Associate the dbora service with the appropriate run levels and set it to auto-start using the

following command.

[root@testnode1 ~]# chkconfig --level 345 dbora on

The relevant instances should now startup/shutdown automatically at system startup/shutdown.

Final Notes

The /etc/init.d/dbora script defined in this section uses the "su -" command to run the

Oracle scripts dbstart and dbshut.

::: ORACLE USERS GROUP UNINDRA

Page 79: Part_1_Install OS and Oracle.docx

su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"

(and...)

su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"

Starting with Oracle Database 10g, Oracle switched from recommending the "su" command to

the "rsh" command of which I completely disagree with. When using the rsh method,

the /etc/init.d/dbora script would be defined as follows.

#!/bin/sh# chkconfig: 345 99 10# description: Oracle auto start-stop script.## Change the value of ORACLE_HOME to specify the correct Oracle home# directory for your installation.

ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1## Change the value of ORACLE to the login name of the# oracle owner at your site.#ORACLE=oracle

PATH=${PATH}:$ORACLE_HOME/binHOST=`hostname`PLATFORM=`uname`export ORACLE_HOME PATH#if [ ! "$2" = "ORA_DB" ] ; then if [ "$PLATFORM" = "HP-UX" ] ; then remsh $HOST -l $ORACLE -n "$0 $1 ORA_DB" exit else rsh $HOST -l $ORACLE $0 $1 ORA_DB exit fifi#case $1 in'start') $ORACLE_HOME/bin/dbstart $ORACLE_HOME ;;'stop') $ORACLE_HOME/bin/dbshut $ORACLE_HOME ;;*) echo "usage: $0 {start|stop}" exit ;;esac

::: ORACLE USERS GROUP UNINDRA

Page 80: Part_1_Install OS and Oracle.docx

#exit

Note that this method relies on the presence of an RSH server, which requires additional packages and configuration. The RSH server does not get installed by default on many Linux distributions (and for good reason!).

Given the RSH server (and other r* packages) do not get installed by default, the DBA would need to locate and install them before this method could be used:

# -- Install the rhs and rsh-server packages from the OS CD/DVD --# rpm -Uvh --force rsh-*

# -- Enable rsh and rlogin --# chkconfig rsh on# chkconfig rlogin on# service xinetd reload

I completely disagree with the recommendation to use rsh and prefer to stick with using

the su command method. Furthermore, using the rsh method can be problematic when

attempting to use it under Fedora Core 5 and Fedora Core 6 where rsh is deprecated.

Miscellaneous Options

This final section contains several miscellaneous options that may be of use to newcomers of Oracle 11g.

Enterprise Manager - Database Console

During the database creation section, we asked for DBCA to create the Enterprise Manager Database Console application. The DBCA will automatically start the OEM Database Console application. To check for the process, type the following:

[oracle@testnode1 ~]$ emctl status dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://testnode1.idevelopment.info:1158/em/console/aboutApplicationOracle Enterprise Manager 11g is running.------------------------------------------------------------------Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/testnode1.idevelopment.info_testdb1/sysman/log

::: ORACLE USERS GROUP UNINDRA

Page 81: Part_1_Install OS and Oracle.docx

If you receive something similar to the above output, then OEM Database Console is running. If you need to manually start this application, login as the Oracle software owner (oracle) and

type the following:

[oracle@testnode1 ~]$ emctl start dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.https://testnode1.idevelopment.info:1158/em/console/aboutApplicationStarting Oracle Enterprise Manager 11g Database Control ......... started.------------------------------------------------------------------Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/testnode1.idevelopment.info_testdb1/sysman/log

The OEM DB Console application may take several minutes to start.

Once the DB Console application is up and running, point your web browser to https://<Database_Server>:1158/em as in the following:

https://testnode1.idevelopment.info:1158/em

Login:

User Name: SYSTEMPassword: <The password you chose during installation>Connect As: Normal

 The emctl start dbconsole / emctl stop dbconsole commands can be placed in the /etc/init.d/dbora script to be started and stopped when the database server is cycled.

Changing Your Oracle Database Environment

In some cases, you may have more than one database running on your single database server. It is even possible to be using two different databases running on different releases of the Oracle Database software. (i.e. Oracle 8.1.7, Oracle 9.2.0, 10.2.0, and 11.1.0). For example, you may have two database — ora1020 (using Oracle release 10.2.0)

and testdb1 (using Oracle release 11.2.0). Whatever the case may be, you need an efficient

method to modify your environment variables to switch between these two databases. This requires you update environment variables like ORACLE_HOME, ORACLE_SID, PATH, LD_LIBRARY_PATH, etc. Although this can be done

manually at the command line, it can get old real quick. Instead you can use a single command line script to switch between all database environments declared in your /etc/oratab file.

If you have been following along with this article, the required scripts for switching your Oracle database environment are already included (in /usr/local/bin). From the command

prompt, simply run the following:

::: ORACLE USERS GROUP UNINDRA

Page 82: Part_1_Install OS and Oracle.docx

[oracle@testnode1 ~]$ . oraenvORACLE_SID = [ora1020] ? testdb1The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 is /u01/app/oracle

Notice that in the above example, we didn't just run the oraenv script, but rather, we sourced it

by using a dot followed by a space and then the script name oraenv. When sourcing

the oraenv script, it will prompt you for the ORACLE_SID, (defined in your /etc/oratab file),

you want to switch to. In the above example, if an entry exists for testdb1, then all Oracle

related environment variables would be set to access this database.

::: ORACLE USERS GROUP UNINDRA