2010年9月2日星期四

調整redo log file 的一個script

在8i(8.1.7.4)上用到增加一個redo log file group 成員的例子

 

db03-oracle $cat alterredo.sql
alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 1;
alter database add logfile group 1 ('/u01/oradata/databasesid/redo1.log','/u04/oradata/databasesid/redo1.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 2;
alter database add logfile group 2 ('/u01/oradata/databasesid/redo2.log','/u04/oradata/databasesid/redo2.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 3;
alter database add logfile group 3 ('/u01/oradata/databasesid/redo3.log','/u04/oradata/databasesid/redo3.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 4;
alter database add logfile group 4 ('/u01/oradata/databasesid/redo4.log','/u04/oradata/databasesid/redo4.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 5;
alter database add logfile group 5 ('/u01/oradata/databasesid/redo5.log','/u04/oradata/databasesid/redo5.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 6;
alter database add logfile group 6 ('/u01/oradata/databasesid/redo6.log','/u04/oradata/databasesid/redo6.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 7;
alter database add logfile group 7 ('/u01/oradata/databasesid/redo7.log','/u04/oradata/databasesid/redo7.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 8;
alter database add logfile group 8 ('/u01/oradata/databasesid/redo8.log','/u04/oradata/databasesid/redo8.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 9;
alter database add logfile group 9 ('/u01/oradata/databasesid/redo9.log','/u04/oradata/databasesid/redo9.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 10;
alter database add logfile group 10 ('/u01/oradata/databasesid/redo10.log','/u04/oradata/databasesid/redo10.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 11;
alter database add logfile group 11 ('/u01/oradata/databasesid/redo11.log','/u04/oradata/databasesid/redo11.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 12;
alter database add logfile group 12 ('/u01/oradata/databasesid/redo12.log','/u04/oradata/databasesid/redo12.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 13;
alter database add logfile group 13 ('/u01/oradata/databasesid/redo13.log','/u04/oradata/databasesid/redo13.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 14;
alter database add logfile group 14 ('/u01/oradata/databasesid/redo14.log','/u04/oradata/databasesid/redo14.log') size 6291456 reuse;

alter system switch logfile;
alter system checkpoint;
alter database drop logfile group 15;
alter database add logfile group 15 ('/u01/oradata/databasesid/redo15.log','/u04/oradata/databasesid/redo15.log') size 6291456 reuse;

alter system switch logfile;
db03-oracle $

記錄一下。

2010年8月30日星期一

遭遇 ORA-03232: unable to allocate an extent of 40 blocks from tablespace 5

對Oracle database 進行 exp imp操作的時候,跑到最後發現報錯了

MP-00017: following statement failed with ORACLE error 604:
"ALTER TABLE "abc_USER_AUTOPAY_PLAN" ENABLE CONSTRAINT "FK_AUTOP_PLAN_abc""
IMP-00003: ORACLE error 604 encountered
ORA-00604: error occurred at recursive SQL level 1
ORA-03232: unable to allocate an extent of 40 blocks from tablespace 5

解決步驟:

1 tablespace 5是什麼

SQL> select * from v$tablespace;
       TS# NAME
---------- ------------------------------
         0 SYSTEM
         1 TOOLS
         2 OEM_REPOSITORY
         3 RBS
         4 TEMP
        5 APP_TEMP
         6 USERS
         7 ABC_DATA
         8 INDX
         9 ABC_INDX
        10 DRSYS
11 rows selected.

增大 tablespace size 無效

alter database datafile '/u04/oradata/crprod/apptemp01.dbf' resize 2000m;

google一下發現可能是 dba_tablespace的 next_extent的問題

SQL> select next_extent from dba_tablespaces where tablespace_name = 'APP_TEMP';
NEXT_EXTENT
-----------
      65536

 

SQL> alter tablespace app_temp default storage (next 1m);
Tablespace altered.
SQL> select next_extent from dba_tablespaces where tablespace_name = 'APP_TEMP';
NEXT_EXTENT
-----------
    1048576

手工運行-成功:

SQL> ALTER TABLE ABC_USER_AUTOPAY_PLAN ENABLE CONSTRAINT FK_AUTOP_PLAN_UPROF_ABC;
Table altered.

記錄一下備忘!

2010年8月6日星期五

转 应该告诉儿童什么

发现twitter上不错的几句话记录一下:

告诉儿童:

1.平安成长比成功更重要.
2.背心短裤覆盖的地方,不许别人摸.
3.生命第一,财产第二.
4.小秘密要告诉妈妈.
5.不喝陌生人的饮料,不吃陌生人的糖果.
6.不与陌生人讲话.
7.遇到危险可以打破玻璃,破坏家具.
8.遇见危险可以自己先跑.
9.不保守坏人的秘密.
10.坏人可以骗.

2010年5月12日星期三

realVNC Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list! 處理

 

參考:http://cha.homeip.net/blog/2005/08/137.html

vnc-4_1_3-x86_linux.tar.gz

 

安裝realvnc for linux 後發現啟動不了

查看~/.vnc/xxx.log發現

Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'

Xvnc Free Edition 4.1.3 - built Oct 15 2008 12:55:42
Copyright (C) 2002-2008 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40201000, The XFree86 Project, Inc

Wed May 12 22:18:05 2010
vncext:      VNC extension running!
vncext:      Listening for VNC connections on port 5901
vncext:      Listening for HTTP connections on port 5801
vncext:      created VNC server for screen 0
error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!

Fatal server error:
could not open default font 'fixed'
xsetroot:  unable to open display 'pennyho.test.com:1'
Warning: This program is an suid-root program or is being run by the root user.
The full text of the error or warning message cannot be safely formatted
in this environment. You may get a more descriptive message by running the
program as a non-root user or by removing the suid bit on the executable.
xterm Xt error: Can't open display: %s

(gnome-session:22056): Gtk-WARNING **: cannot open display:
vncconfig: unable to open display "pennyho.crp.com:1"

發現/usr/X11R6/lib/X11/ 沒有內容

google了一下發現http://www.linuxquestions.org/questions/linux-desktop-74/vnc-problems-could-not-open-default-font-fixed-481175/

 

cp –rf /usr/share/X11 /usr/X11R6/lib/X11

再次啟動,vncserver 查看一下端口

# netstat -untlp |grep Xvnc
tcp        0      0 0.0.0.0:5801                0.0.0.0:*                   LISTEN      3463/Xvnc
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      3463/Xvnc
tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      3463/Xvnc

出來了

remote 瀏覽器訪問5801端口 ok!

記錄一下備忘

記錄一下我的過程:

tar xvfz vnc-4_1_3-x86_linux.tar.gz
cd vnc-4_1_3-x86_linux

  ./vncinstall /usr/local/bin

mkdir -p /usr/X11R6/lib/modules/extensions/

  cd vnc-4_1_3-x86_linux

cp vnc.so /usr/X11R6/lib/modules/extensions/
mkdir -p /usr/local/vnc/classes
  cp java/* /usr/local/vnc/classes
cp -rf /usr/share/X11 /usr/X11R6/lib/X11

# which vncserver
/usr/local/bin/vncserver

 

# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:771                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:904                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:25300               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

]# vncserver

You will require a password to access your desktops.

Password:
Verify:

New 'CRRACTEST.localdomain:1 (root)' desktop is CRRACTEST.localdomain:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/CRRACTEST.localdomain:1.log

# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0 0.0.0.0:771                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:904                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:5801                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN
tcp        0      0 0.0.0.0:25300               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN
tcp        0      0 :::22                       :::*                        LISTEN

從remote IE or firefox :

:5801">http://vncserver<ip>:5801

就可以訪問到了

當然如果希望gnome or kde env,修改 ~/.vnc/xstartup文件

GNOME:

xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session &

KDE:

xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &

補充完畢

2010年5月4日星期二

vmware安裝在Centos5.3上的報錯vmware gcc: error trying to exec 'cc1': execvp: No such file or directory

 

運行

vmware-config.pl ,報錯

vmware gcc: error trying to exec 'cc1': execvp: No such file or directory

糾結了半天原來認為是kernel 的問題,後來發現

gcc-c++ 沒有安裝

yum install gcc-c++

再次運行 過去了

記錄一下備忘

2010年5月3日星期一

keepalived failover實驗

實驗keepalived 對2個lvs server進行failover的切換

要求:

1.可以切換過去

2.發送mail

安裝keepalived-1.1.19.tar.gz 目前最新的

./configure

make

make install 三部曲

#cp /usr/local/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/

#cp /usr/local/etc/sysconfig/keepalived /etc/sysconfig/

#mkdir /etc/keepalived

#cp /usr/local/etc/keepalived/keepalived.conf /etc/keepalived/

#cp /usr/local/sbin/keepalived /usr/sbin/

然後便捷.conf文件

! Configuration File for keepalived
global_defs {
   notification_email {
                yourname@yourdomain //要收到mail的address
   }
   notification_email_from lvs-machine@lvsdomain  發送
   smtp_server 127.0.0.1 
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}
# VIP1
vrrp_instance VI_1 {
    state MASTER            

    smtp_alert    #這個是關鍵,如果沒有這個不會發mail!
    interface eth0
    virtual_router_id 51
    priority 150        advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        172.16.1.240
    }
}

virtual_server 172.16.1.240 80 {
    delay_loop 6
    lb_algo wrr
    lb_kind DR
    persistence_timeout 60
    protocol TCP

    real_server 172.16.1.233 80 {
        weight 3
        TCP_CHECK {
        connect_timeout 10
        nb_get_retry 3
        delay_before_retry 3
        connect_port 80
        }
     }
}
[root@lvserver keepalived]#

backup

! Configuration File for keepalived
global_defs {
   notification_email {
                yourname@yourdomain
   }
   notification_email_from  lvs-backup@lvs-domain
   smtp_server 127.0.0.1   #default 啟動sendmail 25端口
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

# VIP1
vrrp_instance VI_1 {
    state BACKUP             #.......MASTER..BACKUP
        smtp_alert
    interface eth0
    virtual_router_id 51
    priority 99    # ......100..99
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        172.16.1.240
    }
}

virtual_server 172.16.1.240 80 {
    delay_loop 6
    lb_algo wrr
    lb_kind DR
    persistence_timeout 60
    protocol TCP

    real_server 172.16.1.233 80 {
        weight 3
        TCP_CHECK {
        connect_timeout 10
        nb_get_retry 3
        delay_before_retry 3
        connect_port 80
        }
     }
}

在default情況下,master 掉了會切換到slave(backup) lvs server, 但是當master 回來的時候會取代slave,還是master.

這個要跟實際應用策略有關係。

要注意就是:

smtp_alert的設置,否則不會收到mail

測試發現他發出來的mail不是太明顯,沒有辦法編輯格式,後來想了一下,可以使用其他的手段做一個mail script.發送。

網上很多資料。不再列舉了

記錄一下,備忘!

 

參考:

http://www.linuxtone.org/thread-1077-1-1.html

2010年5月2日星期日

sendmail “cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory” 問題處理

在生成sendmail configure file的時候報錯了

m4 sendmail.mc >sendmail.cf

cannot open `/usr/share/sendmail-cf/m4/cf.m4': No such file or directory

網上查一下少

sendmail-cf


這個包



因為我這裡使用的是OEL 5.4 從iso上面找到



[root@lvserver Server]# rpm -Uvh sendmail-cf-8.13.8-2.el5.x86_64.rpm

warning: sendmail-cf-8.13.8-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159


Preparing...                ########################################### [100%]


   1:sendmail-cf            ########################################### [100%]


[root@lvserver Server]#



 



再次運行m4 sendmail.mc >sendmail.cf     ok



[root@lvserver ~]# netstat -tln

Active Internet connections (only servers)


Proto Recv-Q Send-Q Local Address               Foreign Address             State


tcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN


tcp        0      0 0.0.0.0:904                 0.0.0.0:*                   LISTEN


tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN


tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN


tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN   <-here


tcp        0      0 0.0.0.0:860                 0.0.0.0:*                   LISTEN


tcp        0      0 :::22                       :::*                        LISTEN



 



發一個mail測試一下:



[root@lvserver ~]# mail -s "lvs222 test"    youname@example.com.hk </dev/null


Null message body; hope that's ok


[root@lvserver ~]#



收到,測試成功記錄一下,



sendmail的配置文件的地址:



[root@lvserver mail]# pwd

/etc/mail



啟動關閉


[root@lvserver init.d]# pwd


/etc/init.d

[root@lvserver init.d]# ./sendmail

Usage: ./sendmail {start|stop|restart|condrestart|status}




記錄一下備忘!

2010年4月20日星期二

apache 中如何添加mod_info.c這個文件

最近做實驗,發現在1.3.x , 2.2.x version中mod_status是defult安裝的,但是mod_info不是default安裝的。

如何安裝呢?

------------------apache 1.3.x----
[root@web232 standard]# /usr/local/apache/bin/apxs -cia mod_info.c
apxs:Error: Sorry, no DSO support for Apache available
apxs:Error: under your platform. Make sure the Apache
apxs:Error: module mod_so is compiled into your server
apxs:Error: binary `/usr/local/apache/bin/httpd'.

應該是沒有按照要求進行編譯

./configure --prefix=/usr/local/ --enable-module=so

如果這樣編譯就可以了

在2.2.x環境下
---apache2.2.x----
[root@web233 generators]# /usr/local/apache2/bin/apxs -cia mod_info.c
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic   -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread -I/usr/local/apache2/include  -I/usr/local/apache2/include   -I/usr/local/apache2/include   -c -o mod_info.lo mod_info.c && touch mod_info.slo
/usr/local/apache2/build/libtool --silent --mode=link gcc -o mod_info.la  -rpath /usr/local/apache2/modules -module -avoid-version    mod_info.lo
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' mod_info.la /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp mod_info.la /usr/local/apache2/modules/
cp .libs/mod_info.so /usr/local/apache2/modules/mod_info.so
cp .libs/mod_info.lai /usr/local/apache2/modules/mod_info.la
cp .libs/mod_info.a /usr/local/apache2/modules/mod_info.a
chmod 644 /usr/local/apache2/modules/mod_info.a
ranlib /usr/local/apache2/modules/mod_info.a
PATH="$PATH:/sbin" ldconfig -n /usr/local/apache2/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/apache2/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/local/apache2/modules/mod_info.so
[activating module `info' in /usr/local/apache2/conf/httpd.conf]
[root@web233 modules]# pwd
/usr/local/apache2/modules
[root@web233 modules]# ls
httpd.exp  mod_info.so

已经增加了
# Example:
# LoadModule foo_module modules/mod_foo.so
LoadModule info_module        modules/mod_info.so  #這個是自動添加上的

添加如下內容:
<Location /server-info>
    SetHandler server-info
    Order deny,allow
    Allow from all    #我這裡是測試環境所以也就這樣設了 production 環境注意一下
</Location>
http://172.16.1.233/server-info

看到信息了

注意httpd.conf中間ExtendedStatus 在2.2.x版本是沒有的

ExtendedStatus On

加上restart apache

就可以看到信息了

2010年4月16日星期五

臨時開發vsftpd

 

yum install vsftpd

cd /etc/vsftpd

[root@carbon vsftpd]# ls
ftpusers  user_list  vsftpd.conf  vsftpd.conf.bak  vsftpd_conf_migrate.sh
[root@carbon vsftpd]#

 

 

[root@carbon vsftpd]# cat vsftpd.conf
anonymous_enable=NO
local_enable=YES
write_enable=YES
listen=YES
listen_port=21
max_clients=100
max_per_ip=5
idle_session_timeout=600
data_connection_timeout=120
accept_timeout=60
connect_timeout=60
tcp_wrappers=YES
guest_enable=YES
#guest_username=vsftpd
guest_username=yourusername
virtual_use_local_privs=YES
#pam_service_name=ftp
chroot_local_user=YES
pasv_enable=YES
pasv_min_port=30998
pasv_max_port=30999
[root@carbon vsftpd]#

[root@carbon pam.d]# pwd
/etc/pam.d
[root@carbon pam.d]# cp vsftpd ftp  #否這server上的用戶登錄不上

[root@carbon pam.d]# vsftpd /etc/vsftpd/vsftpd.conf

[root@carbon pam.d]# netstat –tln

 

tcp        0      0 0.0.0.0:21                  0.0.0.0:*                   LISEN

 

本地ftp---ok

遠程ftp –ok

2010年4月12日星期一

apache ab stress tool “apr_socket_recv: Connection reset by peer (104)” 的處理

使用apache 自帶的stresss tools ab, 如果併發設定的稍微大點就報錯了

類似:

[root@localhost bin]# ./ab -n 1000000 -c 2000 http://172.16.1.237/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.237 (be patient)

apr_socket_recv: Connection reset by peer (104)

Total of 80159 requests completed

開始懷疑是web server設置, os kernel parameter 設置的問題,後面發現不是, 而是ab 這個程序自身的問題,要打patch:

我用的是2.2.15 ,最新發佈的找到  srccode/support/ab.c

--修改代碼ab.c

   1367                 }

   1368                 return;

   1369             } else {

   1370                 //apr_err("apr_socket_recv", status); //原來的

   1371                 bad++;

   1372                 close_connection(c);

   1373                 return;

   1374             

   1375             }

   1376         }

   1377     }

make

使用這個新生成的ab做測試壓力可以達到20000

[root@localhost support]# ./ab -k -n 1000000 -c 20000 http://172.16.1.237/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.237 (be patient)

Completed 100000 requests

Completed 200000 requests

Completed 300000 requests

Completed 400000 requests

Completed 500000 requests

Completed 600000 requests

Completed 700000 requests

Completed 800000 requests

Completed 900000 requests

Completed 1000000 requests

Finished 1000000 requests

Server Software:        Apache/2.2.15

Server Hostname:        172.16.1.237

Server Port:            80

Document Path:          /index.html

Document Length:        62 bytes

Concurrency Level:      20000

Time taken for tests:   129.656 seconds

Complete requests:      1000000

Failed requests:        26877

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

Write errors:           0

Keep-Alive requests:    982282

Total transferred:      344888716 bytes

HTML transferred:       61514602 bytes

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

Time per request:       2593.110 [ms] (mean)

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

Transfer rate:          2597.69 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:        0  128 1551.6      0   93118

Processing:     1  583 3610.3    260  104485

Waiting:        0  284 639.7    252   54667

Total:          1  711 4610.9    260  128455

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

  50%    260

  66%    349

  75%    397

  80%    424

  90%    476

  95%    504

  98%    664

  99%  12202

100%  128455 (longest request)

[root@localhost support]#

[root@localhost support]# ./ab -k -n 1000000 -c 30000 http://172.16.1.237/index.html

/root/httpd-2.2.15/support/.libs/lt-ab: Invalid Concurrency [Range 0..20000]

Usage: /root/httpd-2.2.15/support/.libs/lt-ab [options] [http://]hostname[:port]/path

 

再次修改src code, grep 一下20000,將這個參數加大

但是無論如何也上不了 30000,

[root@localhost support]# ./ab -k -n 1000000 -c 30000 http://172.16.1.237/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.237 (be patient)

Test aborted after 10 failures

apr_socket_connect(): Cannot assign requested address (99)

 

有時間再查,記錄一下

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.

2010年3月17日星期三

solaris 7 force umount cmd

在一個超級古老的機器上mount 了一個nfs, 但是nfs server移除以後就沒有辦法 umount 這個目錄了

umount /backup

報錯如下:

nfs umount: /backup: is busy


怎麼辦呢?



google了一下,使用如下命令可以幹掉



Solaris 2.6 and Solaris 7: umount -o force /mount-point



試用了一下, 還是報錯



不過df -k的時候 發現已經很順暢了,感覺已經去掉了



當然還有另一種辦法



try following ...

unshare /backup
umount /backup


沒有測試過,等下次有機會測試一下



記錄一下備忘!

2010年3月5日星期五

How to Delete a node from RAC test

在測試環境中做一個一個RAC delete node的實驗記錄一下

環境是vmware

OS: OEL 5.2

DB: oracle 11gR1

 

http://docs.google.com/Doc?docid=0AbicX7azhQtmZGs3NzQ2Ml85NjBmbWMyZjRjZw&hl=en

2010年3月3日星期三

Awk 做url

學習了一個小技巧

ls | awk '{print "<a href="$0">"$0"</a><br />"}' > index.html 

將目錄下的東西寫道成href

ref:

http://ithelp.ithome.com.tw/question/10021489

2010年3月2日星期二

BBED complie

發現一個有用的工具BBED,處理壞塊使用的, 根據網上提供的方法,自己做了一個實驗:

我的環境是openSolaris 其他的*nix也是類似

1,源文件在哪裡?

cd $ORACLE_HOME

 

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1$ find . -name ins_rdbms.mk
./rdbms/lib/ins_rdbms.mk

2,編譯:

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1/rdbms/lib$ make -f ins_rdbms.mk /opt/oracle/product/10.2.0/db_1/rdbms/lib/bbed

Linking BBED utility (bbed)
rm -f /opt/oracle/product/10.2.0/db_1/rdbms/lib/bbed
/usr/ccs/bin/ld -64 -o /opt/oracle/product/10.2.0/db_1/rdbms/lib/bbed -L/opt/oracle/product/10.2.0/db_1/rdbms/lib/ -L/opt/oracle/product/10.2.0/db_1/lib/ -dy /opt/oracle/product/10.2.0/db_1/lib/prod/lib/amd64/crti.o /opt/oracle/product/10.2.0/db_1/lib/prod/lib/amd64/crt1x.o /opt/oracle/product/10.2.0/db_1/lib/s0main.o /opt/oracle/product/10.2.0/db_1/rdbms/lib/ssbbded.o /opt/oracle/product/10.2.0/db_1/rdbms/lib/sbbdpt.o `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 /opt/oracle/product/10.2.0/db_1/rdbms/lib/defopt.o  -ldbtools10 -lclntsh  `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10  -lcommon10 -lgeneric10 -lmm -lsnls10 -lnls10  -lcore10 -lsnls10  -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10  -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10 `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lnro10 `cat /opt/oracle/product/10.2.0/db_1/lib/ldflags`    -lnsslb10 -lncrypt10 -lnsgr10 -lnzjs10 -ln10 -lnnz10 -lnl10 -lclient10 -lnnetd10  -lvsn10  -lcommon10 -lgeneric10   -lsnls10 -lnls10  -lcore10 -lsnls10  -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10  -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10  -lclient10 -lnnetd10  -lvsn10  -lcommon10 -lgeneric10 -lsnls10 -lnls10  -lcore10 -lsnls10  -lnls10 -lcore10 -lsnls10 -lnls10 -lxml10  -lcore10 -lunls10 -lsnls10 -lnls10 -lcore10 -lnls10   `cat /opt/oracle/product/10.2.0/db_1/lib/sysliblist` -R /opt/SUNWcluster/lib:/opt/oracle/product/10.2.0/db_1/lib:/opt/ORCLcluster/lib/  -Y P,:/opt/SUNWcluster/lib:/opt/ORCLcluster/lib/:/usr/ccs/lib/amd64:/usr/lib/amd64  -Qy -lc  -lrt  -laio -lposix4 -lkstat -lm  /opt/oracle/product/10.2.0/db_1/lib/prod/lib/amd64/crtn.o

驗證一下:

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1/rdbms/lib$ ls -al bbed
-rwxr-xr-x 1 oracle oinstall 862016 2010-03-03 10:06 bbed

執行

oracle@opensolaris:/opt/oracle/product/10.2.0/db_1/rdbms/lib$ ./bbed
Password:(blockedit 為default password)

BBED: Release 2.0.0.0.0 - Limited Production on Wed Mar 3 10:07:15 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

************* !!! For Oracle Internal Use only !!! ***************

BBED>

這個工具是內部人員使用的哦

BBED> help all
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE  [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ <SET parameter> | ALL ]
INFO
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
</Nuf>:
N - a number which specifies a repeat count.
u - a letter which specifies a unit size:
  b - b1, ub1 (byte)
  h - b2, ub2 (half-word)
  w - b4, ub4(word)
  r - Oracle table/index row
f - a letter which specifies a display format:
  x - hexadecimal
  d - decimal
  u - unsigned decimal
  o - octal
  c - character (native)
  n - Oracle number
  t - Oracle date
  i - Oracle rowid
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
MODIFY[/x|d|u|o|c] numeric/character string
      [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
ASSIGN[/x|d|u|o] <target spec>=<source spec>
<target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
<source spec> : [ value | <target spec options> ]
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
POP [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ <bbed command> | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]

BBED>

記錄一下,備忘,繼續學習!

ref:

http://www.databasejournal.com/features/oracle/article.php/3835546/Installing-Oracle-Block-Browser-and-Editor-tool-bbed.htm

http://www.eygle.com/archives/2005/09/how_to_compile.html

add a disk to linux

在xen上增加一個disk,當人是vritual的:)


[root@Mocktrade dev]# fdisk /dev/xvdb  # xvdb 難道xen下的disk都是xvdx嗎?
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 4895.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4895, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-4895, default 4895):
Using default value 4895
Command (m for help): p
Disk /dev/xvdb: 40.2 GB, 40265318400 bytes
255 heads, 63 sectors/track, 4895 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1               1        4895    39319056   83  Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@ dev]#
[root@ dev]#
[root@ dev]# mkfs
mkfs         mkfs.cramfs  mkfs.ext2    mkfs.ext3
[root@ dev]# mkfs.ext3 -b 4096 /dev/xvdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
4915200 inodes, 9829764 blocks
491488 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
300 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@ /]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/xvda3            26306612   7741500  17207220  32% /
/dev/xvda1              101086     19708     76159  21% /boot
tmpfs                  1572864         0   1572864   0% /dev/shm
[root@ /]# mkdir /u01


[root@/]# mount /dev/xvdb1 /u01
[root@ /]# cd /u01
[root@ u01]# touch reame.txt
[root@ u01]# ls
lost+found  reame.txt
[root@ u01]# cd /etc
[root@ etc]# vi fstab

cat /etc/fstab
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/xvdb1             /u01                   ext3    defaults        1 1
LABEL=SWAP-xvda2        swap                    swap    defaults        0 0


[root@ etc]# df -lh
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda3             26G  7.4G   17G  32% /
/dev/xvda1             99M   20M   75M  21% /boot
tmpfs                 1.5G     0  1.5G   0% /dev/shm
/dev/xvdb1             37G  177M   35G   1% /u01
[root@]#

reboot

記錄一下,備忘!

lower_case_table_names 可以引發mysql replication 不成功

很早以前配置過一個mysql的replication, 跑的很好,突然客戶的mysql database replicaiton失效了

重新配置replication也無效

[crhk@_Slave bin]$ cat mysqld_slave.sh
#!/bin/sh
/usr/bin/mysqld_safe --skip-slave-start &
[crhk@_Slave bin]$

------------------------------------slave----------------------------------
[root@_Slave bin]# ./mysqld_slave.sh
[root@_Slave bin]# Starting mysqld daemon with databases from /var/lib/mysql

 

[root@_Slave mysql]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show slave status;
Empty set (0.00 sec)
mysql>
mysql> change master to
    -> master_host='A.B.C.D',
    -> master_port=3306,
    -> master_user='repl',
    -> master_password='password',
    -> master_log_file='mysql-bin.000031',
    -> master_log_pos=201937405;
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log
mysql>

將同步所需文件全部刪除

rm /var/lib/mysql/relay-log.info 
rm /var/lib/mysql/master.info 
rm /var/run/mysqld/*

重新做,問題依然

只能跟蹤log了

。。。。

100301 22:26:38  mysqld started
100301 22:26:38 [Warning] /usr/libexec/mysqld: ignoring option '--innodb_file_per_table' due to invalid value 'ON'
100301 22:26:38 [Warning] /usr/libexec/mysqld: ignoring option '--innodb_file_per_table' due to invalid value 'ON'
100301 22:26:39  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
100301 22:26:39  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 8 2665319758.
InnoDB: Doing recovery: scanned up to log sequence number 8 2665319758
InnoDB: Last MySQL binlog file position 0 3092, file name /var/lib/mysql/mysql-bin.000037
100301 22:26:39  InnoDB: Started; log sequence number 8 2665319758
100301 22:26:39 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.45-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
100301 22:27:47 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000037' at position 3268, relay log '/var/run/mysqld/mysqld-relay-bin.000001' position: 4
100301 22:27:47 [Note] Slave I/O thread: connected to master 'repl@172.16.12.29:3306',  replication started in log 'mysql-bin.000037' at position 3268
100301 22:27:47 [ERROR] Slave: Error 'Table 'databasename.GuessFall' doesn't exist' on query. Default database: 'databasename'. Query: 'insert into GuessFall (GuessFallId,UserId,StockCode,State,StartPrice,EndPrice,CreateDate,StopDate) values ('ff52146c-81f6-4334-8920-ef3f059ff3e8','b27e0e77-9cf2-aa9b-e040-10ac0d0c2f1f', '02777', 0, -1, 0.000, '2010-03-01 22:14:40','2010-03-01 22:14:40')', Error_code: 1146
100301 22:27:47 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000037' position 3268

。。。。

發現插入不了

這是開始懷疑master/slave 的配置問題不一致了

diff一下,果然,slave庫中少了

lower_case_table_names=1

修改之slave my.cnf文件,重新配置,正常了

Myql 官方解釋:

http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html

簡而言之就是 寫入不區分大小寫

0  --名字對大小寫敏感 ,default

1 - -table name on disk是小寫, 名字對大小寫敏感

2--存儲根據create table or create database 的語句,mysql 查詢的時候轉換小寫,對大小寫不敏感

教訓:

1. replication 方式下的 master /slave的環境配置一致很重要,

2.lower_case_table_names 這類常用參數,應該在database配置的時候設置好了,避免不必要的改動。

2010年2月25日星期四

oracle exp parfile mode

發現一個oracle exp的方法不錯,就是用file方式。記錄一下備查

 

oracle@opensolaris:~$ cat experfstat.par
userid=perfstat/perfstat
owner=perfstat
DIRECT=y
CONSISTENT=y
file=/export/home/oracle/perfstat.dmp
grants=y
indexes=y
oracle@opensolaris:~$

oracle@opensolaris:~$ exp parfile=experfstat.par
Export: Release 10.2.0.1.0 - Production on Thu Feb 25 17:55:39 2010
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in UTF8 character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user PERFSTAT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user PERFSTAT
About to export PERFSTAT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export PERFSTAT's tables via Direct Path ...
. . exporting table         STATS$BG_EVENT_SUMMARY        308 rows exported
. . exporting table          STATS$BUFFERED_QUEUES          0 rows exported
. . exporting table     STATS$BUFFERED_SUBSCRIBERS          0 rows exported
. . exporting table   STATS$BUFFER_POOL_STATISTICS         14 rows exported
. . exporting table          STATS$CR_BLOCK_SERVER          0 rows exported
. . exporting table     STATS$CURRENT_BLOCK_SERVER          0 rows exported
. . exporting table        STATS$DATABASE_INSTANCE          1 rows exported
. . exporting table          STATS$DB_CACHE_ADVICE        294 rows exported
. . exporting table                 STATS$DLM_MISC          0 rows exported
. . exporting table   STATS$DYNAMIC_REMASTER_STATS          0 rows exported
. . exporting table       STATS$ENQUEUE_STATISTICS        826 rows exported
. . exporting table          STATS$EVENT_HISTOGRAM       6692 rows exported
. . exporting table               STATS$FILESTATXS         70 rows exported
. . exporting table           STATS$FILE_HISTOGRAM        350 rows exported
. . exporting table               STATS$IDLE_EVENT         70 rows exported
. . exporting table  STATS$INSTANCE_CACHE_TRANSFER          0 rows exported
. . exporting table        STATS$INSTANCE_RECOVERY         14 rows exported
. . exporting table         STATS$JAVA_POOL_ADVICE         28 rows exported
. . exporting table                    STATS$LATCH       5348 rows exported
. . exporting table           STATS$LATCH_CHILDREN          0 rows exported
. . exporting table     STATS$LATCH_MISSES_SUMMARY         14 rows exported
. . exporting table             STATS$LATCH_PARENT          0 rows exported
. . exporting table        STATS$LEVEL_DESCRIPTION          5 rows exported
. . exporting table             STATS$LIBRARYCACHE        154 rows exported
. . exporting table              STATS$MUTEX_SLEEP          0 rows exported
. . exporting table                   STATS$OSSTAT        238 rows exported
. . exporting table               STATS$OSSTATNAME         17 rows exported
. . exporting table                STATS$PARAMETER       3696 rows exported
. . exporting table                  STATS$PGASTAT        196 rows exported
. . exporting table        STATS$PGA_TARGET_ADVICE        196 rows exported
. . exporting table    STATS$PROCESS_MEMORY_ROLLUP        376 rows exported
. . exporting table           STATS$PROCESS_ROLLUP        111 rows exported
. . exporting table     STATS$PROPAGATION_RECEIVER          0 rows exported
. . exporting table       STATS$PROPAGATION_SENDER          0 rows exported
. . exporting table           STATS$RESOURCE_LIMIT         70 rows exported
. . exporting table                 STATS$ROLLSTAT        154 rows exported
. . exporting table         STATS$ROWCACHE_SUMMARY        532 rows exported
. . exporting table                 STATS$RULE_SET         14 rows exported
. . exporting table                 STATS$SEG_STAT          0 rows exported
. . exporting table             STATS$SEG_STAT_OBJ          4 rows exported
. . exporting table            STATS$SESSION_EVENT          0 rows exported
. . exporting table                  STATS$SESSTAT          0 rows exported
. . exporting table          STATS$SESS_TIME_MODEL          0 rows exported
. . exporting table                      STATS$SGA         56 rows exported
. . exporting table                  STATS$SGASTAT        318 rows exported
. . exporting table        STATS$SGA_TARGET_ADVICE        112 rows exported
. . exporting table       STATS$SHARED_POOL_ADVICE        196 rows exported
. . exporting table                 STATS$SNAPSHOT         14 rows exported
. . exporting table                  STATS$SQLTEXT        362 rows exported
. . exporting table                 STATS$SQL_PLAN        330 rows exported
. . exporting table           STATS$SQL_PLAN_USAGE          0 rows exported
. . exporting table           STATS$SQL_STATISTICS         14 rows exported
. . exporting table              STATS$SQL_SUMMARY        885 rows exported
. . exporting table   STATS$SQL_WORKAREA_HISTOGRAM         67 rows exported
. . exporting table      STATS$STATSPACK_PARAMETER          1 rows exported
. . exporting table        STATS$STREAMS_APPLY_SUM          0 rows exported
. . exporting table          STATS$STREAMS_CAPTURE          0 rows exported
. . exporting table      STATS$STREAMS_POOL_ADVICE          0 rows exported
. . exporting table                  STATS$SYSSTAT       5180 rows exported
. . exporting table             STATS$SYSTEM_EVENT        798 rows exported
. . exporting table           STATS$SYS_TIME_MODEL        266 rows exported
. . exporting table               STATS$TEMPSTATXS         14 rows exported
. . exporting table           STATS$TEMP_HISTOGRAM         14 rows exported
. . exporting table                   STATS$THREAD         14 rows exported
. . exporting table      STATS$TIME_MODEL_STATNAME         19 rows exported
. . exporting table                 STATS$UNDOSTAT          8 rows exported
. . exporting table                 STATS$WAITSTAT        252 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
oracle@opensolaris:~$