Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Student Guide
D16511GC20
Edition 2.0
Februrary 2004
Dxxxxx (Applied)
®
Authors Copyright © 2004, Oracle. All rights reserved.
Ric van Dyke This documentation contains proprietary information of Oracle Corporation. It is
Russ Lowenthal provided under a license agreement containing restrictions on use and disclosure and
is also protected by copyright law. Reverse engineering of the software is prohibited.
If this documentation is delivered to a U.S. Government Agency of the Department of
Technical Contributors Defense, then it is delivered with Restricted Rights and the following legend is
and Reviewers applicable:
The information in this document is subject to change without notice. If you find any
problems in the documentation, please report them in writing to Education Products,
Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores, CA 94065.
Oracle Corporation does not warrant that this document is error-free.
All references to Oracle and Oracle products are trademarks or registered trademarks
of Oracle Corporation.
All other products or company names are used for identification purposes only, and
may be trademarks of their respective owners.
Contents
iii
3 Installing Oracle9i Software
Objectives 3-2
Creating Groups 3-3
Creating and Viewing a Group 3-4
Creating the Oracle Owner 3-5
Creating the apache User 3-7
Choosing a Shell 3-8
Setting Environment Variables 3-9
User File Creation Mask 3-10
Setting Oracle Environment Variables 3-11
Optimal Flexible Architecture 3-12
OFA Characteristics 3-13
Mount Points 3-14
ORACLE_HOME and ORACLE_BASE 3-15
Installing New Releases 3-16
Managing Multiple Versions 3-17
Setting Oracle Environment Variables 3-19
Setting Variables: Example 3-21
Creating Directories 3-22
Mounting the CD-ROM 3-23
Starting the Installer 3-25
Oracle Universal Installer 3-26
File Locations 3-27
Installation Types 3-28
Database Configuration 3-29
Installation Summary 3-30
Changing the CD-ROM 3-31
Setup Privileges 3-32
Database Accounts 3-33
Password Management 3-34
Configuration Tool Error 3-35
Oracle Software Patches 3-36
Oracle Patch Utility 3-37
Oracle Relink Utilitity 3-39
Troubleshooting 3-40
Summary 3-41
Practice: Overview 3-42
iv
Initialization Parameters 4-7
Completing the Database Creation 4-8
Oracle Net Services Configuration and Administration Tools 4-9
Oracle Net Manager 4-10
Oracle Net Configuration Assistant 4-11
Testing the Connection 4-12
Summary 4-13
Practice Overview: Creating a Database 4-14
v
Enterprise Manager Job System 6-14
Administrative Scripts 6-15
Database Backups 6-17
Backing Up with RMAN 6-18
Initialization Parameter File 6-19
Summary 6-20
Practice Overview: Automating Tasks 6-21
vi
Interpreting Network Statistics 7-50
Summary 7-51
Practice Overview: Using Linux Measurement Tools 7-52
vii
Implementing Asynchronous I/O 9-22
Choosing a Kernel 9-24
Implementing a Large SGA 9-25
Standard Linux Memory Map 9-26
Modified Linux Memory Map 9-27
Altering the Linux Memory Map 9-28
Modifying shmmax 9-29
Lowering mapped_base 9-30
Relocating the SGA 9-32
Relocating the Database Buffer Cache 9-33
Summary 9-35
Practice Overview: Tuning Oracle9i and Linux 9-36
Appendix A: Practices
viii
Oracle9i on Linux: Overview
Oracle9i Versions
With Oracle9i Release 2, the release numbering changed. The second digit that was used in
earlier releases was dropped. For the original release of Oracle9i and earlier releases of the
Oracle application server, the significance of each digit in the release number 9.0.1.1.2 was as
follows:
9 was the version number.
0 was the new features release number.
1 was the maintenance release number.
1 was the generic patch set number.
2 was the platform-specific patch set number.
For Oracle9i Release 2 and later, the release number is 9.2.0.4.0, in which:
9 is the major database release number
2 is the database maintenance release number
0 is the application server release number
4 is the component-specific release number
0 is the platform-specific release number
Supported Hardware
Oracle Corporation supports Red Hat Enterprise Linux AS on any platform or drivers that Red
Hat supports. It is a requirement that the OS (binary) is not modified. Oracle Support Services
(OSS) has a script to run against a customer’s environment to ensure that the binary has not been
modified. If the binary is modified, then customers must support it themselves or call Red Hat
for technical support. OSS supports all versions of Red Hat Linux AS that Red Hat supports.
For more details, visit http://www.oracle.com/linux.
These statements also apply to other distributions that are supported by Oracle Corporation.
Packages
Modules
The modules in a Linux distribution can be either kernel based or loadable. Kernel-based
modules have to be compiled in, whereas loadable modules can be added without recompiling.
All the stock kernels include support for loadable modules.
Packages
The Linux software for most of the supported distributions is assembled into packages. These are
precompiled binaries that can be installed on and removed from your system with a package
manager. With packages, you can update the kernel, patch, and add functionality. Some third-
party vendors distribute binary modules that are loaded into the kernel. These modules may be
proprietary modules where the source code is not available for Linux developers to investigate. If
there are such modules loaded, then there is, in essence, a kernel extension that can be fixed only
by the vendor. Oracle Corporation, UnitedLinux, and Red Hat cannot fully support environments
where proprietary modules are loaded.
Linux Kernel
Linux, like most modern operating systems, has a kernel that is loaded at boot time and stays in
the memory. The kernel in Linux, unlike in many other operating systems, can be customized
infinitely. By compiling your own kernel, you can customize the functions of the kernel to your
needs. You can include or exclude modules that make up the kernel, by using the kernel
configuration file and by recompiling.
If the kernel still does not behave to your satisfaction, there is a code available for you to tweak
it to your specification. This leads to a support problem. If you are running a kernel that is
different than the one Oracle Corporation or Red Hat tested, then OSS cannot identify what the
problem might be when you report trouble with your database or OS.
Oracle Corporation supports only stock or untainted kernels. That means only kernels supplied
by the certified distributions are supported. Kernels that are patched by packages by the kernel
vendor are also supported. For more information about kernel support, see note 228374.1, Linux
Operating System Support, on MetaLink.
# uname -r
2.4.9-e.3
Required Software
Use the following commands to verify your software.
Identifying Release
Red Hat: Use the command: cat /etc/redhat-release
United/SuSE: Use the command: cat /etc/lsb-release
Identifying the Kernel
You can find out which Linux kernel version you are using by entering the command:
# uname -r
Identifying the Installed Version of glibc
You can find out what version of glibc libraries you are using by entering the RPM command:
# rpm -q glibc
For example:
# rpm -q glibc
glibc-2.2.4-26
Linux Patches
Linux distribution vendors do not supply mega-patches like other UNIX vendors, but supply
patches for components. The latest version of all the patches are tested to work together. Each
distribution vendor will have a subscription service and a method for distributing patches. For
example, Red Hat uses the Red Hat Network. SuSE uses the SuSE Update Channel. The latest
patches should be applied; especially the kernel patches and the security patches.
User process
Instance
Database
Oracle9i Architecture
Oracle9i Server consists of a database, an instance, and server processes. The server processes
act on behalf of the user.
The database is a set of files that includes the data files, control files, and redo log files.
The instance is the System Global Area (SGA) and background processes such as LGWR, DBWn,
ARCn, and SMON.
Each server process has a private memory area called Program Global Area (PGA). Server
processes can be dedicated or shared. Each dedicated server process handles only one user
session. Each shared server process handles requests from multiple users.
The Oracle9i Server depends on Linux for the I/O subsystem, memory handling including virtual
memory, swap, and process scheduling.
For more information about Oracle9i architecture, refer to Oracle9i Database Concepts and
enroll in the Oracle9i Database Administration Fundamentals I course.
# cd /proc/sys/kernel
# echo 2147483648 > shmmax
# vi /etc/sysctl.conf
…
kernel.shmmax = 2147483648
…
# sysctl -p
Semaphores
Semaphores are a robust method of controlling access to critical resources. The Oracle instance
uses semaphores primarily to control access to shared memory. Semaphores are allocated based
on the PROCESSES initialization parameter.
Each Oracle instance tries to allocate one semaphore set at startup. This set must allocate at least
as many semaphores as the value of PROCESSES. If it does not, then the Oracle instance gets
more sets to satisfy the number of semaphores that it needs. If the instance cannot allocate
enough semaphores (either in one set or in multiple sets), then the instance does not start.
For Oracle9i Release 2, the instance momentarily allocates the number of semaphores that is two
times the PROCESSES initialization parameter. This is to ensure that the Oracle instance does
not exhaust a system of its semaphores. This is only for a very short time and half of the
semaphores are then released.
Refer to MetaLink note 153961.1, Semaphores and Shared Memory – An Overview, and
15654.1, Calculating Oracle’s SEMAPHORE Requirements, for details about setting semaphore
parameters for your Oracle instance.
# ipcs -m
# ipcs -s
# ipcs -a
• To install a package:
# rpm –ivh <package name>
• To remove a package:
# rpm –e <package name>
Managing Packages
The recommended method for installing operating system patches and additional functionality is
to apply packages from the distribution vendor. Apply packages with rpm, a command-line
utility with several options for querying, verifying, installing, upgrading, and removing
packages. Despite the name, rpm is used with many Linux distributions, including SuSE and
UnitedLinux. Although other package managers are available, the rpm command-line utility is
the most ubiquitous and easiest-to-use tool.
• -i Installs the named package. Optional argument –h shows hash marks on the screen to
indicate progress. Optional argument –v returns a verbose output, for example:.
#rpm -ivh my_new_package-1.0-14.i386.rpm
Preparing... ####################################### [100%]
1:my_new_package ####################################### [100%]
• -e Erases/removes the selected package. Optional arguments –h and –v are can also be
used, for example:
# rpm -ev IBMJava2-JRE
• -U Removes the current package and replaces it with a different version (upgrade).
Note: The replacement happens without removing any existing configuration files. This is
used when upgrading kernel packages because you cannot remove the existing kernel
before installing a new one.
rpm -Uh kernel-2.4.9-e.27.i686.rpm
Preparing... ####################################### [100%]
1:kernel-2.4.9-e27 ####################################### [100%]
# rpm –e IBMJava2-JRE
Conflicting Packages
Both Red Hat 2.1 and UnitedLinux 1.0 are shipped with Java Runtime Environment by default.
These should be removed to prevent possible conflicts with the software that will be installed
with the Oracle9i Database. Blackdown JRE 1.1.8 v3 and Sun JDK 1.3.1_02 are required for
Oracle server installations. These are provided with the Oracle9i Release 2 installation software.
For Red Hat Enterprise Linux Advanced Server 2.1, remove the IBM Java Runtime Environment
with the following command:
# rpm -e IBMJava2-JRE
For Red Hat Enterprise Linux 3.0, there are no conflicting packages.
For UnitedLinux 1.0 and SuSE SLES8, remove the following packages (in this order due to
dependencies):
# rpm -e jserv
# rpm -e mod_php4-servlet
# rpm -e jakarta-tomcat
# rpm -e java2
# rpm -e java2-jre
Optional Packages
The optional packages listed above are usually available on the Red Hat distribution and
UnitedLinux CDs.
To install these, use a package manager or rpm. The following is an example of installing
pdksh:
$ rpm -ivh pdksh-5.2.14-13.i386.rpm
To test the install but not actually install, use the test option:
$ rpm -iv --test pdksh-5.2.14-13.i386.rpm
Warning: Packages that taint the kernel are not supported and make the platform unsupported.
Disk Partitioning
Disk partitioning is not required by Linux or by Oracle software. However, disk partitioning can
reduce the time consumed in operations such as planning for recovery, upgrades, and backups.
The larger the partition the longer a file system check (fsck) operation takes on boot up. Much
of this time can be avoided by using a journaled file system such as ext3. Having a small
/boot partition that holds only the current kernels separates the tasks of booting the machine
and recovering a partition. A typical size of this partition is from 10 MB to 100 MB. Red Hat
recommends approximately 50 MB for boot partition.
The / partition should hold only a few directories that are created with the distribution
installation. These directories are overwritten with a new installation or upgrade. (Keep track of
any customized configuration files that you place under this partition, because they will also be
overwritten during a new installation or upgrade).
The /var/log and /tmp should be separate partitions to isolate the effects of runaway
processes. The /tmp partition should be at least 400 MB.
Practice 2: Overview
For detailed instructions on performing this practice, see Practice 2 in Appendix A.
dba oinstall
Creating Groups
The Oracle installation guide names three group identifiers, ORAINVENTORY, OSDBA, and
OSOPER. The members of OSDBA group own the database files and have the privilege to
connect to the database without a password, using AS SYSDBA through OS authentication. The
OSOPER group uses the same mechanism to connect with AS SYSOPER with a restricted set of
privileges. Each database may have its own OSDBA and OSOPER groups. The ORAINVENTORY
group has privileges on the software. A DBA that is a member of both OSDBA and
ORAINVENTORY has privileges in specific database instances and the ability to access and
upgrade the software through the ORAINVENTORY group.
An OSDBA group must be created to manage the database files. By default this group is dba, but
this name is arbitrary. If only one group of DBAs administers the databases on this server, then
this group may be the same as the ORAINVENTORY group for all the databases on this server.
When there are multiple groups of DBAs, each administering different databases on the same
server, you should create a separate ORAINVENTORY group to own the Oracle software. This
group is commonly called oinstall. For each set of databases that will have a common set of
DBAs, create an additional OSDBA group. This allows each DBA to have privileges in the
database of responsibility but not in other databases.
• To create a group:
# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
# passwd oracle
New password:
Retype new password:
Choosing a Shell
Linux has many popular features. One of the most popular feature is that the user interface can
be easily customized. There are at least four different shells in the default installs of SuSE, Red
Hat, and UnitedLinux and there are many more available. The Bourne shell, one of the first
shells that was available on AT&T UNIX, is the standard shell that the Oracle database uses for
scripting. The C shell was the BSD UNIX shell. The C shell has many user-friendly features,
such as command history, that are not available in the Bourne shell. But the C shell was
interpreted, and not compiled like the Bourne shell, and is consequently slower. The Korn shell
is a superset of the Bourne shell with command history, and is compiled. The Bourne-again
shell, bash, was written to be Bourne shell compatible, with features of both the Korn and C
shells. It is intended to be POSIX compliant. Some Oracle install actions require a Korn shell
such as the Oracle Internet Directory configuration script, oidca. The Korn shell, ksh, is not
part of the default installation of Red Hat Enterprise Linux, but the pdksh package that supplies
a ksh is included in the distribution. The Korn shell is installed by default with UnitedLinux.
Most Oracle shell scripts specify the shell that is required in the first line of the script. A first line
of #!/bin/sh indicates that the script uses the Bourne shell. On Linux, the Bourne shell is
usually the Bourne-again Shell (bash).
To view the shell that you are currently in, use the command: echo $0.
• C shell syntax:
For the oracle user, you must set the following shell
variables before the installer is run:
• DISPLAY (required)
– Location of the X Window System server
• PATH (required)
– Location of the OS linker and compiler
– Location of the Oracle database executables
OFA Characteristics
These are only five of the OFA characteristics. The OFA characteristics translate into specific
recommendations for the management of database files, and the structure of the host file systems
and directory structure.
Mount Points
A database that is fully OFA compliant has at least two mount points: one for the software and at
least one for database files. The Oracle Installer requests two directories. The installer does not
know if you are supplying mount points or directories. The naming of the database software
directory was covered when you created the ORACLE_HOME environment variable.
Although there are many correct names that you can use, it is usually a good idea to avoid names
that map to hardware. For example, if you choose a name that corresponds to a particular disk
controller, then a later upgrade may result in a name that is deceptive. It is much easier to
separately track hardware to logical name mappings.
You must not use names that suggest that a mount point is devoted to one application’s data
unless it is true. You do not want to neglect your Oracle database files just because they were
stored under a mount point called /backup01.
In the original OFA, the concept of a mount point almost always referred to a single physical
disk, that is, each disk had one mount point. In today’s environment, disks can be very large, and
they are partitioned to useful sizes. Each partition requires a mount point.
ORAENV_ASK=NO
. oraenv
ORAENV_ASK=
$ env | less
BASH=/bin/sh
…
ORACLE_BASE=/oracle
…
Creating Directories
The ORACLE_BASE directory that is used in the example (in the slide) must be created by root.
The ownership of the directory must be assigned to the oracle user and the ORAINVENTORY
group. Following the examples in previous slides, use the command chown oracle:dba
/u1/app/oracle. Repeat this procedure for the directories that are designated to hold
database files. The ORACLE_HOME directory is successfully created by the OUI as long as the
permissions on the ORACLE_BASE directory are correct.
The mount points are not required to be at the root directory. For example, additional partitions
could be mounted below the ORACLE_BASE directory. An ORACLE_BASE of /app/oracle
can have mount points of /app/oracle/product for the software and several mount points
for database files of the form /app/oracle/diskn where n is a disk number. The value of
n may need to be a two- or three-digit number in large database configurations.
$ cd
$ /mnt/cdrom/runInstaller (Red Hat)
$ /media/cdrom/runInstaller (SuSE and UnitedLinux)
File Locations
The File Locations screen prompts you for the path to set the ORACLE_HOME variable and a
name for this location. The installer supports multiple ORACLE_HOME locations. It is possible to
have multiple versions of the Oracle software running on the same machine for different
databases. An example would be to have a test database running at version 9.2.0 to check the
effects of a new release, while production is still running version 8.1.7.
After the File Location screen and before the Installation Types screen, you are prompted with
the Available Products screen. Your choices are:
• Oracle9i Database
- Installs an optional starter database, product options, management tools, networking,
utilities, and basic client software
• Oracle9i Client
- Installs management tools, networking, development tools, and precompilers
• Oracle9i Management and Integration
- Installs Oracle Internet Directory and associated management tools, networking,
utilities, and basic client software
• Oracle Cluster Manager
- Installs the Oracle Cluster Manager (required for RAC on Linux)
Installation Types
In the Installation Types screen, you can choose the software that is installed. You have the
choice of the Enterprise Edition, the Standard Edition, or a Custom installation. The Custom
option is required to install certain features of the database, such as Connection Manager, Oracle
Names, or Advanced Security Option. All of these can be installed at another time.
For details about the different editions of the Oracle9i Database, refer to Oracle9i Database New
Features Release 2 (9.2).
Database Configuration
At this point, OUI inquires about the kind of database that is created as part of the install. The
first three choices—General Purpose, Transaction Processing, and Data Warehouse—use a
preconfigured database and initialization parameter file from the available templates. These
templates hold prepopulated data files so that the character set and database block size cannot be
changed.
You can use the Customized option to set initialization parameters, file locations and sizes, and
completely customize the first database.
The Software Only option installs just the Oracle software, and no database is created. This
option is also used to add options to an existing installation, for example, Connection Manager,
Oracle Internet Directory, or Advanced Security Option.
Installation Summary
Before the installation actually begins, the Installation Summary screen appears with the results
of the choices that you made in the previous screens. Because space requirement is of particular
interest, if enough space is not available, then the installer displays an error message.
Setup Privileges
Near the end of the installation, you are prompted to run another script as root. This script sets
file permissions, moves utility scripts to the local bin directory, creates the oratab file, and
runs a setup script for other installed products.
It is also recommended that you change the name of this file after the installation is complete.
You may need this file later if permissions get changed. By renaming it, you can keep each
root.sh file for each installation. The file is overwritten for each installation.
Database Accounts
After you have created the database, you are prompted to set the passwords for the SYS and
SYSTEM accounts to nondefault values. You must do this. Sometimes during the installation
you may not be able to enter passwords. If this happens, click Password Management to change
passwords there.
Password Management
All the database accounts are locked by default. In this window, you have the option of
unlocking and setting passwords for any of the default accounts that are accessed. In this slide,
the password for the SCOTT account has been changed.
Note: It is recommended that you unlock the SCOTT user and set the password to TIGER. Other
setup and configuration tools use the SCOTT user to test connections. After all setup and
configuration has completed, it is a good idea to lock and expire the SCOTT user because of
potential security risks. For more information about Oracle database security, see the Oracle9i
Database: Security course.
$ opatch apply
...
OPatch succeeded.
Troubleshooting
There are some common problems with the installation. Many are the result of missing a step in
the preinstallation setup.
Kernel parameters errors, often the result of typographic errors, can cause ORA-3113 End of
File on communication channel, or an OS error indicating that there is not enough
shared memory or semaphores. These usually show up when the Database Creation Assistant
tries to start an instance.
Environment variables can lead to a variety of errors again due to incorrect typing. The directory
to be used as the ORACLE_BASE must exist and be owned by the user that is running the
installer. The C compiler and supporting utilities must be installed and the directory must be
included in the PATH variable.
The installer is very convenient to use. The error pop-up windows normally allow you to go to
another window, fix the problem, and click Retry. The only errors that cannot be fixed in this
manner are the environment variables. If you discover that the problem is with environment
variables, then you must exit the installer, change the environment, and restart the installer. The
installer inherits the environment when it starts, and the installer environment cannot be changed
while the installer is running.
Practice 3: Overview
For detailed instructions on performing this practice, see Practice 3 in Appendix A.
4. Select from:
– Oracle Spatial
– Oracle Ultra Search
– Oracle Label Security
– Oracle Data Mining
– Oracle OLAP
– Example Schemas
– Standard features
Database Features
On the Database Features page, you can select the features that you want to install into the
database that you are creating. You can do this if the software for the feature is included in the
base installation.
• Oracle Spatial provides a way to store and retrieve multidimensional data in an Oracle
database.
• Oracle Ultra Search is a text management solution that enables organizations to access text
information sources as quickly and easily as structured data.
• Oracle Data Mining enables data mining to be performed inside the database rather then by
using external data mining tools.
• Oracle OLAP (online analytical processing) provides tools for developing and deploying
Internet-based business intelligence applications.
• Oracle Label Security enables application developers to add label-based access control. For
details, refer to Oracle Label Security Administrator’s Guide Release 2 (9.2).
• Example Schemas provide a set of schemas that are used in training and documentation.
These schemas are used to demonstrate and test the functionality of the database.
You can also see the standard database features that are installed. These are: Oracle JVM, Oracle
interMedia, Oracle Text, and XML Database Protocols.
There is a tab to specify any custom scripts that you want run as part of the database creation.
Initialization Parameters
The initialization parameters describe many aspects of your Oracle database. Here, you set the
parameters that are used at the time of creating the database. Most of these parameters can be
changed later as you tune and modify your database. A few key parameters are:
• Data block size: Under the DB size tab, you can select the data block size used for your
database. For Linux, you must not use a size smaller than 4 KB and larger than 16 KB. If
your data block size is less than 4 KB, it will cause excessive I/O requests because the file
systems use a 4 KB block size at the OS level. An 8 KB block size is a good size for most
databases. This cannot be changed after the database is created.
• Character Sets tab: With the Character Sets tab, you can select the character set for the
database and the national character set. The national character set is used for column data
types of NCHAR, NVARCHAR2, and NCLOB, and must be a Unicode character set.
Although these character sets can be changed later, it is not a simple process. You can only
change to a character set that is a strict superset of the current one. The new character set
must include characters of the same byte count as the original character set. Take time
before creating the database to select the right character set according to your requirements.
For details about supported character sets, refer to the Oracle9i Database Globalization
Support Guide.
Configuring an OMS
Configuring an OMS consists mainly of specifying which repository you want the OMS to
connect to. After you choose to configure an OMS, you are asked to create a new repository or
use an existing one.
When creating a repository, the Enterprise Manager Configuration Assistant writes the
repository owner’s username and password (in encrypted format) to the
omsconfig.properties file located in the $ORACLE_HOME/sysman/config
directory.
• IA is:
– Shipped with the database
– Installed with the Oracle Universal Installer (OUI):
- From the Enterprise Manager tree
- From the database server tree
• Start the IA and dbsnmpwd on Linux with:
agentctl start agent
Intelligent
Listener
Agent
Database
Node
$ORACLE_HOME/Apache/Apache/bin/apachectl start
$ORACLE_HOME/Apache/Apache/bin/apachectl stop
• Start and stop the OHS only when you are logged
in as the oracle user.
Creating a Job
To create a job on any managed node, perform the following steps:
1. Select Create Job from the Job menu, press [Ctrl] + [J], right-click the Job icon in the tree,
or click the Create icon (green box) on the toolbar and then select Job from the tree.
2. Complete the five tabbed pages in the Create Job window:
- Use the General tab to specify the primary attributes of a job, such as the job name,
description, target type (Database, Node, Listener, or HTTP Server), targets, and so
on.
- Use the Task tab to choose the tasks that you want the job to perform.
- Use the Parameters tab to specify parameter settings for the selected job tasks. To set
the parameters for a task, select the task in the Selected Tasks list. The parameters for
the selected task are displayed on the right of the Parameters tabbed page.
Creating an Event
To access the Create Event window, select Event > Create Event, right-click the event icon and
select Create Event, click the Create icon on the console toolbar (the green box), select Create
from the menu bar, or press [Ctrl] + [E].
You then need to complete the six pages in the Create Event window:
• General: event name, target type, description, and monitored targets
• Tests: number and type of tests available depends on the target type selected on the General
page
• Parameters: parameters required for each chosen test
• Schedule: when and how often the event is evaluated on the targets
• Access: permissions (privileges) that other administrators have for this event
• Fixit Jobs: which (if any) fixit jobs run if the event is triggered
On the bottom of each page you can choose whether this event needs to be registered, saved in
the library, or both.
Controlling Oracle9i
By default, the database and its related services do not start when the server is started.
Depending on your needs you will want to start all or some of the following services:
• Database Listener
• Database Instance
• Intelligent Agent (IA)
• Oracle Management Server (OMS)
• Oracle HTTP Server
These can be started manually through standard commands:
• lsnrctl start
• sqlplus “/ as sysdba” and then execute the startup command
• agentctl start
• oemctl start oms
• $ORACLE_HOME/Apache/Apache/bin/apachectl start
Or they can be started automatically. The next few pages discuss how to have the Oracle9i
Database and related services start automatically.
Kernel
BIOS
rc6.d
Linux runlevels
Linux uses runlevels to determine which services to start or stop. For example, at certain
runlevels the graphic user interface might not be started. The meaning and services started at the
different runlevels is distribution dependent, but for SuSE, Red Hat, and UnitedLinux it is as
follows:
• Runlevel 0: Halt. It is used to shut down the system.
• Runlevel 1: Single-user (maintenance) mode. Only root may log in.
• Runlevel 2: Multiuser mode, text-based console only
• Runlevel 3: Multiuser mode with networking
• Runlevel 4: For custom use in SuSE, Red Hat, and UnitedLinux
• Runlevel 5: The default mode; multiuser with networking and active X session
• Runlevel 6: Reboot. This shuts everything down and then starts it back up.
Booting to a nondefault runlevel
GRUB provides a way to specify the runlevel on startup from the OS selection menu. For SuSE
and UnitedLinux, just hit the spacebar and select the runlevel you want to boot to. For Red Hat
Linux, you press “e” then scroll down to select the kernel, press “e” again, press the spacebar,
enter the runlevel you want to boot to, then press “b”.
Your current and previous runlevel can be found with the runlevel command.
Automating Jobs
Much of a your work as a DBA must be done outside normal working hours, or at least during
off-peak hours. In many companies, you are asked to support more databases and more hours of
the day or night. Automating routine jobs is a way of reducing the work load. These routine jobs
include:
• Doing backups and maintaining backup scripts
• Starting up and shutting down the database
• Gathering statistics on the database and OS
• Monitoring the health of the database and related processes
Ensure that the database starts up when the machine boots, and more importantly make sure that
the database does a proper shutdown before the machine is shut down. Monitor the database and
related processes so that you are aware of a problem before the users start calling you.
OS Scheduling Tools
Linux offers several scheduling tools that usually are a variation of the standard cron and at
tools, or a GUI for one of these tools. Task Scheduler is one of these user interfaces that makes
cron and at easier to use.
cron
The system cron daemon is usually started as part of the boot process. Security for cron is
handled by the system administrator by using the /etc/cron.allow and
/etc/cron.deny files. The cron daemon checks the system-level schedule in the
/etc/crontab file and user-level schedules in the /var/spool/cron directory. On Red
Hat, there is also a set of directories /etc/cron.hourly, /etc/cron.daily,
/etc/cron.weekly, /etc/cron.monthly that hold executable scripts. If the system
administrator puts an executable script into one of these directories, then cron runs the script at
the appropriate interval.
Administrative Scripts
Oracle Corporation provides a set of scripts to aid the DBA. In some shops the user environment
could be constantly changing. An end user may need to access multiple databases running with
different ORACLE_HOME directories. Databases may be frequently moved or upgraded. These
changes should be transparent to the end user and not a burden on you (the DBA). The scripts
oraenv, coraenv, and dbhome give you the flexibility needed in these situations. The
oratab file found in the /etc or /var/opt/oracle directory lists the instance name, the
ORACLE_HOME directory, and whether this instance participates in automated startup and
shutdown. The dbhome script retrieves the ORACLE_HOME information from the oratab file
based on the ORACLE_SID instance name. When a user logs in, the login script must source
oraenv. The oraenv script prompts the user for the desired instance and sets the
ORACLE_HOME and PATH variables. The oraenv script is also the place to add local
customizations.
Oracle Corporation provides the dbstart and dbshut scripts that must be modified for your
site. One generic change is to replace every SHUTDOWN command with SHUTDOWN
IMMEDIATE in the dbshut script. This ensures that the database shuts down. These scripts
read the oratab file, determine which databases participate in automated startup or shutdown,
and start up or shut down these databases.
Database Backup
Database Backups
Backups are required by most businesses. The method and the frequency are often dictated by
business requirements. The method should be chosen based on availability requirements,
convenience, performance, and Mean Time To Recover (MTTR).
User-Managed Backups with OS Tools
Backups can be created by using standard OS tools such as tar, cpio, and cp. It is the user’s
responsibility to understand the limitations of these tools.
User-Managed Backups with Third-Party Tools
There are several third-party backup solutions. The most important consideration is whether the
tool you choose coordinates with the Oracle database. The database must be shut down, or the
tablespaces put into backup mode before the back up takes place. Many vendors provide an
Oracle database agent module to provide this functionality.
Server-Managed Backups with RMAN
Oracle Corporation provides an integrated tool to perform backups called Recovery Manager
(RMAN). This tool works with the database instance to make reliable backups.
Note: Use the full pathname to invoke RMAN: $ORACLE_HOME/bin/rman. By doing this,
you avoid any path problems. There is a different Linux utility named rman.
SPFILE PFILE
Linux-Unique Tools
Graphical Measurement Tools
For Linux systems running X, there are a variety of graphical tools that can be installed to
monitor performance. The biggest advantage of X-based tools is the ease of interpretation.
X-Operating System View: xosview
The xosview tool shows CPU, disk, memory, and network activity. SuSE and UnitedLinux
install xosview by default. The package for xosview is distributed with Red Hat, but is not
part of the default install.
Note: Remember that X-based tools tend to influence the output by their own load on the CPU;
because of this they may not be the most accurate measurements of CPU usage.
Virtual Process File System: /proc
The /proc file system is a virtual file system that provides a look into the background workings
of the operating system. You can think of it as the Linux equivalent to Oracle’s v$ views. The
/proc file system exists in many Unix variants, whereas its contents are greatly expanded under
Linux.
Free Memory: free
The free command displays the total amount of free and used physical and swap memory in
the system, as well as the shared memory and buffers used by the kernel.
Managing Oracle on Linux 7-6
Linux-Unique Tools (continued)
Process Tree: pstree
This tool displays the relationship between processes in a tree structure, with parents to the left
and children to the right:
$ pstree
init-+-2*[Xvnc]
|-apmd
|-oafd
|-26*[oracle]
|-perl-+-emagent---emagent---4*[emagent]
`-java---java---52*[java]
Because the init process is system process number 1, it will always appear to the left. In this
snippet from the pstree output, you can see that there are two Xvnc processes running, 26
Oracle process running, and that the perl process has started two children, each of which has
started several other processes.
Resource Limits: ulimit
This tool shows the resources available to your shell. This tool is shell dependent; with the C
shell you would use limit –h instead.
/> bash
# ulimit –a (the –a flag shows all current limits)
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) 4
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 7168
virtual memory (kbytes, -v) unlimited
And many more
If it is measurable, chances are that there is a Linux package already written to measure it. Many
more utilities may be available depending on your distribution and which packages you have
installed. Consult your distribution-specific documentation for more information. Also, Oracle
provides Oracle Enterprise Manager, which provides a great deal of performance monitoring
information about the systems it is monitoring. Oracle Enterprise Manager will be discussed in
greater detail in the lesson titled “Oracle9i Measurement Tools.”
CPU I/O
Memory
Network
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME CPU COMMAND
1973 root 25 0 23480 9872 956 R 59.4 2.5 4:28 0 X
2487 oracle 15 0 29596 24M 1576 S 2.5 6.6 1:41 0 jre
2816 susan 15 0 21768 19M 1036 S 2.3 5.1 0:15 0 jre
2126 oracle 16 0 1080 1048 420 S 2.1 0.2 0:56 0 top
3218 root 16 0 1504 1504 860 R 2.1 0.3 0:02 0 top
3028 oracle 25 10 2820 2636 2052 R N 1.5 0.6 0:06 0 sproingies
2061 oracle 15 0 5852 2168 1100 S 0.9 0.5 0:08 0 rhn-applet-gui
1675 root 15 0 1800 728 540 S 0.7 0.1 0:12 0 snmpd
2602 oracle 15 0 8284 6452 1552 S 0.7 1.6 0:30 0 dbsnmp
1426 root 15 0 200 164 116 R 0.5 0.0 0:08 0 syslogd
2329 root 15 0 25876 9M 824 R 0.5 2.6 6:52 0 X
15 root 15 0 0 0 0 SW 0.3 0.0 0:09 0 kjournald
3008 root 15 0 12612 11M 7864 S 0.3 3.0 0:04 0 rhn-applet-gui
2212 root 15 0 26124 10M 812 R 0.1 2.7 9:01 0 X
2262 rlowenth 15 0 5836 2144 1084 S 0.1 0.5 0:12 0 rhn-applet-gui.
Many people do not realize that top is an interactive utility. From within top, you can enter
“?” to see a list of options. One more useful interactive command is “u” which allows you to
identify a single user for the top display output. For example, if you enter “u” and then type in
“oracle” then your list of processes would only include processes started by oracle. The
top displays’ default refresh rate is every two seconds, but you can change that interval with the
“s” command. When top is run by root, you can kill processes directly from within top by
using the “k” command.
CPU Measurements
Although there are dozens of different CPU measurements that you can look at, the ones listed in
the slide are the most important. These have the same meaning but slightly different labels
depending on the tool that is used to view them.
CPU Idle Time
This indicates the amount of time that CPU is in an idle state. Idle time is labeled %idle in
sar, id (under the CPU heading) in vmstat, and idle in top. If you are experiencing
performance problems, and CPU shows high idle time, then the system is not CPU bound.
CPU Time Spent Executing User and System Codes
These statistics have to be considered together. Together they represent the useful work that is
being done by the CPU. User time indicates the time that is spent in executing code in the user
space. System time measures the time that is spent in executing system calls. Every application
has a characteristic ratio of user to system. With an Oracle database, you should expect a ratio of
approximately 60% user code to 40% system code. If the user code percent is significantly
higher, then there may be inefficiencies in the application code. If the system code percentage is
significantly higher, look for system activity, such as high rates of disk I/O or memory swap.
# vmstat 2 5
procs system cpu
r b w … in cs us sy id
0 0 0 … 11 42 3 1 96
1 0 0 … 106 141 0 1 99
0 0 0 … 109 134 0 0 100
1 0 0 … 103 146 7 1 92
0 0 0 … 107 125 0 0 100
Note: Memory and IO statistics removed for readability
# mpstat -P ALL 1 1
Linux 2.4.9-e.3enterprise (delphi) 04/01/2003
cpu %user %nice %system %idle intr/s
all 19.50 0.00 31.50 49.00 111.00
0 27.00 0.00 42.00 31.00 111.00
1 12.00 0.00 21.00 67.00 111.00
# sar -u 2 5
Linux 2.4.9-e.12smp (delphi) 02/26/2003
cpu %user %nice %system %idle
all 36.25 0.00 1.75 62.00
all 23.75 0.00 1.50 74.75
all 33.25 0.00 1.50 65.25
Average:32.70 0.00 1.50 65.80
# sar -q 2 3
Linux 2.4.9-e.3enterprise (delphi) 04/01/2003
runq-sz plist-sz ldavg-1 ldavg-5
2 79 1.16 0.98
1 79 1.16 0.98
1 79 1.16 0.98
Average: 1 79 1.16 0.98
# iostat -c 2 3
Linux 2.4.9-e.3enterprise (delphi) 04/01/2003
avg-cpu: %user %nice %sys %idle
3.50 0.05 0.83 95.61
avg-cpu: %user %nice %sys %idle
41.00 0.00 1.25 57.75
avg-cpu: %user %nice %sys %idle
30.00 0.00 1.00 69.00
Linux Memory
Linux supports both real memory (RAM) and virtual memory (swap). A good rule of thumb is to
configure your swap space to be twice the size of real memory. For best performance, keep the
Oracle processes in RAM rather than swap.
Memory Limts
Linux on X86 architecture can only support 4 Gb of RAM by default (232=4,294,967,296). There
are a couple of ways around this limitation that will be discussed in a later chapter.
Note: These limits are based on IA-32 bit architecture. IA64 (Itanium) will address significantly
larger areas of memory
Swapped-in pages
Physical
memory (RAM)
Swapped-out pages
Virtual
memory Swap space (disk)
Swap
Virtual Memory
The total amount of virtual memory is the sum of physical memory and swap space. Each
process can use more memory than what physically exists. The process runs as long as the
process memory requirements fit in the virtual memory space. Linux uses swap space very
sparingly, and runs with little swap space. The swap partition must never be less than the size of
real memory, and it is recommended that the swap be twice the size of real memory. The amount
of swap that your application needs depends on the number of concurrent processes and the
amount of memory that each process requires. Linux uses a 4 KB page size by default (like most
things in Linux, this can be changed if needed). Red Hat Enterprise Linux supports very large
page sizes through its “bigpages” capability.
Page Out
If a page residing in memory is not used, it ages. The older a page, the more likely it is to be
overwritten. The swap looks for the oldest pages in each process every few seconds. If there is a
demand for free pages, swap overwrites the old pages. These pages are moved to the swap
cache in memory if they are dirty, or discarded if they are not dirty. If a page is needed again
before being moved from the cache to disk, then it is reloaded from the cache. Otherwise, it gets
flushed from the cache to the disk after a period of time.
Page out
Page in
#top
#free
#cat /proc/meminfo
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
1017 root 15 0 5944 5544 4360 S 0.7 1.0 2:10 Xvnc
20866 oracle 15 0 86360 67M 54228 S 0.5 13.4 0:10 java
1212 root 16 0 1188 1188 832 R 0.3 0.2 0:00 top
1 root 15 0 508 460 460 S 0.0 0.0 0:04 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 keventd
All the utilities that collect statistics, gather information from the /proc file system. The virtual
meminfo “file” gives an instantaneous snapshot of memory usage.
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 1054806016 1029685248 25120768 0 136949760 617668608
Swap: 534601728 22032384 512569344
MemTotal: 1030084 kB
MemFree: 24532 kB
MemShared: 0 kB
Buffers: 133740 kB
Cached: 585920 kB
SwapCached: 17272 kB
Active: 674312 kB
ActiveAnon: 214892 kB
ActiveCache: 459420 kB
Inact_dirty: 0 kB
Inact_laundry: 159476 kB
Inact_clean: 14016 kB
Inact_target: 169560 kB
HighTotal: 130524 kB
HighFree: 2032 kB
LowTotal: 899560 kB
LowFree: 22500 kB
SwapTotal: 522072 kB
SwapFree: 500556 kB
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 4096 kB
# vmstat 2 5
vmstat
The vmstat command has two parameters: frequency and count. Frequency is the number of
seconds between samples, and count is number of samples to take.
In this example, vmstat samples every two seconds for a total of five samples. The first output
line of vmstat shows all the activity since the last reboot. The following example shows a
loaded system, but with little swapping. Pages in are represented by “si” and pages out are
shown with “so.”
Note: The first line of output includes all activity since the last vmstat report.
# vmstat 2 5
procs memory swap io system cpu
r b w swpd free buff cache si so bi bo in cs us sy id
1 0 0 296004 3092 73268 61324 0 3 11 51 135 588 10 4 86
1 0 0 296004 3076 73268 61324 0 0 0 2 109 372 66 34 0
1 0 0 296004 3076 73268 61324 0 0 0 32 109 199 59 41 0
1 0 0 296004 3072 73268 61316 0 0 0 24 110 331 40 60 0
1 0 0 296004 3076 73268 61300 0 0 2 10 107 373 51 49 0
#sar -B 2 3
#sar -R 2 3
sar
The System Activity Reporter (sar) has many options.
The -B option shows pages in and pages out per second (pgpgin/s, pgpgout/s); the
number of active pages (activepg); and the inactive dirty, inactive clean, and inactive target
pages (inadtypg, inaclnpg, inatarpg). The inactive target is the demand rate.
# sar -B 2 3
Linux 2.4.9-e.3 (EDD1R28P1) 02/26/2003
xosview
Is I/O a bottleneck?
• Take and retain baseline I/O measurements.
• Individual measurements (snapshots) are usually
of little value. I/O monitoring should be done over
time.
• I/O issues with the swap partition should be
treated as memory problems first.
Is I/O a Problem?
With databases, disk I/O is a primary concern. Disk I/O is the single largest performance cost.
Most I/O measurements are meaningless without a baseline, so ensure that you capture and retain
that. When you notice performance degradation, look for high queue and wait statistics to
determine if I/O is the culprit.
Remember that virtual memory is maintained on disk, and will also show up as I/O. If you spot
high I/O statistics on the swap partition, you should troubleshoot it as a memory issue first, then
address it as an I/O issue.
I/O Measurements
I/O measurements usually concentrate on either the volume of data being handled or the speed
with which that data is handled.
Volume
Obviously, the more work that is being done the longer it will take to do that work. When you
measure volume, look at read and write volume separately. Also, if your tools allow you to view
it, monitor sequential operations as compared with random access. It is usually quicker to write
1MB of sequential data than to write 20K in multiple locations on the disk because of the time
required for disk head positioning.
Speed
When monitoring speed, look for transfer rate (bytes per second), wait time (how much time was
spent waiting for I/O to respond), and service time (how long does each I/O operation take from
start to finish). Of these three, the most important from a database performance standpoint is wait
time.
# sar -b 5 5
02:48:15 PM tps rtps wtps bread/s bwrtn/s
02:48:20 PM 2.40 0.00 2.40 0.00 147.20
02:48:25 PM 7.60 0.00 7.60 0.00 88.00
02:48:30 PM 2.60 0.00 2.60 0.00 94.40
02:48:35 PM 6.20 0.00 6.20 0.00 180.80
02:48:40 PM 1.80 0.00 1.80 0.00 41.60
Average: 4.12 0.00 4.12 0.00 110.40
# vmstat 3 3
procs io system cpu
r b w bi bo in cs us sy id
1 0 0 10 58 3 31 12 5 24
2 0 0 0 11 107 451 1 0 99
3 0 0 0 56 110 451 1 0 99
Network Traffic
Remember to view the network as one continuous pipe extending from the server all the way to
the client. Any bottlenecks along the way will affect the passage of network traffic over the
entire pipe.
Network traffic takes resources just as other I/O activities. The netstat -a | grep
ESTABLISHED command shows all active connections and the ports that are being used.
$netstat -a | grep ESTABLISHED
. . .
tcp 0 0 EDCDR38P1:44583 EDCDR38P1:1521 ESTABLISHED
tcp 0 0 EDCDR38P1:1521 EDCDR38P1:44583 ESTABLISHED
tcp 0 2 EDCDR38P1.us.ora:telnet 141.144.98.224:1865 ESTABLISHED
. . .
This command shows the connections, the ports, and the protocols. Consider the sources of your
traffic when the system is performing poorly.
To see the TCP statistics, use netstat -sp tcp and compare the values between runs. This
command produces a very large output. The sar command (in the following page) produces a
much more compact result but not nearly as detailed.
Statspack Output
Wait events are also ordered by wait time so as to put the most problematic events at the top.
Statspack also attempts to put the wait events that are not problematic (for example, pmon
timer) at the end of the list, regardless the time value.
SQL Statements
Statspack gives information about the SQL statements that are stored in the shared SQL area.
You use this section to determine which statements provide the best return on the time invested
in tuning SQL statements.
Several different ordered lists of SQL statements are given. SQL statements are sorted in order
of number of executions, number of parse calls, number of buffer gets, and number of reads. By
ordering the SQL statements by these different columns, it is easier to determine which
statements are causing the heavy workload. These statements should then be tuned first to get the
highest return on the time spent.
Tuning CPU
The CPU only works on behalf of an application. Some process is asking for high usage. The
problem is to discover which processes are asking for high usage. The CPU shows a high load
average or a larger run queue, whereas top gives a detailed view of which processes are using
the machine resources. In most cases, the first step in tuning the CPU should be to tune the SQL.
Each database read involves several CPU cycles. By tuning the SQL, both CPU and I/O
problems can be reduced.
With a large run queue, the goal is to reduce the number of processes or make the processes
more efficient to use less CPU. Some jobs can be shifted to a time when there is little load, and
the batch scheduler can be used to hold a job until the load average drops below .8. Some
processes may be moved to other servers.
If the processes that are running are using a high %system, then they are spending time in the
kernel or system calls. This indicates memory problems or inefficient code for other system
functions such as I/O. Each application has a characteristic percentage. The characteristic for
Oracle Server processes are 40/60, %user/%system.
A high %idle prompts you to look somewhere else, because this is not a CPU problem.
Processes often get blocked on I/O or paging, possibly on network I/O. When processes get
blocked, they are not on the run queue, and the CPU is idle.
Tuning Memory
The demand rate is higher than your baseline measurements, and pages in is showing a
consistently higher rate. These would indicate that the processes are allocating more memory
than they were when the baseline was created. And that extra allocation does not fit in real
memory.
Again, tuning the SQL must be the first step. Reducing sorts in the SQL reduces the memory
usage. Tuning the PGA areas is discussed further by using PGA_AGREGATE_TARGET or shared
servers later in this lesson. Processes can be moved off the database server, or can be scheduled
when there are fewer processes running, to reduce memory demands.
Note: For more details on SQL Tuning, attend the Oracle9i Database: SQL Tuning Workshop
course.
Tuning I/O
I/O problems tend to fall into a few areas: disk contention, large I/O queues, and large I/O waits.
A single problem may show symptoms in one or all of these areas.
The goal is to balance the I/O across all the available disks and controllers. If there is high
activity, blocks per second, or transfers per second on a particular device, there are often long
waits and large queues as well. Find the file or the combination of files that are being accessed,
and resolve the problem. Moving an active file to a striped partition increases the I/O bandwidth
that is available for that file. Memory issues can at first appear to be I/O issues. The swap device
shows high activity because of increased paging.
Tuning the SQL to reduce I/O, benefits the I/O subsystem with reduced requests, and reduces the
waits for I/O. It also improves the performance of the tuned statements. Tuning the SGA to hold
more of the frequently used database blocks also reduces I/O. Server processes check the SGA
for requested blocks before making an I/O request.
Multiple enterprise distributions now support asynchronous I/O. How to configure asynchronous
I/O to reduce I/O waits is discussed in the lesson titled “Tuning Oracle9i and Linux.”
$ oemapp pm
Using PGA_AGGREGATE_TARGET
You can globally manage the size of SQL work areas automatically. Specify the amount of
memory to be dedicated to PGA use for the instance. Set the PGA_AGGREGATE_TARGET
initialization parameter to the specified number (for example, 2 GB). This is the global target for
the instance. The database instance tries to limit the total PGA memory allocated across all
dedicated server processes to this target value. By using this feature, you can use the unused
memory from one process in another process, based on the work area space needed.
PGA_AGGREGATE_TARGET is dynamic at the instance level.
Note: PGA_AGGREGATE_TARGET is now used in place of the many *_AREA_SIZE
parameters of earlier releases.
Monitoring PGA Memory Usage
To monitor the amount of memory allocated to PGA, use the following command:
SQL> SELECT sum(pga_alloc_mem) FROM V$PROCESS;
This shows the total memory allocated to PGA instancewide at the time the command is
executed. Run this command several times while the system is under heavy load to get an
average value. If the value here is consistently higher than your setting for the
PGA_AGGREGATE_TARGET parameter, consider raising PGA_AGGREGATE_TARGET.
Write Flush
I/O Modes
In Linux, there are multiple methods of writing to disk.
The standard method writes the data to the operating system buffer cache, then the buffer is
written to disk by a kernel process at a later time. If the machine crashes or loses power before
the buffer is written to disk, the data is lost. This method is fast, but not acceptable for Oracle
Database file I/O because of the potential for data loss.
Synchronous I/O, also known as write-thru-cache, writes the data to the buffer but also forces an
immediate write to the file system. The process that makes the write request will be suspended
until the write is completed. The completion is signaled by the disk controller when the buffer is
written to disk. On some disk subsystems with large caches, the controller signals a completion
when the buffer is written into the subsystem cache. Although synchronous writes are slow, they
are the default method for DBWR and LGWR processes to do their writes because this I/O method
is supported on all distributions.
Asynchronous writes allow instance background processes to make multiple write requests
without being suspended after each request. The completion must still be signaled back to the
process. This permits a much larger throughput, because the background process can continue
work without waiting on the disk I/O to complete. The standard Linux kernel does not allow for
asynchronous writes, but SuSE, Red Hat, and UnitedLinux have implemented changes to support
asynchronous writes in their enterprise distributions.
Write
Read
Process Disk file
Raw Partitions
Raw partitions have long been considered the ultimate in I/O performance. When new file
systems are benchmarked, they are frequently compared to raw partitions. The main benefit of
raw partitions is the lack of caching. Oracle server caches its own database blocks, and for the
normal reads in an online transaction processing (OLTP) environment, the simple read ahead
that is done by the file system is not effective. By avoiding the OS cache, the raw reads and
writes are not copied in memory, and the application doing the reads and writes can choose much
larger buffers for the data transfers than are allowed by the file system.
The penalties of using raw partitions are mostly administrative. Raw partitions can have only one
data object on a partition. So each data file, control file, and redo log file needs its own raw
partition. Linux has a limit of 255 raw partitions and a practical limit of 14 partitions per disk.
Because raw partitions do not have a file system, many file manipulation tools, such as ls, cp,
cpio, and mv, are not available. The only transfer tool available for raw partitions in Linux is
dd. Because of its interface, dd is considered by some to be not user friendly.
Until recently, raw partitions were the only way to share disk storage between nodes of a cluster
under most operating systems (VMS and Tru64 are exceptions to this rule). Because of this, you
were usually required to use raw partitions for Oracle Real Application Clusters. OCFS can now
be used for Oracle Real Application Clusters instead of raw partitions.
Disk Guidelines
Balance the I/Os Across All the Available Disks and Controllers
For best performance, balance the I/Os. That requires eliminating hot spots, and spreading the
data files across more than one disk. Tablespaces can be manually striped by putting data files on
different disks. You can also stripe data files with OS or hardware utilities such as Redundant
arrays of inexpensive disks (RAID). By striping all the files across all the available disk drives,
the goal of balancing I/Os is automatically met, but the cost of redistributing the stripes can be
high when more disks are added.
Size for the Required Bandwidth
With the disk capacity increasing faster than the I/O bandwidth, the number of disks and
controllers must be chosen based on the transfer rate required rather than the amount of data to
be stored. It is possible to store a 150 GB database on a single drive, but usually not advisable
due to performance considerations. To have sufficient bandwidth, the number of disks and the
number of controllers must be considered. A transfer rate of 500 MB per second with 20 MB per
drive requires at least 25 drives.
DB_WRITER_PROCESSES
• Set to no more than CPU_COUNT, up to 20.
• Multiple DBWR processes write from LRU to disk.
• These processes can use asynchronous I/O.
• These processes are best used in OLTP
environments.
LRU lists
DBWR processes
DBWR_IO_SLAVES
• Used to simulate asynchronous I/O
• One DBWR, multiple writers to disk
Buffer
cache DBWR
I/O slaves
DB Writer Slaves
On systems without asynchronous I/O capability, the database instance provides a way to
simulate asynchronous I/O with the DBWR_IO_SLAVES. Asynchronous I/O is only available on
Red Hat Enterprise Linux AS and the Enterprise version of UnitedLinux and SuSE at this time.
Set this parameter to no more than two times the number of disks that the database is spread
across. When increasing DBWR_IO_SLAVES, consider the number of disk controllers and
monitor the disk I/O queues for contention. Also, when increasing the number of slaves, add only
a few at a time, because each of these processes have an overhead cost. If you add too many at
once, the overhead of all the processes may outweigh the benefit of the additional processes.
Each slave must have a communication area for I/O buffers. This area is taken from the large
pool if it is configured, or from the shared pool if the large pool does not exist. Turning on
DBWR_IO_SLAVES forces DB_WRITER_PROCESSES to one, and sets the number of slave
processes used by the ARCH and LGWR processes to four. Even though I/O slaves are generally
used to simulate asynchronous I/O, the slaves use asynchronous I/O if it is turned on.
Note: The use of multiple DBWR processes and I/O slaves are mutually exclusive.
• Asynchronous I/O
• Advanced memory configurations
– Modified memory map
– Shared memory file system
Choosing a Kernel
The Linux installers tend to make good choices about which kernel to install, and install the
kernel that uses your hardware and gives a good performance. If you have to choose which
kernel to use, follow these guidelines.
For machines with more than 4 GB of physical memory, an enterprise kernel is required.
The enterprise kernel includes the Physical Address Extensions (PAE) that is required to
address more than 4 GB of physical memory. This includes a three-level memory page table, so
if you have less than 4 GB of physical RAM, then the three-level page table is an extra overhead
that is not required. Red Hat identifies the enterprise kernel with the word “enterprise” in
the kernel version name, for example 2.4.9-e.3enterprise.
For multiprocessor machines, the installer chooses an smp kernel. The smp kernel has the
required extensions to handle scheduling processes on more than one CPU. An example of the
Red Hat smp kernel is 2.4.9-e.3smp.
The uniprocessor kernel handles up to 4 GB of physical memory on a single processor. An
example of the uniprocessor name is 2.4.9-e.3. (Note that there is no special designator.)
An enterprise or smp kernel may be used on an uniprocessor machine, but has extra
overhead associated with the unused features.
1.25 GB
Shared libraries lib*.so
1.0 GB mapped_base
336 MB
Shared libraries lib*.so mapped_base
256 MB
Oracle Executables,
Application code
128 MB user processes
Kernel (not paged)
kernel.shmmax = 3000000000
Modifying shmmax
The shmmax parameter can be changed dynamically, but unless you want to have to repeat the
change every time you reboot the server you should enter the change in the
/etc/sysctl.conf file. The previous rule of thumb of limiting shmmax to half of real
memory does not apply here. It is assumed that the amount of SGA needed has already been
determined. The amount of process memory needed is also known. The sum of the SGA, the
process memory, and the kernel and OS caches must be sized to be allocated without excessive
paging.
Lowering mapped_base
The mapped_base is an address in virtual memory where the mmap starts looking for a chunk
of memory to allocate to the shared memory. The larger memory addresses are considered lower
in memory. By starting the search at a lower address, a larger shared memory allocation up to 2.7
GB is possible. The mapped_base parameter is set on a per process basis, so it cannot be set
during boot up, or for the entire system.
Lowering the mapped base is a requirement for every shell that spawns an Oracle server process
on the server. This includes any shell that is used to connect locally to the database and the shell
used to start the listener (this way, listener-spawned processes inherit a lowered
mapped_base). This step will have to be performed EVERY TIME you start the instance. This
means you will not be able to start the instance using Oracle Enterprise Manager or other tools.
The mapped_base parameter is inherited by any process spawned by a shell that has the
mapped_base lowered.
Start a shell as the oracle user. In the shell, find the process ID by using ps or echo $$.
Start another shell as the root user and lower the mapped_base with the following command:
# echo 268435456 > /proc/<your process ID>/mapped_base
where 268435456 is decimal for 0 x 10000000.
$ cd $ORACLE_HOME/rdbms/lib
$ cp ksms.s ksms.s_orig /* if ksms.s exists,
back it up first.*/
$ genksms -s 0x15000000 > ksms.s
Start up the Oracle9i Release 2 instance. If you are using this method in conjunction with
altering the Linux memory map, then do not forget to reset mapped_base before starting the
instance. Memory allocated to DB_BLOCK_BUFFERS will now be consumed from the shared
file system located at (in this example) /dev/shm leaving up to 2.7 GB for other SGA areas.
Oracle University
Oracle University is the world’s largest corporate educator with education centers around the
globe. Boasting one of the highest customer satisfaction ratings in the industry (over 95%), our
instructors are experts on Oracle technology and can help you get the most from your software.
http://appsnet.oracle.com
Oracle AppsNet
The Oracle AppsNet is a clearinghouse for information on Oracle applications. Here you will
find information about the most powerful, best integrated, fastest growing applications suite,
Oracle e-Business applications.
With everything from Oracle 11i documentation to upgrade tips to white papers and technical
presentations, AppsNet is a must if you are using Oracle Applications.
http://metalink.oracle.com
Oracle MetaLink
Oracle MetaLink is your gateway to Oracle’s Support resources. Here you will find answers to
the most common issues facing Oracle administrators and developers, as well as the resources to
solve many of those issues.
Like the Oracle Technology Network, MetaLink includes up-to-the-minute headlines about
issues that affect the Oracle professional.
Thank You!
Oracle University’s mission is to enhance the adoption of Oracle technology. Our goal is to
partner with you, providing information that is pertinent, timely, and relevant to your needs.
Please take a minute to complete the end of course evaluation and let us know how we can serve
you better. If something comes to mind after you leave us, feel free to e-mail our office of
customer satisfaction at:
customersat_us@oracle.com
If you have questions about continuing your Oracle education, need help finding a class, or want
to arrange for on-site training at your company, please contact Oracle Education Services for
assistance. In the US, dial 800.529.0165. For contact numbers outside the United States, check:
http://www.oracle.com/education/index.html?contact.html
Thanks again, hope to see you in another class!