*
2009621
IXPUB Linuxoracle Unix/LinuxITPUB.netIXPUB.netChinaUnix.netoracleUnix/LinuxoracleoracleUnix/LinuxMSNgaojf_888@hotmail.comQQ:397824870Email:dba.gao@gmail.com*
Linux
OracleLinux
CPUI/OI/O* Linux
**%userCPU%sysCPU%iowaitCPUswap insiSWAP DISKRAMswap outsoRAMSWAP DISK
CPUuser% + sys%< 70%user% + sys%= 85%user% + sys% >=90% Swap Insi0Swap Outso0Per CPU with 10 page/sMore Swap In & Swap Outiowait % < 20%iowait % =35%iowait % >= 50%
Vmstatsariostatnetstatfreepstop vmstatsariostatCPU
freevmstat
iostatI/O
netstat
* Linux1uptime[root@web1 ~]# uptime16:38:00 up 118 days, 3:01, 5 users, load average: 1.22, 1.02, 0.91
load averageCPU8CPU,load average8CPU8load averageCPUCPUCPU
1vmstatCPU CPU vmstat [root@node1 ~]# vmstat 2 3procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 162240 8304 67032 0 0 13 21 1007 23 0 1 98 0 0 0 0 0 162240 8304 67032 0 0 1 0 1010 20 0 1 100 0 0 0 0 0 162240 8304 67032 0 0 1 1 1009 18 0 1 99 0 0ProcsrcpuCPUCPUCPUbI/OCpuusCPU uscpu50%syCPUSyCPU us+sy80%us+sy 80%CPU
2 sarCPU sarsar sarCPU
[root@webserver ~]# sar -u 3 5Linux 2.6.9-42.ELsmp (webserver) 11/28/2008 _i686_ (8 CPU)11:41:24 AM CPU %user %nice %system %iowait %steal %idle11:41:27 AM all 0.88 0.00 0.29 0.00 0.00 98.8311:41:30 AM all 0.13 0.00 0.17 0.21 0.00 99.5011:41:33 AM all 0.04 0.00 0.04 0.00 0.00 99.9211:41:36 AM all 90.08 0.00 0.13 0.16 0.00 9.6311:41:39 AM all 0.38 0.00 0.17 0.04 0.00 99.41Average: all 0.34 0.00 0.16 0.05 0.00 99.45%userCPU %niceCPU %systemCPU%iowaitIOCPU%stealpageinsteal%idleCPU
CPU
CPUCPUCPUCPU100%CPUCPU
1free
freelinux
[root@webserver ~]# free -m total used free shared buffers cachedMem: 8111 7185 926 0 243 6299-/+ buffers/cache: 643 7468Swap: 8189 0 8189
/>70%/
2 vmstat [root@node1 ~]# vmstat 2 3procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 162240 8304 67032 0 0 13 21 1007 23 0 1 98 0 0 0 0 0 162240 8304 67032 0 0 1 0 1010 20 0 1 100 0 0 0 0 0 162240 8304 67032 0 0 1 1 1009 18 0 1 99 0 0
memoryswpdkswpd0siso0freekbuffbuffers cache cachepage cachedcachedcachedcachecachedIObiswapsiso siso0siso0
1
RAIDRAID I/O I-node cacheI/O
*2iostat
[root@webserver ~]# iostat -d 2 3Linux 2.6.9-42.ELsmp (webserver) 12/01/2008 _i686_ (8 CPU)Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 1.87 2.58 114.12 6479462 286537372Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 0.00 0.00 0.00 0 0Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 1.00 0.00 12.00 0 24
Blk_read/sBlk_wrtn/sBlk_readBlk_wrtn Blk_read/sBlk_wrtn/sBlk_wrtn/sBlk_read/s
*3sar
sar dIO
[root@webserver ~]# sar -d 2 3Linux 2.6.9-42.ELsmp (webserver) 11/30/2008 _i686_ (8 CPU)11:09:33 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util11:09:35 PM dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0011:09:35 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util11:09:37 PM dev8-0 1.00 0.00 12.00 12.00 0.00 0.00 0.00 0.0011:09:37 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util11:09:39 PM dev8-0 1.99 0.00 47.76 24.00 0.00 0.50 0.25 0.05Average: DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %utilAverage: dev8-0 1.00 0.00 19.97 20.00 0.00 0.33 0.17 0.02
awaitI/OsvctmI/O%utilI/O
*3sar
IO
svctmawaitsvctmCPUsvctmsvctmawaitsvctmI/OI/OsvctmawaitI/OawaitsvctmI/O%utilI/O%util100%I/OI/O
1ping
2netstat i
3netstat r
4sar n
OracleoracleSGAPGA
Oracleext2/ext3xfsocfs2Oracle ASM
1
/etc/sysctl.conf
kernel.shmmax = 2147483648kernel.shmmni = 4096kernel.shmall = 2097152kernel.sem = 250 32000 100 128fs.file-max = 65536net.ipv4.ip_local_port_range = 1024 65000
Kernel.shmmax:Kernel.shmmniKernel.shmallfs.file-maxLinuxnet.ipv4.ip_local_port_rangeIPv4
Kernel.shmmaxOracle SGA SHMMAXSGA SHMMAXORA-27123:unable to attach to shared memory segmentOracle SGASGAOracleKernel.shmmaxsgaoracleSGA
Kernel.shmall 32Linux8Gkernel.shmall = 2097152 2097152*4k/1024/1024 = 8G 8G4K324096
Kernel.shmmni 4096SUN OSKernel.shmmin
Oracle
Oracle 9iPGA_AGGREGATE_TARGETPGAOracle 10gSGA_TARGETSGAOracle 11gSGAPGA
MEMORY_TARGETORACLEPGASGASGAPGAMEMORY_MAX_TARGETMEMORY_TARGETMEMORY_MAX_TARGETMEMORY_TARGETSGA_TARGETPGA_AGGREGATE_TARGETOracle0
,AMM (Automatic Memory Management
ASMMAutomatic Shared Memory Management
PGA
PGA
oracle11gAMM
SQL> show parameters target NAME TYPE VALUE ------------ --------------------- ------------------ ---------------------- archive_lag_target integer 0 db_flashback_retention_target integer 1860 fast_start_io_target integer 0 fast_start_mttr_target integer 0 memory_max_target big integer 1400M memory_target big integer 1400M pga_aggregate_target big integer 0 sga_target big integer 0
LOCK_SGA true AMM
oracle10gMEMORY_TARGET=0SGA_TARGET
SQL> alter system set memory_target=0 scope=both; System altered. SQL> alter system set sga_target=1024m scope=both; System altered. SQL>
Oracle9iSGA_TARGET MEMORY_TARGET0
SGA
share_pool_size300-500MLog_buffer1-3MLarge_pool_sizeMTS20-30MJava_pool_sizejavajava10-20Mdb_cache_size
Oracle9iPGAAMMPGAAMMPGAWORKAREA_SIZE_POLICY AUTOPGA_AGGREGATE_TARGETPGAPGAWORKAREA_SIZE_POLICY = manual PGAPGASORT_AREA_SIZESORT_AREA_RETAINED_SIZE
ext2ext3xfsgfsocfs2
ASMAutomatic Storage Management
ASMOracle
*
ITITIT*ITITIT*