tutorial hk: configuring oracle on linux for peak performance roger schrag database specialists,...

87
Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc. www.dbspecialists.com LinuxWorld Conference & Expo August 10, 1999

Upload: molly-henderson

Post on 25-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Tutorial HK:Configuring Oracle on Linux For

Peak Performance

Roger Schrag

Database Specialists, Inc.

www.dbspecialists.com

LinuxWorld Conference & Expo

August 10, 1999

Page 2: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Today’s Presentation

• Introduction to Oracle technology

• Installing Oracle

• Managing your database

• Optimizing your database

• Where to get more information

Page 3: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

About The Author

• 10+ years experience with Oracle technology

• Lots of Oracle DBA experience on Unix platforms

• Mostly e-business and ERP systems

• Presenter at Oracle user groups and conferences

• Author of various white papers

• Linux believer

Page 4: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Today’s Goals• Get a basic understanding of “How Oracle

Works”

• Learn the proper way to install Oracle

• Gain access to accurate information

Page 5: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Oracle Quick Start

• Learn basic Oracle concepts

• Install Oracle software

• Create a default database

• Make the default database usable

• Create application schema

• Develop application

• Big picture issues (backups, capacity planning…)

Page 6: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

An Introduction to Oracle Technology

• Platform independence

• Database terminology

• Important files

• Oracle process architecture

• Environment variables

• Optimal flexible architecture

• Interacting with a database

Page 7: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Platform Independence

• Abstraction of platform-specific issues

• Generic and platform-specific documentation

• Oracle skills transfer well from one platform

to another

Page 8: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Database Terminology

• Key fundamentals

• Learn them correctly

• Many “Oracle-isms”

Terminology

Page 9: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

DBA• Stands for “database administrator”• Involved in logical design of a

database• Performs the physical design and

implementation• Assists developers with difficult

database issues• Responsible for ensuring good

performance, proper security, as well as backup and recovery strategies

Terminology

Page 10: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Database

• A collection of operating system files that

make up one physical data store or node

• Many different types of data, each with its

own attributes, can be stored in one database

Terminology

Page 11: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Database Name

• Every Oracle database has a name

• Eight characters or less

• Default global domain name is “.WORLD”

• Best to give each database a unique name and use one common domain

Terminology

Page 12: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Instance

• A set of operating system processes and shared memory structures which allow an application to access data in a database

Terminology

Page 13: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Instance Name

• Also known as SID (System Identifier)

• Applications identify which instance they

wish to access by name

• The convention is to give an instance the

same name as the database it accesses

Terminology

Page 14: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

• Stands for System Global Area

• A collection of shared memory structures

created by an Oracle instance

• Each process of the instance attaches itself to

the SGA upon startup

SGA

Terminology

Page 15: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Starting the Database

• Opening a database so that applications may access it

• Done by starting up an instance and mounting it to the database

Terminology

Page 16: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Net8 or SQL*NET

• Networking infrastructure that allows applications to access databases on remote servers

• Was called SQL*Net before Oracle8• Renamed to Net8

Terminology

Page 17: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Client/Server

• Oracle internally uses a client/server architecture

• The application accessing Oracle is seen as the client, the Oracle server process is a server

Terminology

Page 18: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Username

• Each user in an Oracle database has a unique name up to 30 characters in length

• Separate usernames in the database do not need to map to separate real-life users

Terminology

Page 19: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Schema

• A separate namespace for database objects such as tables, indexes and stored procedures

• Every database object resides in one schema

• Each database user has one schema with the same name as their username

• Username = schema

Terminology

Page 20: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Data Dictionary

• Repository of information indicating all of the users defined in the database and all of the objects they own

• A set of database tables with names like user$ and tab$

Terminology

Page 21: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

SYS and SYSTEM

• SYS user owns all of the internal structures that make up the data dictionary for the database

• SYS user has all privileges on the database

• SYSTEM user has DBA privileges also

Terminology

Page 22: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Control Files, Data Files, Redo Logs and Parameter Files

• The physical files that make up an Oracle database

Terminology

Page 23: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Tablespace

• A named collection of one or more physical files used for storing database objects

• Mask certain implementation details from application developers

Terminology

Page 24: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Extent

• One contiguous chunk of physical storage

within a tablespace

• Can range in size from 2 Kb to 2 Gb, but must

be contiguous

Terminology

Page 25: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Segment

• A collection of extents that belong to one object

• Physical storage used to hold the data for an object

• Most hold the contents of a table or index, but there are other types of segments as well

Terminology

Page 26: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Rollback Segment

• Stores “undo” information for a transaction that is still in progress

• Allows Oracle to back out the transaction if the application requests a rollback

• Enables one session to update data while another is querying the same data

Terminology

Page 27: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Temporary Segment

• Holds a partial result set when too much data

is involved to complete the operation in

memory

• Commonly used when sorting data for

ordering, grouping, or building an index

Terminology

Page 28: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Identifier

• Most are limited to 30 bytes in length and are

case-insensitive

• Unless quoted, identifiers must start with a

letter and may include letters, digits and

certain special characters like _, $, and #

Terminology

Page 29: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

The Files That Control an Oracle Instance

• Parameter file

• Password file

Page 30: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

The Files That Make Up a Database

• Control files

• Data files

• Online redo logs

• Archived redo logs

Page 31: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

The Oracle Process Architecture

• Database

• Instance

• Net8

• Applications

Page 32: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

The Oracle Instance

• Shared global area (SGA)

• Daemon processes

• Server processes

Page 33: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Oracle Daemons

Process Monitor PMONSystem Monitor SMONLog Writer LGWRDatabase Writer DBWnCheckpoint CKPTArchiver ARCHRecoverer RECOJob Queue SNPnLock LCKn

Page 34: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Oracle Process Architecture

Page 35: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Making an Oracle Database Available

1. Start an instance

2. Mount the database

3. Open the database

Page 36: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Accessing a Local Database

1. Application forks an Oracle server process

2. Environment variable indicates which local database to access

3. setuid bit allows server process to attach to SGA, read data files

4. Application communicates with server process via IPC

Page 37: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Accessing a Remote Database

1. Net8 client resolves alias to hostname, port, and instance name (in the case of TCP/IP protocol; other protocols supported)

2. Net8 client sends a request to the Net8 listener on the database server

3. Net8 listener on database server forks an Oracle server process

4. Application communicates with server process using any supported protocol

Page 38: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Environment Variables

• ORACLE_HOME

• LD_LIBRARY_PATH

• PATH

• ORACLE_SID

• TWO_TASK

• NLS_LANG

• ORA_NLS33

• ORACLE_BASE

• DBA

Page 39: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$ORACLE_HOME

• Location of Oracle software installation

• For example: /u01/app/oracle/product/8.0.5

• Always required

Page 40: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$LD_LIBRARY_PATH

• Location of Oracle shared libraries

• Must include $ORACLE_HOME/lib

• For example:

/u01/app/oracle/product/8.0.5/lib

• Always required

Page 41: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$PATH

• Location of Oracle executables

• Must include $ORACLE_HOME/bin

• For example:

/u01/app/oracle/product/8.0.5/bin

• Always required

Page 42: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$ORACLE_SID

• Name of local Oracle instance to access

• For example: MYDB

• Overridden if application specifies Net8 alias or if $TWO_TASK is set

• Required if application does not specify Net8 alias and $TWO_TASK is not set

Page 43: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$TWO_TASK

• Net8 alias for local or remote Oracle instance to access

• For example: MYDB

• Overridden if application specifies Net8 alias explicitly

• Optional

Page 44: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$NLS_LANG

• Language and character set of client application

• Format is language_territory.CHARSETNAME

• For example: american_america.US7ASCII

• See platform-specific installation guide for a list of supported settings

• Required when default character set is not being used

Page 45: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$ORA_NLS33

• Location of Oracle client NLS character set data• Typically

$ORACLE_HOME/ocommon/nls/admin/data

• For example: /u01/app/oracle/product/8.0.5/ocommon/nls/admin/data

• Required when default character set is not being used

Page 46: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$ORACLE_BASE

• Location of OFA directory structure

• For example: /u01/app/oracle

• An optional convenience

Page 47: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

$DBA

• Location of instance-related administrative

files

• For example: /u01/app/oracle/admin

• An optional convenience

Page 48: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Optimal Flexible Architecture

• A set of best practices for installing Oracle

• Developed by Oracle Consulting and refined over the years

• Observed reasonably well by the Oracle Installer

• See platform-specific administrator’s reference for complete OFA specification

Page 49: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

OFA Guidelines

• Assigning and naming mount points

• Directory hierarchies

• Naming conventions for all files

• Naming conventions for tablespaces

• Policies for assigning segments to tablespaces

Page 50: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

OFA Benefits• A standardized methodology

• A good naming convention

• Files organized in an easy-to-find manner

• Support for multiple databases or Oracle releases on one server

• Separation of Oracle software and database files

• Ability to distribute I/O across many physical devices

Page 51: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Key Directories in anOFA-Compliant Installation

• $ORACLE_BASE• $ORACLE_BASE/product/<version>• $ORACLE_BASE/admin/$ORACLE_SID

– pfile– bdump– cdump– udump– create

• <mount point>/oradata/<dbname>

Page 52: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Accessing an Oracle Database(as a DBA)

• SQL*Plus

• Server Manager

• Enterprise Manager

Page 53: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Installing Oracle

• Prepare the server

• Install the Oracle software

• Create a database

• Complete the server configuration

Page 54: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Our Installation Environment

• Oracle 8.0.5 Standard Edition

• Red Hat Linux 5.2

You are welcome to use other versions of Oracle or other distributions of Linux, but you may need to deviate from these steps

Page 55: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Oracle 8i

• Just became available in late July

• Installs very differently than Oracle 8.0.5

• Released too late to include in this presentation

Page 56: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Prepare the Server

1. Meet the software requirements

2. Meet the hardware requirements

3. Meet the kernel parameter requirements

4. Create a Linux group for DBAs

5. Create a software owner Linux account

6. Create mount points

7. Choose a local bin directory

Page 57: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Prepare the Server (continued)

8. Mount the CD ROM

9. Create the /etc/oratab file

Page 58: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Install the Oracle Software

1. Edit software owner’s login script

2. Log out and back in to set environment

3. Verify that TCP/IP is working

4. Ensure there is enough storage space

available

Page 59: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Install the Oracle Software (continued)

5. Run the Oracle Installer to install software

a. Choose a custom install

b. Choose to install software without creating a database

c. Choose a language for database messages

d. Choose the products to install

e. Choose the DBA and osoper groups

Page 60: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Install the Oracle Software (continued)

6. Add enhancements to the oraenv script

7. Add enhancements to the dbshut script

8. Perform certain steps as the root user

9. Double check file permissions

Page 61: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Create a Database

1. Choose a database block size

2. Tweak an Installer script to get the desired

block size

Page 62: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Create a Database (continued)3. Run the Oracle Installer to create a database

a. Choose a custom install

b. Choose to create database objects

c. Choose relevant products for database creation

d. Choose to create a filesystem-based database

e. Specify the mount point for the database

f. Choose the character sets for the database

g. Choose database passwords

h. Choose whether to load SQL*Plus help and demo

Page 63: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Create a Database (continued)4. Configure the Net8 listener

5. Prepare a tnsnames.ora file

6. Improve the parameter file

7. Relocate data files and redo logs to balance I/O

8. Configure the temporary tablespace

9. Configure rollback segments

10.Create application tablespaces

11.Create application schemas and roles

Page 64: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Complete the Server Configuration

1. Update the /etc/oratab file

2. Remove hardcoding from software owner’s login script

3. Create separate Linux accounts for database users

4. Configure automatic database start on server reboot

Page 65: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Managing Your Database

• Starting and stopping

• Connectivity and troubleshooting

• Schemas and users

• Tablespaces and segments

• Fault tolerance and backups

Page 66: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Opening and Closing a Database

• Invoking Server Manager

• Authentication

• STARTUP

• SHUTDOWN

Page 67: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Starting and Stopping theNet8 Listener

• Invoking the listener control tool

• START

• STOP

• RELOAD

Page 68: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Logs and Trace Files

• Instance alert log

• Trace files for daemons

• Trace files for server processes

• Net8 logs

Page 69: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Net8 Connectivity Problems

• TNS: could not resolve service name

• TNS: unable to connect to destination

• TNS: no listener

• ORACLE not available

• TNS: listener could not resolve SID given in connect descriptor

Page 70: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Schemas and Users

• Application owner schemas– Contain application schema objects– Not used by end users

• Individual Oracle users– Database authenticates end users– Synonyms reference application objects– Privileges to access application objects– Commonly used in client/server systems

Page 71: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Schemas and Users (continued)

• Generic Oracle users– Application authenticates end users– Synonyms reference application objects– Privileges to access application objects– Commonly used in web-based systems

Page 72: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Tablespace Functions

Tablespace Contents Name in Default Database

Data dictionary and Oracle internals SYSTEM

Rollback segments RBS

Temporary segments TEMP

Oracle and third party tools TOOLS

Unclassified user segments USERS

Application tables n/a

Application indexes n/a

Page 73: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Assigning Application Segmentsto Tablespaces

• Use separate tablespaces for each application

• Place tables and indexes in separate tablespaces

• Separate segments that grow or shrink rapidly from more static ones

• Separate segments that are created and dropped frequently from longer lived ones

• Give large segments their own tablespace

Page 74: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Segment Storage ParametersName Purpose

initial Size of the initial extent

next Size of the next extent to be allocated

pctincrease Factor by which to increase the size of eachsuccessive next extent

minextents Initial number of extents to allocate

maxextents Maximum number of extents the segment isallowed to have

pctfree Space to leave empty in each new block to allowfor updates that cause data to take up more space

pctused How much space in a block must be free beforeadditional data will be inserted

Page 75: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Choosing Storage Parameters For Segments to Maximize Performance and

Minimize Fragmentation

• Set the default storage clause for each tablespace as follows:

INITIAL 128k, 4m, or 128m

NEXT Same as INITIAL

MINEXTENTS 1

MAXEXTENTS 1024

PCTINCREASE 0

Page 76: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Choosing Storage Parameters For Segments to Maximize Performance and

Minimize Fragmentation (continued)

• When creating segments, assign them to a tablespace but do note specify storage parameters

Optimizing storage parameters was much more complicated with earlier versions of Oracle, but starting with Oracle 7.3

this task became greatly simplified.

Page 77: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Make Your Database Fault Tolerant

• Store multiple control files on separate devices

• Store multiple members of each online redo log group on separate devices

• Store data files on RAID filesystems

Eliminate single points of failure wherever possible.

Page 78: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Backing Up an Oracle Database

• Export

• Cold Backups

• Hot Backups

• Recovery Manager

Page 79: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Optimizing Your Database

• Tuning applications

• Sizing the SGA

• Balancing I/O

• Tuning sorts

• Configuring rollback segments

Page 80: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Tuning Database Applications

• Use bind variables to reduce parsing

• Tune queries so Oracle can run them efficiently– Use tools like EXPLAIN PLAN and TKPROF– Look inside the SGA while application is running

• Tune application logic to make the most of SQL and PL/SQL

Application tuning usually gives the biggest bang for the buck when optimizing Oracle systems. Reducing running time from 18 hours to ten

minutes by changing one line of code is not uncommon.

Page 81: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Sizing the SGA• Size the buffer cache

– Set the db_block_buffers parameter– Query v$sysstat to check hit ratio– Consider checking extended LRU statistics

• Size the shared SQL area– Set the shared_pool_size_parameter– Consider use of bind variables and PL/SQL when

sizing

Maximize cache hit ratios while keeping the entire SGA in physical memory at all times.

Page 82: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Balancing I/O

• Assign segments to tablespaces carefully

• Distribute data files across physical devices

• Query v$filestat to check I/O counts

• Adjust file placement as needed

Page 83: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Tuning Sorts

• Set sort_area_size parameter

• Assign all users a temporary tablespace

• Set content type of temporary tablespace to

TEMPORARY

• Set storage parameters on temporary

tablespace

Page 84: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Configuring Rollback Segments

• Lots of small segments for OLTP

• A few large segments for batch

• Usually, need to mix the two

Page 85: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Where To Get More Information

• Oracle documentation

• Other publications

• Oracle Technology Network

• Oracle user groups

• Free web resources

Page 86: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Slide Show and Tutorial Are Available in Soft Copy

Visit

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

for this presentation

Page 87: Tutorial HK: Configuring Oracle on Linux For Peak Performance Roger Schrag Database Specialists, Inc.  LinuxWorld Conference & Expo

Contact Information

Roger Schrag

[email protected]

Database Specialists, Inc.

388 Market Street, Suite 400

San Francisco, CA 94111

415-344-0500