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}




記錄一下備忘!