2010年4月11日星期日

ORACLE 11g RAC ons offline 處理

同事報生產環境的ons offline.但是神奇的是rac的node並沒有影響,記錄一下解決過程


[root@oracle02 trace]# which crs_start
/u01/app/11.1.0/crs/bin/crs_start
[root@oracle02 trace]# which crs_stop
/u01/app/11.1.0/crs/bin/crs_stop
這個的ora.oracle02.ons 可以從ora....e02.ons 和 host
[root@oracle02 trace]# crs_stop ora.oracle02.ons (Name 和Host)這兩個地方找到
Target set to OFFLINE for `ora.oracle02.ons`
[root@oracle02 trace]# crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....b5.inst application    ONLINE    OFFLINE
ora.crpb5.db   application    ONLINE    OFFLINE
ora....d1.inst application    ONLINE    ONLINE    oracle01
ora....d2.inst application    ONLINE    ONLINE    oracle02
ora.crprod.db  application    ONLINE    ONLINE    oracle01
ora....SM1.asm application    ONLINE    ONLINE    oracle01
ora....01.lsnr application    ONLINE    ONLINE    oracle01
ora....e01.gsd application    ONLINE    ONLINE    oracle01
ora....e01.ons application    ONLINE    ONLINE    oracle01
ora....e01.vip application    ONLINE    ONLINE    oracle01
ora....SM2.asm application    ONLINE    ONLINE    oracle02
ora....02.lsnr application    ONLINE    ONLINE    oracle02
ora....e02.gsd application    ONLINE    ONLINE    oracle02
ora....e02.ons application    OFFLINE   OFFLINE
ora....e02.vip application    ONLINE    ONLINE    oracle02
[root@oracle02 trace]# crs_start ora.oracle02.ons
Attempting to start `ora.oracle02.ons` on member `oracle02`
Start of `ora.oracle02.ons` on member `oracle02` succeeded.
[root@oracle02 trace]# crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora....b5.inst application    ONLINE    OFFLINE
ora.crpb5.db   application    ONLINE    OFFLINE
ora....d1.inst application    ONLINE    ONLINE    oracle01
ora....d2.inst application    ONLINE    ONLINE    oracle02
ora.crprod.db  application    ONLINE    ONLINE    oracle01
ora....SM1.asm application    ONLINE    ONLINE    oracle01
ora....01.lsnr application    ONLINE    ONLINE    oracle01
ora....e01.gsd application    ONLINE    ONLINE    oracle01
ora....e01.ons application    ONLINE    ONLINE    oracle01
ora....e01.vip application    ONLINE    ONLINE    oracle01
ora....SM2.asm application    ONLINE    ONLINE    oracle02
ora....02.lsnr application    ONLINE    ONLINE    oracle02
ora....e02.gsd application    ONLINE    ONLINE    oracle02
ora....e02.ons application    ONLINE    ONLINE    oracle02
ora....e02.vip application    ONLINE    ONLINE    oracle02
[root@oracle02 trace]#
之前嘗試 onsctl stop |start 沒有什麼效果,原因待查
[root@oracle02 trace]# onsctl help
usage: /u01/app/oracle/product/11.1.0/bin/onsctl start|stop|ping|reconfig|debug
start                            - Start opmn only.
stop                             - Stop ons daemon
ping                             - Test to see if ons daemon is running
debug                            - Display debug information for the ons daemon
reconfig                         - Reload the ons configuration
help                             - Print a short syntax description (this).
detailed                         - Print a verbose syntax description.
[root@oracle02 trace]#
ref:  http://blog.roodo.com/mywork/archives/11858971.html

關於ons,好像是跟jdbc連接有關係,我們application使用的是dot net.所以沒有看到影響。得空研究一下。

2010年3月29日星期一

apache(2.2.15) +php(5.2.10) 實驗

這次測試加在php動態頁面的效果

apache pre-fork mode:

1, apache compiled

./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-mpm=prefork

 

2 php compiled

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --with-mysql=/usr/local/webserver/mysql    --with-apxs2=/usr/local/apache2/bin/apxs

 

3. make 
make ZEND_EXTRA_LIBS='-liconv'

4 .make install

 

5. 編輯測試文件

[root@LB1 bin]# cd /usr/local/apache2/htdocs/

[root@LB1 htdocs]# ls

index.html

[root@LB1 htdocs]# vi index.php

[root@LB1 htdocs]# cat index.php

<?php

phpinfo();

?>

[root@LB1 htdocs]#

6, apache httpd.conf中添加:

 

設置web server環境

#載入php5的函式庫
LoadModule php5_module        modules/libphp5.so
#指定php執行的副檔名
AddType application/x-httpd-php .php .phtml .inc .php3
#原始碼副呈現的副檔名
AddType application/x-httpd-php-source .phps

<IfModule mpm_worker_module>

    StartServers          2

    MaxClients          150

    MinSpareThreads      25

    MaxSpareThreads      75

    ThreadsPerChild      25

    MaxRequestsPerChild   0

</IfModule>

7  壓力baseline收集

php 頁面部分

===prefork mode====

[root@LB1 bin]#  ./ab -n 10000 -c 10 http://172.16.1.222/index.php

This is ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:        Apache/2.2.15

Server Hostname:        172.16.1.222

Server Port:            80

Document Path:          /index.php

Document Length:        40213 bytes

Concurrency Level:      10

Time taken for tests:   5.047 seconds

Complete requests:      10000

Failed requests:        0

Write errors:           0

Total transferred:      403848771 bytes

HTML transferred:       402178437 bytes

Requests per second:    1981.49 [#/sec] (mean)

Time per request:       5.047 [ms] (mean)

Time per request:       0.505 [ms] (mean, across all concurrent requests)

Transfer rate:          78146.56 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0    0   0.6      0       8

Processing:     1    5   0.8      5      12

Waiting:        0    1   0.9      1       8

Total:          2    5   0.8      5      13

Percentage of the requests served within a certain time (ms)

  50%      5

  66%      5

  75%      5

  80%      6

  90%      6

  95%      6

  98%      7

  99%      7

100%     13 (longest request)

[root@LB1 bin]#

 

btw:再進行work方式的時候使用類似上面的辦法報錯了“

[root@LB1 bin]# ./apachectl start

[Mon Mar 29 23:57:53 2010] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.

Pre-configuration failed

”解決,參見 上一篇文章

worker 方式:

1, apache complied

./configure --prefix=/usr/local/httpd2 --enable-so --enable-rewrite --with-mpm=worker

2, php compiled

./configure --prefix=/usr/local/php2 --with-config-file-path=/usr/local/phpw --with-mysql=/usr/local/webserver/mysql    --with-apxs2=/usr/local/httpd2/bin/apxs  --enable-maintainer-zts

3. make 
make ZEND_EXTRA_LIBS='-liconv'

4 .make install

5. 編輯測試文件

[root@LB1 bin]# cd /usr/local/apache2/htdocs/

[root@LB1 htdocs]# ls

index.html

[root@LB1 htdocs]# vi index.php

[root@LB1 htdocs]# cat index.php

<?php

phpinfo();

?>

[root@LB1 htdocs]#

6, apache httpd.conf中添加:

 

設置web server環境

#載入php5的函式庫
LoadModule php5_module        modules/libphp5.so
#指定php執行的副檔名
AddType application/x-httpd-php .php .phtml .inc .php3
#原始碼副呈現的副檔名
AddType application/x-httpd-php-source .phps

<IfModule mpm_worker_module>

    StartServers          2

    MaxClients          150

    MinSpareThreads      25

    MaxSpareThreads      75

    ThreadsPerChild      25

    MaxRequestsPerChild   0

</IfModule>

啟動apache

7 收集壓力基準:

[root@LB1 htdocs]# cd ../bin

[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.php

This is ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)

Completed 1000 requests

Completed 2000 requests

Completed 3000 requests

Completed 4000 requests

Completed 5000 requests

Completed 6000 requests

Completed 7000 requests

Completed 8000 requests

Completed 9000 requests

Completed 10000 requests

Finished 10000 requests

Server Software:        Apache/2.2.15

Server Hostname:        172.16.1.222

Server Port:            80

Document Path:          /index.php

Document Length:        40284 bytes

Concurrency Level:      10

Time taken for tests:   4.213 seconds

Complete requests:      10000

Failed requests:        3

   (Connect: 0, Receive: 0, Length: 3, Exceptions: 0)

Write errors:           0

Total transferred:      404509865 bytes

HTML transferred:       402839865 bytes

Requests per second:    2373.57 [#/sec] (mean)

Time per request:       4.213 [ms] (mean)

Time per request:       0.421 [ms] (mean, across all concurrent requests)

Transfer rate:          93762.80 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0    0   0.2      0       4

Processing:     1    4   1.8      4      45

Waiting:        0    3   1.5      3      30

Total:          1    4   1.8      4      46

Percentage of the requests served within a certain time (ms)

  50%      4

  66%      4

  75%      5

  80%      5

  90%      6

  95%      7

  98%      8

  99%      9

100%     46 (longest request)

[root@LB1 bin]#

對比發現 ,從動態頁面來看,worker方式的優勢就顯現出來了,處理能力明顯被pre-fork方式強。

記錄一下,備忘

Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. Pre-configuration failed 的處理

在pre-fork mode下apache+php5運行沒有問題, 但是在worker mode, apache啟動的時候,報錯了

如何處理呢, 發現別人已經遇到這個問題

./configure --prefix=/usr/local/php2 --with-config-file-path=/usr/local/php2 --with-mysql=/usr/local/webserver/mysql    --with-apxs2=/usr/local/httpd2/bin/apxs  --enable-maintainer-zts --with-experimental-zts

紅色字體上後加入的

重新configure; make ; make install ok

Btw, php5.2.10 直接make 報錯

make使用

make ZEND_EXTRA_LIBS='-liconv'

猜想應該是php5.2.10內部的libconv可能不好用吧。

make install後, 運行apache ok.

記錄一下!

如何加快make的速度

如果您有編譯的經歷,對opensource的長時間make 一定有體會,比如php, 比如mysql的源代碼安裝

看到別人的一個安裝文檔用到了make –j 10,

man make 查了一下, 發現

[root@LB1 httpd-2.2.15]# make -j 10

-j [jobs], --jobs[=jobs]

            Specifies the number of jobs (commands) to run simultaneously.  If there  is  more than one -j option, the last one is effective.  If the -j option is given without an argument, make  will  not  limit the number of jobs that can run simultaneously.

就是啟動多個job 來運行make , 記錄一下,提高效率

類似:error while loading shared libraries: libiconv.so.2 問題的處理

安裝apache2.2以後,發現啟動不了

報類似的錯誤:

 

error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

查找發現這個文件在/usr/local/lib下面

查看/etc/ld.so.conf 發現裏面沒有內容

將/usr/local/lib 添加在這個文件中

運行ldconfig

再次運行ok, 記錄一下備忘!

2010年3月28日星期日

apache web server 實驗

項目需要, 做了一個 apache baseline的實驗, 發現再PC上, 我的測試機器是dell optiplex 755 , apache mpm worker mode 並沒有 pre-fork mode 的效率高,可能是multi-core的優勢沒有顯示出來吧,留一個記錄備查!

[root@LB1 bin]# uname -at
Linux LB1.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 04:15:13 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@LB1 bin]#

[root@LB1 bin]# free
total used free shared buffers cached
Mem: 2015392 1099068 916324 0 131880 582036
-/+ buffers/cache: 385152 1630240
Swap: 4063224 0 4063224
[root@LB1 bin]#



[root@LB1 proc]# cat cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
stepping : 6
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
bogomips : 5319.97
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
stepping : 6
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
bogomips : 5319.98
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:





[root@LB1 httpd-2.2.15]# ./configure --with-mpm=prefork --prefix=/usr/local/apache_prefork --with-included-apr --with-expat=builtin

[root@LB1 httpd-2.2.15]# make -j 10

-j [jobs], --jobs[=jobs]
Specifies the number of jobs (commands) to run simultaneously. If
there is more than one -j option, the last one is effective. If
the -j option is given without an argument, make will not limit
the number of jobs that can run simultaneously.


[root@LB1 httpd-2.2.15]# make install




第二组


[root@LB1 httpd-2.2.15]# ./configure --with-mpm=worker --prefix=/usr/local/apache_worker --with-included-apr --with-expat=builtin


[root@LB1 httpd-2.2.15]# make -j 10


[root@LB1 httpd-2.2.15]# make install




分别配置参数


StartServers 5
MinSpareServers 5
MaxSpareServers 75
MaxClients 150
MaxRequestsPerChild 0






StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0

[root@LB1 conf]#



测试第一组: prefork mode

[root@LB1 bin]# ./apachectl start
[root@LB1 bin]# netstat -tln |grep 80
tcp 0 0 :::80 :::* LISTEN
[root@LB1 bin]#



[root@LB1 bin]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16039
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16039
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@LB1 bin]# ulimit -n 102400
[root@LB1 bin]#




[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: Apache/2.2.15
Server Hostname: 172.16.1.222
Server Port: 80

Document Path: /index.html
Document Length: 44 bytes

Concurrency Level: 10
Time taken for tests: 0.737 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2950000 bytes
HTML transferred: 440000 bytes
Requests per second: 13565.19 [#/sec] (mean)
Time per request: 0.737 [ms] (mean)
Time per request: 0.074 [ms] (mean, across all concurrent requests)
Transfer rate: 3907.94 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.1 1 8
Waiting: 0 0 0.1 0 1
Total: 0 1 0.2 1 8

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 8 (longest request)
[root@LB1 bin]#





第二组 worker

[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: Apache/2.2.15
Server Hostname: 172.16.1.222
Server Port: 80

Document Path: /index.html
Document Length: 44 bytes

Concurrency Level: 10
Time taken for tests: 0.790 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2950295 bytes
HTML transferred: 440044 bytes
Requests per second: 12660.63 [#/sec] (mean)
Time per request: 0.790 [ms] (mean)
Time per request: 0.079 [ms] (mean, across all concurrent requests)
Transfer rate: 3647.71 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.5 1 16
Waiting: 0 0 0.4 0 15
Total: 0 1 0.5 1 16

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 16 (longest request)
[root@LB1 bin]#

2010年3月19日星期五

如何查找redo file?

備忘一下

SQL> select group#, members, status from v$log;

    GROUP#    MEMBERS STATUS
---------- ---------- ----------------
         1          2 INACTIVE
         2          2 CURRENT
         3          2 INACTIVE
         4          2 CURRENT

 

SQL> desc v$logfile
Name                                      Null?    Type
----------------------------------------- -------- ----------------------------
GROUP#                                             NUMBER
STATUS                                             VARCHAR2(7)
TYPE                                               VARCHAR2(7)
MEMBER                                             VARCHAR2(513)
IS_RECOVERY_DEST_FILE                              VARCHAR2(3)

SQL> col member for a30
SQL> select * from v$logfile;

 

SQL> set linesize 300
SQL> /

    GROUP# STATUS  TYPE    MEMBER                         IS_
---------- ------- ------- ------------------------------ ---
         1         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_1.257.686193451

         1         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES
                           linelog/group_1.257.686193459

         2         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_2.258.686193481

         2         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES
                           linelog/group_2.258.686193491

    GROUP# STATUS  TYPE    MEMBER                         IS_
---------- ------- ------- ------------------------------ ---

         3         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_3.265.686198773

         3         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES
                           linelog/group_3.259.686198787

         4         ONLINE  +CRPROD_DATA/crprod/onlinelog/ NO
                           group_4.266.686198801

         4         ONLINE  +FLASH_RECOVERY_AREA/crprod/on YES

    GROUP# STATUS  TYPE    MEMBER                         IS_
---------- ------- ------- ------------------------------ ---
                           linelog/group_4.260.686198809

8 rows selected.