当前位置:数据库 > Oracle >>

Oracle数据库巡检

Oracle数据库巡检
 
检测CPU情况,1,5,15分钟的负载
[root@rhel5 ~]# uptime
 16:38:35 up 4 min,  1 user,  load average: 0.30, 0.76, 0.38
  www.zzzyk.com  
检测内状况
[root@rhel5 ~]# free -m
             total       used       free     shared    buffers     cached
Mem:          2026        368       1657          0         53        262
-/+ buffers/cache:         52       1973
Swap:         2031          0       2031
 
检测硬盘状况
[root@rhel5 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3              47G  8.1G   36G  19% /
/dev/sda1              99M   12M   83M  12% /boot
tmpfs                1014M     0 1014M   0% /dev/shm
 
通过vmstat命令检测系统
[root@rhel5 ~]# vmstat 5 5
procs -----------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 1697688  55196 268560    0    0   195    12 1021   63  1  4 94  1  0
 0  0      0 1697688  55196 268560    0    0     0     0 1003   44  0  1 99  0  0
 0  0      0 1697688  55196 268560    0    0     0     6 1008   48  0  1 99  0  0
 0  0      0 1697688  55196 268560    0    0     0     0 1003   43  0  1 99  0  0
 1  0      0 1697688  55196 268560    0    0     0     0 1009   48  0  1 99  0  0
Procs
       r: The number of processes waiting for run time. 
       --展示了正在执行和等待CPU资源的任务个数。当这个值超过了CPU数目,就会出现CPU瓶颈了
       b: The number of processes in uninterruptible sleep.
 
   Memory
       swpd: the amount of virtual memory used.
       free: the amount of idle memory.
       buff: the amount of memory used as buffers.  -- 一般对块设备的读写才需要缓冲。
       cache: the amount of memory used as cache.  -- 一般作为文件系统的cache。
       inact: the amount of inactive memory. (-a option)
       active: the amount of active memory. (-a option)
 
 
   Swap
       si: Amount of memory swapped in from disk (/s).
       so: Amount of memory swapped to disk (/s).
 
 
   IO
       bi: Blocks received from a block device (blocks/s).
       bo: Blocks sent to a block device (blocks/s).
 
 
   System
       in: The number of interrupts per second, including the clock. -- 每秒的中断数,包括时钟中断
       cs: The number of context switches per second. -- 每秒的环境(上下文)转换次数。
       -- 上面这2个值越大,会看到由内核消耗的CPU时间会越多
   CPU
       These are percentages of total CPU time.
       us: Time spent running non-kernel code. (user time, including nice time)
       sy: Time spent running kernel code. (system time)
       id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
       wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
       -- wa 的值高时,说明IO等待比较严重,这可能是由于磁盘大量作随机访问造成,也有可能是磁盘的带宽出现瓶颈(块操作)。
       st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown
 
通过iostat命令检测系统
[oracle@rhel5 trace]$ iostat
Linux 2.6.18-194.el5 (rhel5)    03/13/2013
 
 
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           2.62    0.05   11.10    6.35    0.00   79.88
 
 
Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              19.14      1729.82        92.71     604433      32394
sda1              0.23         5.95         0.03       2080         10
sda2              0.10         4.21         0.00       1471          0
sda3             18.75      1718.46        92.68     600466      32384
tps
    Indicate the number of transfers per second that were issued to the  device.  A
    transfer is an I/O request to the device. Multiple logical requests can be com-
    bined into a single I/O request to the device. A transfer is  of  indeterminate
    size.
 
检测Oracle死锁
[oracle@rhel5 trace]$ cat alert_orcl.log | grep ORA-00600
ORA-00600: internal error code, arguments: [ksl_invalid_latch], [kslges], [0x1437EDC], [], [], [], [], [], [], [], [], []
ORA-00600: internal error code, arguments: [ksl_invalid_latch], [kslges], [0x1437EDC], [], [], [], [], [], [], [], [], []
 
Oracle实例状态
SYS@ orcl> select instance_name, version, status, database_status from v$instance;
INSTANCE_NAME    VERSION           STATUS       DATABASE_STATUS
---------------- ----------------- ------------ -----------------
orcl             11.2.0.1.0        OPEN         ACTIVE
 
Oracle数据库状态
SYS@ orcl> select name, log_mode, open_mode, flashback_on from v$database;
NAME   &nbs
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,