ITPub博客

首页 > 数据库 > Oracle > [20190402]跟踪vmstat.txt

[20190402]跟踪vmstat.txt

原创 Oracle 作者:lfree 时间:2019-04-02 08:53:13 0 删除 编辑

[20190402]跟踪vmstat.txt


$ strace -e open vmstat 1 10

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/tls/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/tls/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/oracm/lib/tls/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/oracm/lib/tls/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/oracm/lib/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/oracm/lib/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib/tls/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib/tls/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/lib/tls/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/lib/tls/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/lib/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/lib/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/local/lib/tls/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/local/lib/tls/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/local/lib/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/usr/local/lib/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib64/tls/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib64/tls/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib64/x86_64/libproc-3.2.7.so", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib64/libproc-3.2.7.so", O_RDONLY) = 3

open("/u01/app/oracle/product/11.2.0.4/dbhome_1/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib/libc.so.6", O_RDONLY)        = 3

open("/usr/lib/libc.so.6", O_RDONLY)    = -1 ENOENT (No such file or directory)

open("/usr/local/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)

open("/lib64/libc.so.6", O_RDONLY)      = 3

open("/proc/stat", O_RDONLY)            = 3

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------

 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st

open("/proc/meminfo", O_RDONLY)         = 3

open("/proc/stat", O_RDONLY)            = 4

open("/proc/vmstat", O_RDONLY)          = 5

 0  0      0 119228960 273596 9947928    0    0     3     3    0    0  0  1 99  0  0

 0  0      0 119228944 273596 9947928    0    0     0     4 1180 2131  0  0 100  0  0

 0  0      0 119228928 273596 9947928    0    0     0     0 1129 2102  0  0 100  0  0

 0  0      0 119229056 273596 9947928    0    0     0     0 1130 2097  0  0 100  0  0

 0  0      0 119229056 273596 9947928    0    0     0     0 1148 2152  0  0 100  0  0

 0  0      0 119228912 273596 9947928    0    0     0     0 1139 2103  0  0 100  0  0

 0  0      0 119229168 273596 9947928    0    0     0     0 1122 2101  0  0 100  0  0

 0  0      0 119229176 273596 9947928    0    0     0     0 1124 2102  0  0 100  0  0

 0  0      0 119229176 273596 9947928    0    0     0     0 1182 2155  0  0 100  0  0

 0  0      0 119229296 273596 9947928    0    0     0     0 1138 2094  0  0 100  0  0


--//从open打开的文件句柄看,可以发现打开/proc/stat,/proc/meminfo,/proc/stat,/proc/vmstat来构建输出信息.

--//联想到oracle也有一个视图记录v$osstat记录os相关信息.

SYS@book> select * from v$bgprocess where NAME like 'MMNL';

PADDR              PSERIAL# NAME                 DESCRIPTION                                 ERROR

---------------- ---------- -------------------- ---------------------------------------- --------

0000000086205CC0          1 MMNL                 Manageability Monitor Process 2          0


--//收集信息主要包括mmnl进程.


$ ps -ef | grep ora_mmnl_boo[k]

oracle   56355     1  0 08:38 ?        00:00:13 ora_mmnl_book


$ strace -fTtt -e open -p 56355

Process 56355 attached - interrupt to quit

17:26:43.091236 open("/proc/mounts", O_RDONLY) = 12 <0.000065>

17:26:43.092005 open("/proc/stat", O_RDONLY) = 12 <0.000038>

17:26:43.092729 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000028>

17:26:43.094959 open("/proc/mounts", O_RDONLY) = 13 <0.000046>

17:26:43.095541 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000031>

17:26:43.097678 open("/proc/mounts", O_RDONLY) = 13 <0.000039>

17:26:43.098220 open("/proc/loadavg", O_RDONLY) = 12 <0.000030>

17:26:43.098623 open("/proc/stat", O_RDONLY) = 12 <0.000029>

17:26:43.099790 open("/proc/mounts", O_RDONLY) = 12 <0.000046>

17:26:43.100255 open("/proc/stat", O_RDONLY) = 12 <0.000035>


17:26:58.115820 open("/proc/mounts", O_RDONLY) = 12 <0.000060>

17:26:58.116411 open("/proc/stat", O_RDONLY) = 12 <0.000035>

17:26:58.117141 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000033>

17:26:58.119449 open("/proc/mounts", O_RDONLY) = 13 <0.000047>

17:26:58.120029 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000031>

17:26:58.122269 open("/proc/mounts", O_RDONLY) = 13 <0.000048>

17:26:58.122855 open("/proc/loadavg", O_RDONLY) = 12 <0.000031>

17:26:58.123257 open("/proc/stat", O_RDONLY) = 12 <0.000030>


17:27:13.138885 open("/proc/mounts", O_RDONLY) = 12 <0.000063>

17:27:13.139463 open("/proc/stat", O_RDONLY) = 12 <0.000042>

17:27:13.140179 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000030>

17:27:13.142463 open("/proc/mounts", O_RDONLY) = 13 <0.000046>

17:27:13.143043 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000031>

17:27:13.145260 open("/proc/mounts", O_RDONLY) = 13 <0.000043>

17:27:13.145852 open("/proc/loadavg", O_RDONLY) = 12 <0.000030>

17:27:13.146257 open("/proc/stat", O_RDONLY) = 12 <0.000030>


17:27:19.152746 open("/proc/56321/stat", O_RDONLY) = 12 <0.000041>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 $ ps -ef | grep 5632[1]

oracle   56321     1  0 08:38 ?        00:00:04 ora_pmon_book

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

17:27:28.161875 open("/proc/mounts", O_RDONLY) = 12 <0.000062>

17:27:28.162470 open("/proc/stat", O_RDONLY) = 12 <0.000036>

17:27:28.163213 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000032>

17:27:28.165590 open("/proc/mounts", O_RDONLY) = 13 <0.000045>

17:27:28.166170 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000031>

17:27:28.168404 open("/proc/mounts", O_RDONLY) = 13 <0.000045>

17:27:28.168971 open("/proc/loadavg", O_RDONLY) = 12 <0.000037>

17:27:28.169380 open("/proc/stat", O_RDONLY) = 12 <0.000035>

17:27:43.186295 open("/proc/mounts", O_RDONLY) = 12 <0.000074>

17:27:43.186846 open("/proc/stat", O_RDONLY) = 12 <0.000040>

17:27:43.187613 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000034>

17:27:43.189873 open("/proc/mounts", O_RDONLY) = 13 <0.000048>

17:27:43.190499 open("/proc/cpuinfo", O_RDONLY) = 12 <0.000032>

17:27:43.192716 open("/proc/mounts", O_RDONLY) = 13 <0.000040>

17:27:43.193310 open("/proc/loadavg", O_RDONLY) = 12 <0.000031>

17:27:43.193736 open("/proc/stat", O_RDONLY) = 12 <0.000030>

17:27:43.194922 open("/proc/mounts", O_RDONLY) = 12 <0.000045>

17:27:43.195453 open("/proc/stat", O_RDONLY) = 12 <0.000031>

^CProcess 56355 detached


--//实际上oracle也非常类似,ora_mmnl_book进程大约每15秒读取相关/proc目录的虚拟文件,收集相关信息.

--//实际上oracle许多监测工具都非常类似,相关/proc目录的虚拟文件,收集相关信息.

$ strace -fTr -e open dstat 2 10 1>/dev/null

...

    0.000112 open("/usr/lib64/python2.4/getopt.pyc", O_RDONLY) = 4 <0.000020>

     0.000595 open("/proc/uptime", O_RDONLY) = 3 <0.000032>

     0.000361 open("/proc/stat", O_RDONLY) = 3 <0.000029>

     0.002903 open("/proc/diskstats", O_RDONLY) = 4 <0.000029>

     0.002209 open("/proc/net/dev", O_RDONLY) = 5 <0.000048>

     0.000601 open("/proc/vmstat", O_RDONLY) = 6 <0.000028>

     2.000639 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000584 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000375 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000302 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000446 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000549 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000343 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000534 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000448 --- SIGALRM (Alarm clock) @ 0 (0) ---

     2.000365 --- SIGALRM (Alarm clock) @ 0 (0) ---


# strace -f -e open -o /tmp/x1.txt smem -tk  -U oracle -P "ora_" 1>/dev/null


--//查看/tmp/x1.txt

...

63962 open("/proc", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3

63962 open("/proc/1/cmdline", O_RDONLY) = 3

63962 open("/proc/2/cmdline", O_RDONLY) = 3

63962 open("/proc/3/cmdline", O_RDONLY) = 3

63962 open("/proc/5/cmdline", O_RDONLY) = 3

....

--//先检查命令是否包含"ora_"

...

63962 open("/etc/nsswitch.conf", O_RDONLY) = 3

63962 open("/etc/ld.so.cache", O_RDONLY) = 3

63962 open("/lib64/libnss_files.so.2", O_RDONLY) = 3

63962 open("/etc/passwd", O_RDONLY)     = 3

63962 open("/proc/63788/smaps", O_RDONLY) = 3

63962 open("/proc/63790/stat", O_RDONLY) = 3

63962 open("/proc/63790/cmdline", O_RDONLY) = 3

63962 open("/proc/63790/smaps", O_RDONLY) = 3

63962 open("/proc/63792/stat", O_RDONLY) = 3

63962 open("/proc/63792/cmdline", O_RDONLY) = 3

63962 open("/proc/63792/smaps", O_RDONLY) = 3

63962 open("/proc/63796/stat", O_RDONLY) = 3

63962 open("/proc/63796/cmdline", O_RDONLY) = 3

..


--//检查用户是否oracle,然后查看smaps获得内存使用...等等.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/267265/viewspace-2640054/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    2852
  • 访问量
    6641758