managing oracle on linux

35
Managing Oracle on Unix /Linux

Upload: obeidatdba

Post on 28-Nov-2014

131 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Managing Oracle on Linux

Managing Oracle on Unix /Linux

Page 2: Managing Oracle on Linux

INTRODUCTION

• Kernel

• Shared Memory

• Semaphores

• File Handles Parameter

Page 3: Managing Oracle on Linux

Basic Tuning Methodology

CPU

Memory

I/O

Tune the Database

Tune the Hardware

Page 4: Managing Oracle on Linux

Standard Measurement Tools

Linux has measurement tools that are common to UNIX platforms:

• Top Resource Consumers : top• System Activity Reporter: sar• Virtual Memory Statistics: vmstat• I/O Statistics: iostat• System Log files: /var/log/messages

Page 5: Managing Oracle on Linux

Monitoring and Tuning CPU

Is the CPU a bottleneck?

• How many CPUs does the machine have?

• What is the load average?

• What is the load factor?

Page 6: Managing Oracle on Linux

top

Page 7: Managing Oracle on Linux

top

Top is an interactive utility.

? - to see list of options.

u - allows to identify a single user for

the display

s - to change the refresh rate.

k - to kill processes if top is run by root

user

Page 8: Managing Oracle on Linux

CPU Measurements

Identify the following CPU statistics and interpret them:

• CPU Idle Time (%idle)

• CPU Time Spent Executing User and System Codes (%user, %system)

• Processes Waiting for CPU Time (run-queue size)

(runq-sz)

Page 9: Managing Oracle on Linux

mpstat

• $ mpstat -P ALL 1 2

Page 10: Managing Oracle on Linux

vmstat

Page 11: Managing Oracle on Linux

sar

.

Page 12: Managing Oracle on Linux

iostat

.

Page 13: Managing Oracle on Linux

Interpreting CPU Measurements

Observe cases where the system has:

• High idle time with poor response time

• Too much time spent executing user code

• Too much time spent executing system code

• Run-queue size more than double the number of CPUs

• Extremely high context requests per second

Page 14: Managing Oracle on Linux

Reducing CPU Bottlenecks

• Schedule non-time critical jobs to run during times when CPU is less loaded.

• Too many batch jobs cannot be started simultaneously

• Reduce the demand on CPU by eliminating unnecessary work or offloading work to a different server.

Page 15: Managing Oracle on Linux

Memory

Types – Real & Virtual

Measure memory utilization and paging. Significant memory statistics include:

Total Memory Context switches Pages in and out Inactive pages Demand rate

Page 16: Managing Oracle on Linux

top

Page 17: Managing Oracle on Linux

/proc/meminfo

.

Page 18: Managing Oracle on Linux

vmstat

.

Page 19: Managing Oracle on Linux

sar

.

Page 20: Managing Oracle on Linux

Interpreting Memory Measurements

Observe cases where the system has:

• High Swap Memory Usage

• High Page ins / Page outs

• Low inactive Pages.

Page 21: Managing Oracle on Linux

Reducing Memory Bottlenecks

• If we determine that memory is the limiting factor in our system, then:

Increase memory resources

Decrease memory demand

Page 22: Managing Oracle on Linux

Export/Import File Compression Utilities

• Create a special FIFO file named " exp.pipe" :

$ mknod exp.pipe p

. Use any compression options,

$ bzip2 < exp.pipe > exp.bz2 &

exp.gz - compressed file

& - Used to run the process in the background.

. Now use the normal export command with file=exp.pipe

$ exp …… file = exp.pipe ……

Page 23: Managing Oracle on Linux

Import

• create another file " imp.pipe " as in step 1

• $ bunzip2 < exp.bz2 > imp.pipe &

. Use the normal import command with file=imp.pipe

$ imp file = imp.pipe …..

Page 24: Managing Oracle on Linux

Tracking an Event in Unix/Solaris

• Truss

Traces a process's system calls, dynamically loaded user level function calls, received signals, and incurred machine faults.

Example: Imp (command line options) ps -ef | grep impOracle 3725 3720 0 13:43:07 pts/7 0:00 grep imp

Oracle 3714 3663 0 13:42:27 pts/1 0:00 imp

Page 25: Managing Oracle on Linux

Truss –p 3714Received signal #20 , SIGWINCH, in read () [default]

Read (0, 0xEF655EA4,1024) (sleeping ………..)

Read (0, “ scott\n “,1024) = 6

Lseek(3, 5120, SEEK_SET) = 5120

Read (3, “\0\f\OCE\O\O\P” .., 512) = 512

Write (1, “ password : “,10) = 10

Ioctl (0, TCGETA, OxEFFF30C) = 0

Ioctl (0, TCGETS, OxEFFF384) = 0

Ioctl (0, TCGETSF, OxEFFF384) = 0

ps –ef | grep 3714Oracle 3714 3731 0 13:47:57 pts/1 0:00 imp

Oracle 3743 3714 0 13:53:27 ? 0:00 mydb

(DESCRIPTION= (LOCAL=YES) (ADDRESS= (PROTOCOL=beq)))

Oracle 3747 3706 0 13:59:57 pts/6 0:00 grep 3714

Page 26: Managing Oracle on Linux

I/O Measurement

Criteria for Measurement

1.Volume:

-Volume of data being handled.

2.Speed :

-Transfer rate, Wait time and

Service time are monitored

Page 27: Managing Oracle on Linux

.

•READ / WRITE OPERATIONS

•REQUEST QUEUE SIZE

•TRANSFER RATE

•WAIT TIME

•SERVICE TIME

Page 28: Managing Oracle on Linux

Tools for measuring I/O

1.I/O STAT

2. Sar

3. vmsstat

Page 29: Managing Oracle on Linux

I/O STAT• $ iostat -d 2 4• Linux • Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn• dev8-0 7.10 18.31 125.16 80095708 547572178• dev8-1 0.02 0.42 0.14 1833186 606334• dev8-2 52.06 395.60 896.02 1730727488 3920045878• dev8-3 0.02 0.42 0.13 1840394 576328• dev8-4 51.95 388.55 896.73 1699884394 3923163422

• Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn• dev8-0 0.00 0.00 0.00 0 0• dev8-1 0.00 0.00 0.00 0 0• dev8-2 1.50 0.00 24.00 0 48• dev8-3 0.00 0.00 0.00 0 0• dev8-4 0.00 0.00 0.00 0 0• Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

• dev8-0 3.00 0.00 96.00 0 192• dev8-1 0.00 0.00 0.00 0 0• dev8-2 3.50 0.00 56.00 0 112• dev8-3 0.00 0.00 0.00 0 0• dev8-4 4.50 0.00 84.00 0 168• Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

• dev8-0 0.00 0.00 0.00 0 0• dev8-1 0.00 0.00 0.00 0 0• dev8-2 1.00 0.00 16.00 0 32• dev8-3 0.00 0.00 0.00 0 0• dev8-4 0.50 0.00 8.00 0 16

Page 30: Managing Oracle on Linux

Sar

• $ sar -R 2 3• Linux

11:21:11 PM DEV tps rd_sec/s wr_sec/s

01:23:24 PM dev1-1 -771.14 2.49 279.10

01:23:26 PM dev1-2 -1215.08 6.53 202.01

01:23:28 PM dev1-3 109.05 1.01 107.04

Average: -626.21 3.34 196.33

Page 31: Managing Oracle on Linux

vmsstat $vmstat 1 2

bi bo 1 1 3419 808

bi: Blocks received from a block device (blocks/s).

bo: Blocks sent to a block device (blocks/s).

Page 32: Managing Oracle on Linux

Interpreting I/O Measurements• High request volume or queue size overall

- means that the I/O devices are unable to handle

the rate of I/O requests or the channels in the I/O devices are too slow.

• High request volume or queue size for one device

- indicates that I/O may not be balanced across available devices.• High wait times -Indicative of hardware problems or I/O slaves in

use.

Page 33: Managing Oracle on Linux

Reducing I/O Bottlenecks

• reduce i/o through application tuning or memory tuning

• increase i/o by parallelizing I/O -multiple disk controllers - multiple disks -multiple data bus adapters• select hardware carefully – storage arrays

(RAID) may be preffered.

• keep different file types like redo ,undo,temp on different disks.

Page 34: Managing Oracle on Linux

Physical reads and Physical writes can be obtained Datafilewise by combining the V$ datafile and V$ filestat.

Devicewise no of block reads per sec and block writes per sec can be obtained from I/O STAT report.

When we observe that in a single disk there are more read/write taking place and if that disk has more than one datafile with more no of physical reads and physical writes ,

Then we can move one of the datafiles to a device with a less Read/Write activity and reduce the I/O contention and ultimately improve the Database performance.

Page 35: Managing Oracle on Linux

Thank you