Chinaunix首页 | 论坛 | 博客
  • 博客访问: 231161
  • 博文数量: 36
  • 博客积分: 1137
  • 博客等级: 少尉
  • 技术积分: 305
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-06 09:58
文章分类

全部博文(36)

文章存档

2012年(1)

2011年(31)

2010年(3)

2007年(1)

分类: Oracle

2011-11-16 20:47:11

            規劃:
磁盤規劃:
/boot    120M
/    3G
swap    2G
/u01    剩餘空間

網絡規劃
herac1    eth0:10.186.122.15 eth1:192.168.1.1
herac2    eth0:10.186.122.16 eth1:192.168.1.2

====================================================================
            安全前準備:

1、安裝操作linux操作系統

2、安裝系統補丁p3006854_9204_LINUX:
unzip p3006854_9204_LINUX.zip
cd 3006854/
chmod +x rhel3_pre_install.sh
./rhel3_pre_install.sh

3、安裝需求補丁:
linux光盤:
compat-db-4.1.25-9
compat-gcc-32-3.2.3-47.3     4
compat-gcc-32-c++-3.2.3-47.3          4
compat-libgcc-296-2.96-132.7.2         3
compat-libstdc++-296-2.96-132.7.2             3
compat-libstdc++-33-3.2.3-47.3          2
gcc-3.4.3-9.EL4
gcc-c++-3.4.3-9.EL4
gnome-libs-1.4.1.2.90-44.2
gnome-libs-devel-1.4.1.2.90-44             4
libaio-devel-0.3.102-1         3
libaio-0.3.102-1     3
make-3.80-5
openmotif21-2.1.30-11     3
openmotif-2.2.2-16                                      2
xorg-x11-deprecated-libs-devel-6.8.1-23.EL
xorg-x11-deprecated-libs-6.8.1-23.EL
binutils-2.11
openmotif-2.2.2-16
setarch-1.3-1

最後兩個由ORACLE補丁p4198954_21_linux.zip產生 (可不裝)
compat-oracle-rhel4-1.0-3
compat-libcwait-2.0-1
===
執行以下語句查看執行結果:
#files="compat-db compat-gcc-32 compat-gcc-32-c++ compat-libgcc-296 compat-libstdc++-296 \
compat-libstdc++-33 gcc gcc-c++ gnome-libs gnome-libs-devel libaio-devel libaio make openmotif21 openmotif \
xorg-x11-deprecated-libs-devel xorg-x11-deprecated-libs binutils openmotif setarch"

#for file in $files
do
   rpm -q $file
done

===
創建用戶和相關目錄
groupadd dba
groupadd oinstall
useradd oracle -g oinstall -G dba
passwd oracle

mkdir -p /u01/oracle/product/9208
mkdir -p /var/opt/oracle
chown -R oracle.dba /var/opt/oracle
chown -R oracle.dba /u01/oracle


配置環境變量:
以oracle登陸
$ vim .bash_profil
增加:
export ORACLE_BASE=/u01/oracle/
export ORACLE_HOME=/u01/oracle/product/9.2.0.4
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin
export ORACLE_OWNER=oracle
export ORACLE_SID=herac1
export ORACLE_TERM=xterm
export LD_ASSUME_KERNEL=2.4.1
export THREADS_FLAG=native
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export NLS_LANG="American_america.utf8"
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
export PATH

配置內核參數
#vi /etc/sysctl.conf
增加或修改:
kernel.sem=510 32000 100 128
kernel.shmmax=2147483648
kernel.shmmni=4096
fs.file-max=131072
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
net.ipv4.tcp_timestamps=0
net.ipv4.tcp_sack=0

#sysctl -p

配置對oracle用戶的限制
# vi /etc/security/limits.conf
增加或修改:
oracle  soft    nofile  65536
oracle  hard    nofile  65536
oracle  soft    nproc   16384
oracle  hard    nproc   16384

GCC降級
#su – root
#mv /usr/bin/gcc /usr/bin/gcc34
#ln -s /usr/bin/gcc32 /usr/bin/gcc
#mv /usr/bin/g++ /usr/bin/g++34
#ln -s /usr/bin/g++32 /usr/bin/g++



設置信任關係:
# vim /etc/hosts
增加
10.186.122.15   herac1
10.186.122.16   herac2
192.168.1.1     herac1-priv
192.168.1.2     herac2-priv

設置telnet-server
# rpm -q telnet-server
telnet-server-0.17-31.EL4.3
# chkconfig --level 35 telnet on
# service xinetd restart
# lsof -i:23            
COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
xinetd  5163 root    5u  IPv4  12326       TCP *:telnet (LISTEN)

# vi /etc/pam.d/login
註銷該行:
#auth       required    pam_securetty.so


設置rlogin,rsh
查看是否安裝rsh
# rpm -q rsh-server
rsh-server-0.17-25.4

設置開機啟動:
chkconfig --level 35 rsh on
chkconfig --level 35 rlogin on
chkconfig --level 35 rexec on
service xinetd restart

修改/etc/securetty
echo rexec >> /etc/securetty
echo rlogin >> /etc/securetty
echo rsh >> /etc/securetty

設置允許root進行rsh,rlogin
# vi /etc/pam.d/rlogin
註銷該行:
#auth       required    pam_securetty.so

# vi /etc/hosts.equiv
增加以下如下內容:
herac1
herac2
herac1-priv
herac2-priv

# vi /root/.rhosts
herac1  root
herac2  root
herac1-priv     root
herac2-priv     root

配置 hangcheck-timer

# echo "options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180" >> /etc/modules.conf
# modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180  (最好將這個也寫入rc.local)

劃分裸設備:
  cmq_50m         test01 -wi-a-  52.00M                              
  control01_300m  test01 -wi-a- 300.00M                              
  control02_300m  test01 -wi-a- 300.00M                              
  indx01_300m     test01 -wi-a- 300.00M                              
  rac1_redo01_50m test01 -wi-a-  52.00M                              
  rac1_redo02_50m test01 -wi-a-  52.00M                              
  rac2_redo01_50m test01 -wi-a-  52.00M                              
  rac2_redo02_50m test01 -wi-a-  52.00M                              
  spfile_50m      test01 -wi-a-  52.00M                              
  srvconfig_200m  test01 -wi-a- 200.00M                              
  system01_300m   test01 -wi-a- 300.00M                              
  temp01_200m     test01 -wi-a- 300.00M                              
  tools_200m      test01 -wi-a- 200.00M                              
  undotbs01_300m  test01 -wi-a- 300.00M                              
  undotbs02_300m  test01 -wi-a- 300.00M                              
  user01_300m     test01 -wi-a- 300.00M              


# vgchange -ay
掛在raw:
在/etc/rc.local增加:
raw /dev/raw/raw1 /dev/test01/cmq_50m
raw /dev/raw/raw2 /dev/test01/control01_300m
raw /dev/raw/raw3 /dev/test01/control02_300m  
raw /dev/raw/raw4 /dev/test01/indx01_300m     
raw /dev/raw/raw5 /dev/test01/rac1_redo01_50m
raw /dev/raw/raw6 /dev/test01/rac1_redo02_50m
raw /dev/raw/raw7 /dev/test01/rac2_redo01_50m
raw /dev/raw/raw8 /dev/test01/rac2_redo02_50m
raw /dev/raw/raw9 /dev/test01/spfile_50m      
raw /dev/raw/raw10 /dev/test01/srvconfig_200m  
raw /dev/raw/raw11 /dev/test01/system01_300m   
raw /dev/raw/raw12 /dev/test01/temp01_200m     
raw /dev/raw/raw13 /dev/test01/tools_200m      
raw /dev/raw/raw14 /dev/test01/undotbs01_300m  
raw /dev/raw/raw15 /dev/test01/undotbs02_300m  
raw /dev/raw/raw16 /dev/test01/user01_300m     
chown oracle:dba /dev/raw/raw*
chmod 755 /dev/raw/raw*


創建連接:
以oracle用戶登錄
mkdir -p $ORACLE_BASE/oradata/herac
cd $ORACLE_BASE/oradata/herac
ln -s /dev/raw/raw2 control01.ctl
ln -s /dev/raw/raw3 control02.ctl
ln -s /dev/raw/raw4 indx01.dbf
ln -s /dev/raw/raw5 redo01.log
ln -s /dev/raw/raw6 redo02.log
ln -s /dev/raw/raw7 redo03.log
ln -s /dev/raw/raw8 redo04.log
ln -s /dev/raw/raw9 spfile
ln -s /dev/raw/raw11 system01.dbf
ln -s /dev/raw/raw12 temp01.dbf
ln -s /dev/raw/raw13 tools01.dbf
ln -s /dev/raw/raw14 undotbs01.dbf
ln -s /dev/raw/raw15 undotbs02.dbf
ln -s /dev/raw/raw16 users01.dbf


====================================================================
安裝OCM

安裝集群軟件:
在client端開啟xmanager-passive
在server上以oracle登錄執行
export DISPLAY=10.180.38.145:0.0
./runInstaller

avaliable products-->OCM
public node information--> herac1
               herac2
private node information--> herac1-priv
                herac2-priv
quorum disk informiation-->/dev/raw/raw1  



配置oarcm
以oracle用戶:
cd $ORACLE_HOME/oracm/admin
$ vi cmcfg.ora
修改為:
HeartBeat=15000
ClusterName=Oracle Cluster Manager, version 9i
PollInterval=1000
MissCount=210
PrivateNodeNames=herac1-priv herac2-priv
PublicNodeNames=herac1 herac2
ServicePort=9998
CmDiskFile=/dev/raw/raw1
HostName=herac1-priv (根據實際情況)
KernelModuleName=hangcheck-timer

啟動oracm
cd $ORACLE_HOME/oracm/bin
$ ./ocmstart.sh
oracm &1 >/u01/oracle/product/9.2.0.4/oracm/log/cm.out &
touch: cannot touch `/etc/rac_on': Permission denied
解決:
以root登錄
# touch /etc/rac_on
# chown oracle:dba /etc/rac_on
再以oracle登錄
$ ./ocmstart.sh
ocmstart.sh: Error: Restart is too frequent
ocmstart.sh: Info:  Check the system configuration and fix the problem.
ocmstart.sh: Info:  After you fixed the problem, remove the timestamp file
ocmstart.sh: Info:  "/u01/oracle/product/9.2.0.4/oracm/log/ocmstart.ts"
解決:
$ rm -rf /u01/oracle/product/9.2.0.4/oracm/log/ocmstart.ts
$ ./ocmstart.sh
oracm &1 >/u01/oracle/product/9.2.0.4/oracm/log/cm.out &


暫不打補丁,打了後面安裝oracle軟件出錯了。估計是因為ocm升級后,安裝oracle軟件link的時候版本不對應


=================================================================
            安裝oracle軟件
檢查oracm確保運行,如果沒有運行則需要啟動:
$ ps -ef|grep oracm
oracle    4813     1  0 01:47 pts/1    00:00:00 oracm
oracle    4814  4813  0 01:47 pts/1    00:00:00 oracm
oracle    4816  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4817  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4818  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4819  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4820  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4821  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4822  4814  0 01:47 pts/1    00:00:00 oracm
oracle    4854  4814  0 01:48 pts/1    00:00:00 oracm
oracle    4856  4545  0 01:48 pts/1    00:00:00 grep oracm

只安裝軟件不安裝數據庫
installation types-->enterprise edition
database configuration--> software only
shared configration file name--> /dev/raw/raw10

安裝出錯29%,Unable to find make file : /u01/oracle/product/9.2.0.4/rdbms/lib/ins_rdbms.mk
解決:減低gcc版本


=============================================================
        初始化shared configuration文件
chown oracle:dba /var/opt/oracle/srvConfig.loc
chmod 755 /var/opt/oracle/srvConfig.loc

srvconfig -init
gsdctl start

配置偵聽:
$vim listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = herac1)(PORT = 1521))
      )
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PL***tProc)
      (ORACLE_HOME = /opt/ora9/product/9.2)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = herac)
      (ORACLE_HOME = /opt/ora9/product/9.2)
      (SID_NAME = herac1)
    )
  )

$ vi tnsnames.ora
LISTENER_HERAC =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = herac1)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = herac2)(PORT = 1521))
    )
    (CONNECT_DATA =
      (service_name = herac)
      (failover_mode=(type=select)(method=basic))
    )
    (LOAD_BALANCE=ON)
    (FAILOVER=ON)
  )

LISTENER_HERAC1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = herac1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (service_name = herac)
    )
  )


LISTENER_HERAC2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = herac2)(PORT = 1521))
    )
    (CONNECT_DATA =
      (service_name = herac)
    )
  )


dbca


PRKR-1005
PRKC-1020

PRKR-1005 "adding of cluster database {0} configuration failed, {1}"
Cause: An error occurred while attempting to add a new cluster database in
the configuration repository. Either the Global Services Daemons were not up
on all the nodes in the cluster or the configuration repository was not accessible
or the configuration repository was never initialized.
Action: Use ’gsdctl stat’ on each node to check if the Global Services Daemons
are up. If the Global Services Daemon is not up on any node use ’gsdctl start’ to
start it. Check if the configuration repository is accessible by using ’srvctl config’.
Use ’srvconfig -init’ to initialize the configuration repository if it was never
initialized.

PRKC-1020 "Exception while executing the operation on the remote node {0}"
Cause: Attempted to execute an operation on the remote node when the Global
Services Daemon was not up on the remote node {0}.
Action: Start the Global Services Daemon on the remote node using ’gsdctl start’.



開啟后啟動RAC:

ls -l /dev/raw/* 確保raw 權限和屬主正確,如果不正確需修改
以oracle登錄
$ ./ocmstart.sh
$ gsdctl  start
$ srvctl start database -d herac


==============================================
客戶端連接rac經常出現ORA-12545
解決:
SQL> alter system set local_listener='LISTENER_HERAC1' sid='herac1';
SQL> alter system set local_listener='LISTENER_HERAC2' sid='herac2';

SQL> alter system set remote_listener='LISTENERS_HERAC' sid='herac1';
SQL> alter system set remote_listener='LISTENERS_HERAC' sid='herac2';


$ srvctl stop database -d herac
$ srvctl start database -d herac



客戶端tnsnames.ora
herac=
  (DESCRIPTION=
    (ADDRESS_LIST=
      (FAILOVER=on)
      (LOAD_BALANCE=on)
      (SOURCE_ROUTE=off)
      (ADDRESS=
        (PROTOCOL=TCP)
        (HOST=10.186.122.15)
        (PORT=1521)
      )
      (ADDRESS=
        (PROTOCOL=TCP)
        (HOST=10.186.122.16)
        (PORT=1521)
      )
    )
    (CONNECT_DATA=
      (SERVICE_NAME=herac)
    )
  )







===========================================================================
        OCM && ORACLE 升級

1、關閉oracle
srvctl stop database -d herac
2、關閉gsd
gsdctl stop
3、關閉ocm
killall oracm

開始升級
1、升級OCM
2、啟動ocm

3、升級ORACLE
4、啟動GSD
gsdctl start
5、啟動ORACLE
srvctl start database -d herac
notes:
必須兩節點都設置了remote 才能用srvctl 來控制兩節點

==========


阅读(2061) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~