oracle9iRAC恢復一個節點

jichengjie發表於2012-10-30
本文描述了在兩個節點組成的RAC中一個節點硬碟損壞,恢復一個節點的過程。
 suse 9.0
:~> uname -a
Linux ndb1 2.6.5-7.202.7-bigsmp #1 SMP Tue Nov 29 14:32:53 UTC 2005 i686 i686 i386 GNU/Linux
:~> 
                           恢復RAC節點1操作步驟
一、安裝oracle軟體
1.準備oracle安裝軟體
 
cpio -idmv< ship_9204_linux_disk1.cpio
cpio -idmv< ship_9204_linux_disk1.cpio
cpio -idmv< ship_9204_linux_disk1.cpio
unzip p3948480_9206_LINUX.zip
 
2.  RAC伺服器 1 (hostname :  ndb1)
裝置         IP 地址   子網         用途
Eth0 100.188.32.1   255.255.255.0 連線ndb1與公共網路,接受外部的資料請求
Eth1 192.168.1.1     255.255.255.0 用於RAC中ndb1、ndb2內部通訊
 
用vi 編輯/etc/hosts檔案,增加如下內容:
100.188.32.1        ndb1
#100.188.32.2        ndb2
192.168.1.1       pdb1
#192.168.1.2       pdb2
  
3. 
載入hangcheck-timer模組
#modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
檢查hangcheck-timer模組
#lsmod | grep hangcheck_timer
 
4.
建立 UNIX oracle 使用者帳號
#groupadd -g 500 dba
#groupadd -g 501 oinstall
#useradd -u 500 -g  dba -G oinstall -m -s /bin/bash oracle
#mkdir /opt/oracle/oradata
#chown oracle.dba /opt/oracle/oradata
#chmod 775 /opt/oracle/oradata
 
ulimit -n 65536
ulimit -u 16384
 
5
設定環境變數
用vi修改~/.bash_profile檔案,增加如下內容
 
:~> cat .bash_profile
export LC_ALL=en_US
export ORACLE_HOME=/opt/oracle/product/9ir2
export ORACLE_SID=yldb1
export NLS_LANG=american_america.zhs16gbk
export SQLPATH=$ORACLE_HOME/rdbms/admin/
 
ORACLE_BASE=/opt/oracle
export ORACLE_BASE
ORA_NLS33=/opt/oracle/product/9ir2/ocommon/nls/admin/data
export ORA_NLS33
LD_LIBRARY_PATH=/opt/oracle/product/9ir2/lib
PATH=/opt/oracle/product/9ir2/bin:/usr/bin:/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/java/jre/bin:/opt/oracle/product/9ir2/bin
export PATH LD_LIBRARY_PATH
CLASSPATH=/opt/oracle/product/9ir2/JRE:/opt/oracle/product/9ir2/jlib:/opt/oracle/product/9ir2/rdbms/jlib:/opt/oracle/product/9ir2/network/jlib
export CLASSPATH
TNS_ADMIN=/opt/oracle/product/9ir2/network/admin
LANG=zh_CN.UTF-8
export TNS_ADMIN LANG
 
修改核心引數
#echo 250 32000 100 128 > /proc/sys/kernel/sem  --在rac_prepare.sh中設定
#echo 2147483648 > /proc/sys/kernel/shmmax
#echo 65536 > /proc/sys/fs/file-max
#echo 1 > /proc/sys/vm/disable_cap_mlock
 
#echo 1024    65000 > /proc/sys/net/ipv4/ip_local_port_range
 
#echo 262144 > /proc/sys/net/core/wmem_max
#echo 262144 > /proc/sys/net/core/wmem_default
#echo 262144 > /proc/sys/net/core/rmem_max
#echo 262144 > /proc/sys/net/core/rmem_default
 
7
應用p3006854_9204_LINUX
 
 
共享裸裝置
 
需用到CMQuorumFile,SrvConfigFile檔案
所有的檔案都在/opt/oracle/oradata/yldb/下建立
 
安裝Oracle 9.2.0.4 ORACM (Oracle Cluster Manager)
執行下面命令:
> /install/Disk1/runInstaller
 
8
安裝oracle OUI 10.1.0.2
執行下面命令:
> /install/p3948480_9206_LINUX/Disk1/runInstaller
 
9
安裝oracle  9.2.0.6 ORACM補丁
執行OUI 10.1.0.2,將oracle 9.2.0.4 ORACM升級到oracle 9.2.0.6 ORACM。執行下面命令:
> /install/p3948480_9206_LINUX/Disk1/runInstaller
 
10   
安裝Oracle RAC 9.2.0.4
 
為了避免BUG 3547724,建符號連線
# mkdir /u04/oradata
# chmod 777 /u04/oradata
# ln -s /u04/oradata /oradata
 
> /install/Disk1/runInstaller
 
選擇只安裝軟體
 
rm -rf /oradata
 
11
安裝Oracle RAC 9.2.0.6補丁
從oracle 9.2.0.6 補丁安裝檔案所在的目錄執行runInstaller:
> /install/p3948480_9206_LINUX/Disk1/runInstaller
 
 
二、加入RAC設定
 
準備:
    資料庫全備
1.
ndb1>
 
su - root
用vi 編輯/etc/hosts檔案,修改如下內容:
100.188.32.1        ndb1
100.188.32.2        ndb2
192.168.1.1       pdb1
192.168.1.2       pdb2
在兩臺伺服器上依次執行命令:
#ping ndb1
#ping ndb2
#ping pdb1
#ping pdb2
看能否得到正確的IP地址
 
 
2.執行指令碼
./rac_mount_nfs.sh 
 
:~> cat rac_mount_nfs.sh
mount -t nfs 100.188.32.2:/opt/oracle/oradata/yldb/archive02    /opt/oracle/oradata/yldb/archive02/
 
./rac_prepare.sh
 
:~> cat rac_prepare.sh
echo 250 32000 100 128 > /proc/sys/kernel/sem
echo 2147483648 > /proc/sys/kernel/shmmax
echo 65536 > /proc/sys/fs/file-max
echo 1 > /proc/sys/vm/disable_cap_mlock
modprobe hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
lsmod | grep hang
 
#new added at Dec 14 2011
 
echo 1024    65000 > /proc/sys/net/ipv4/ip_local_port_range
 
echo 262144 > /proc/sys/net/core/wmem_max
echo 262144 > /proc/sys/net/core/wmem_default
echo 262144 > /proc/sys/net/core/rmem_max
echo 262144 > /proc/sys/net/core/rmem_default
 
 
#fdisk -l|grep Disk
#/etc/init.d/PowerPath start
for i in `seq 1 10`
do
raw /dev/raw/raw$(( i+0 )) /dev/emcpowera$(( i+4 ))
done
 
for i in `seq 1 10`
do
raw /dev/raw/raw$(( i+10 )) /dev/emcpowerb$(( i+4))
done
 
for i in `seq 1 10`
do
raw /dev/raw/raw$(( i+20 )) /dev/emcpowerc$(( i+4))
done
 
for i in `seq 1 10`
do
raw /dev/raw/raw$(( i+30 )) /dev/emcpowerd$(( i+4))
done
 
for i in `seq 1 10`
do
raw /dev/raw/raw$(( i+40 )) /dev/emcpowere$(( i+4))
done
 
 
for i in `seq 1 10`
do
raw /dev/raw/raw$(( i+50 )) /dev/emcpowerf$(( i+4))
done
 
for i in `seq 1 60`
do
chmod 664 /dev/raw/raw$i
chown oracle.dba /dev/raw/raw$i
done
 
 
#$ORACLE_HOME/oracm/bin/ocmstart.sh
head -1 $ORACLE_HOME/oracm/log/cm.log
cat $ORACLE_HOME/oracm/log/cm.log|grep version
ps -ef | grep oracm
 
 
su - oracle
3.
開啟RSH和SSH
兩個節點重新配置
 
首先將節點2 oracle主目錄下.ssh改名
 
#mkdir -p .ssh
#chmod 700 .ssh
 
 
SSH的配置 :
oracle使用者登陸
~/.ssh/
-t rsa
-t dsa
ndb1 cat /opt/oracle/.ssh/id_rsa.pub >>authorized_keys
ndb1 cat /opt/oracle/.ssh/id_dsa.pub >>authorized_keys
cat /opt/oracle/.ssh/id_rsa.pub >>authorized_keys
cat /opt/oracle/.ssh/id_dsa.pub >>authorized_keys
authorized_keys ndb2:/home/oracle/.ssh/
644 authorized_keys
 
~/.ssh/
-t rsa
-t dsa
ndb1 cat /opt/oracle/.ssh/id_rsa.pub >>authorized_keys
ndb1 cat /opt/oracle/.ssh/id_dsa.pub >>authorized_keys
cat /opt/oracle/.ssh/id_rsa.pub >>authorized_keys
cat /opt/oracle/.ssh/id_dsa.pub >>authorized_keys
authorized_keys ndb1:/home/oracle/.ssh/
644 authorized_keys
 
在每個節點執行如下
# ssh ndb1 date
# ssh ndb2 date
 
新增下面內容
 
ndb2:/etc # cat hosts.equiv
#
# hosts.equiv   This file describes the names of the hosts which are
#               to be considered "equivalent", i.e. which are to be
#               trusted enough for allowing rsh(1) commands.
#
# hostname
+ndb1 oracle
+pdb1 oracle
+ndb2 oracle
+pdb2 oracle
 
4.
 
配置共享裝置
 
su - oracle
/opt/oracle/oradata/yldb
先改名CMQuorumFile等內容,
mv CMQuorumFile CMQuorumFile.old
mv SrvConfigFile SrvConfigFile.old
 
在/opt/oracle/oradata/yldb下做符號聯接。
ln -s /dev/raw/raw1      CMQuorumFile
ln -s /dev/raw/raw20     SrvConfigFile
ln -s /dev/raw/raw21     control01.ctl
ln -s /dev/raw/raw22     control02.ctl
ln -s /dev/raw/raw23     control03.ctl
ln -s /dev/raw/raw57     dape01.dbf
ln -s /dev/raw/raw51     jablog01.dbf
ln -s /dev/raw/raw52     jablog02.dbf
ln -s /dev/raw/raw53     jablog03.dbf
ln -s /dev/raw/raw54     jablog_blob01.dbf
ln -s /dev/raw/raw55     jablog_blob02.dbf
ln -s /dev/raw/raw56     jablog_blob03.dbf
ln -s /dev/raw/raw36     redo01.log
ln -s /dev/raw/raw37     redo02.log
ln -s /dev/raw/raw38     redo03.log
ln -s /dev/raw/raw39     redo04.log
ln -s /dev/raw/raw49     redo05.log
ln -s /dev/raw/raw50     redo06.log
ln -s /dev/raw/raw15     spfileyldb.ora
ln -s /dev/raw/raw24     system01.dbf
ln -s /dev/raw/raw25     temp01.dbf
ln -s /dev/raw/raw28     tools01.dbf
ln -s /dev/raw/raw26     undotbs01.dbf
ln -s /dev/raw/raw27     undotbs02.dbf
ln -s /dev/raw/raw29     users01.dbf
 
 
su - root
 
5.
檢查ocm版本,要求一致
/opt/oracle/product/9ir2/oracm/log] # grep -i version cm.log | more
 
修改配置
vi $ORACLE_HOME/oracm/admin/cmcfg.ora
 
ClusterName=Oracle Cluster Manager, version 9i
MissCount=215
PrivateNodeNames=pdb1 pdb2
PublicNodeNames=ndb1 ndb2
ServicePort=9998
CmDiskFile=/opt/oracle/oradata/yldb/CMQuorumFile
KernelModuleName=hangcheck-timer
HostName=pdb1
 
 
啟動oracm
 
cd /opt/oracle/product/9ir2/oracm/bin
 
./ocmstart.sh
oracm &1 >/opt/oracle/product/9ir2/oracm/log/cm.out&
 
檢查啟動的日至
head -1 $ORACLE_HOME/oracm/log/cm.log
 
cat $ORACLE_HOME/oracm/log/cm.log|grep version
 
ps -ef | grep oracm
 
su - oracle
 
6.
gsdctl 啟動
gsdctl start
 
7.生成pfile
 
登陸節點2
用超級使用者登陸資料庫
sql>create pfile='/opt/oracle/product/9ir2/dbs/init_new.ora' from spfile;
 
8.從節點2複製oracle檔案
 
listener  
tnsname檔案複製
 
以下相同的目錄直接複製
/opt/oracle/admin
/opt/oracle/rac*.sh  
 
/opt/oracle/backup 
/opt/oracle/oraclejob 
 
/opt/oracle/product/9ir2/dbs  有符號連線,不能直接複製
cp init_new.ora
ln -s /opt/oracle/oradata/yldb/spfileyldb.ora spfileyldb.ora
ln -s /opt/oracle/oradata/yldb/spfileyldb.ora spfileyldb1.ora
ln -s /opt/oracle/oradata/yldb/spfileyldb.ora spfileyldb2.ora
 
建立目錄
/opt/oracle/oradata/yldb/archive01
/opt/oracle/oradata/yldb/archive02
 
將ndb2:/opt/oracle/oradata/yldb/archive01/  複製過來 /opt/oracle/oradata/yldb/archive01
scp -r /opt/oracle/oradata/yldb/archive01/*.dbf  
 
9.
例項的啟動
 
su - oracle
 
startup pfile='/opt/oracle/product/9ir2/dbs/init_new.ora';
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26870952/viewspace-747882/,如需轉載,請註明出處,否則將追究法律責任。

相關文章