日期:2014-05-16 浏览次数:20433 次
今天参加ACOUG活动,eygle大师分享了一个案例,其中讲到进程的strace时,问我某个字符是神马意思?
当时一时想不起了,他简单的进行了一下描述,猛然大悟,但是还不是特别清楚其中的细节,很多东西
确实是不用就会忘记的,晚上回来,准备研究eygle在活动上所提的lgwr 在写redo 时需要获得哪些latch?
具体这些latch的持有和释放的顺序是怎么样的? 做了一会儿实验,没有搞明白,突然trace lgwr进程,发现
了另外一点内容,彻底颠覆了我以前的认知。
SQL> !ps -ef|grep lgwr ora10g 23584 1 0 08:36 ? 00:00:00 ora_lgwr_roger ora10g 23637 23572 0 08:37 pts/1 00:00:00 /bin/bash -c ps -ef|grep lgwr 使用strace -ftr -o a.log -p 23584 跟踪lgwr进程,然后另外开启一个窗口进行如下操作: 1000 rows deleted. SQL> commit; Commit complete. SQL> alter system switch logfile; System altered. SQL> !ps -ef|grep lgwr|grep -v grep ora10g 23584 1 0 08:36 ? 00:00:00 ora_lgwr_roger 然后我们再回头去看看strace 打出来的trace是什么样的。 23584 0.000056 gettimeofday({1345909238, 375806}, NULL) = 0 23584 0.000053 times(NULL) = 432511470 23584 0.000071 gettimeofday({1345909238, 375933}, NULL) = 0 23584 0.000060 gettimeofday({1345909238, 375990}, NULL) = 0 23584 0.000059 semtimedop(622592, 0x1, 0, {4294901770, 0}) = -1 EAGAIN (Resource temporarily unavailable) 23584 3.001243 gettimeofday({1345909241, 377292}, NULL) = 0 .....省略部分信息 23584 0.000166 times(NULL) = 432511770 23584 0.000032 gettimeofday({1345909241, 377821}, NULL) = 0 23584 0.000043 times(NULL) = 432511770 23584 0.000031 pwrite64(20, "\1\"\0\0\16\0\0\0\226\0\0\0\20\200\303\265h\0\0\0\4\0\0"..., 921088, 7168) = 921088 23584 0.008318 times(NULL) = 432511771 23584 0.000040 gettimeofday({1345909241, 386276}, NULL) = 0 23584 0.000072 times(NULL) = 432511771 23584 0.000040 gettimeofday({1345909241, 386367}, NULL) = 0 23584 0.000036 getrusage(RUSAGE_SELF, {ru_utime={0, 13997}, ru_stime={0, 66989}, ...}) = 0 23584 0.000048 getrusage(RUSAGE_SELF, {ru_utime={0, 13997}, ru_stime={0, 66989}, ...}) = 0 23584 0.000046 gettimeofday({1345909241, 386496}, NULL) = 0 .....省略部分信息 23584 0.000126 gettimeofday({1345909242, 708436}, NULL) = 0 23584 0.000071 times(NULL) = 432511903 23584 0.000074 times(NULL) = 432511903 23584 0.000054 gettimeofday({1345909242, 708690}, NULL) = 0 23584 0.000134 times(NULL) = 432511903 23584 0.000110 pwrite64(20, "\1\"\0\0\25\7\0\0\226\0\0\0\20\200j\351\214\0\0\0\5\235"..., 512, 928256) = 512 23584 0.000944 times(NULL) = 432511904 23584 0.000062 gettimeofday({1345909242, 709896}, NULL) = 0 23584 0.000089 times(NULL) = 432511904 23584 0.000121 gettimeofday({1345909242, 710096}, NULL) = 0 23584 0.000171 semctl(622592, 23, IPC_64|SETVAL, 0xbfffd4fc) = 0 23584 0.001596 gettimeofday({1345909242, 711864}, NULL) = 0 23584 0.000064 gettimeofday({1345909242, 711935}, NULL) = 0 23584 0.000068 gettimeofday({1345909242, 711992}, NULL) = 0 23584 0.000060 times(NULL) = 432511904 23584 0.000068 gettimeofday({1345909242, 712122}, NULL) = 0 23584 0.000120 gettimeofday({1345909242, 712247}, NULL) = 0 23584 0.000072 semtimedop(622592, 0x1, 670000, {4294901770, 0}) = -1 EAGAIN (Resource temporarily unavailable) 23584 1.671260 gettimeofday({1345909244, 383580}, NULL) = 0 23584 0.000072 gettimeofday({1345909244, 383647}, NULL) = 0 ......省略部分信息 23584 0.000462 gettimeofday({1345909247, 141720}, NULL) = 0 23584 0.000106 pread64(15, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\225\377\0\0\0\0\0\0"..., 16384, 16384) = 16384 23584 0.000135 gettimeofday({1345909247, 142041}, NULL) = 0 23584 0.000193 gettimeofday({1345909247, 142133}, NULL) = 0 23584 0.000139 pread64(16, "\25\302\0\0\1\0\0\0\0\0\0\0\0\0\1\4\225\377\0\0\0\0\0\0"..., 16384, 16384) = 16384 23584 0.000105 gettimeofday({1345909247, 142405}, NULL) = 0 23584 0.000122 gettimeof