oracle 11G RAC 安裝前準備和注意事項

raysuen發表於2016-08-24
VBoxManage createhd --filename /Volumes/mechine/VMware/virtualBox/11gsharestorage/asm1.vdi --size 2048 --format VDI --variant Fixed 

VBoxManage createhd --filename /Volumes/mechine/VMware/virtualBox/11gsharestorage/data1.vdi --size 40960 --format VDI --variant Fixed 

VBoxManage storageattach Cent5_8_64bit-rac1 --storagectl 'SATA' --port 1 --device 0 --type hdd --medium /Volumes/mechine/VMware/virtualBox/11gsharestorage/asm1.vdi --mtype shareable 

VBoxManage storageattach Cent5_8_64bit-rac1 --storagectl "SATA" --port 2 --device 0 --type hdd --medium /Volumes/mechine/VMware/virtualBox/11gsharestorage/data1.vdi --mtype shareable 




VBoxManage modifyhd /Volumes/mechine/VMware/virtualBox/11gsharestorage/asm1.vdi --type shareable 

VBoxManage modifyhd /Volumes/mechine/VMware/virtualBox/11gsharestorage/data1.vdi --type shareable 


VBoxManage storageattach Cent5_8_64bit-rac2 --storagectl 'SATA' --port 1 --device 0 --type hdd --medium /Volumes/mechine/VMware/virtualBox/11gsharestorage/asm1.vdi --mtype shareable 

VBoxManage storageattach Cent5_8_64bit-rac2 --storagectl "SATA" --port 2 --device 0 --type hdd --medium /Volumes/mechine/VMware/virtualBox/11gsharestorage/data1.vdi --mtype shareable 
注意centos6以上要執行 
--service NetworkManager stop 
--chkconfig --level 2345 NetworkManager off 


#public ip 
192.168.56.91 rac1 
192.168.56.92 rac2 

#private ip 
192.168.58.91 rac1-priv 
192.168.58.92 rac2-priv 

#vip 
192.168.56.93 rac1-vip 
192.168.56.94 rac2-vip 

#scan ip 
192.168.56.95 racscan 

# vi /etc/sysctl.conf 
kernel.shmall = 2097152 
kernel.shmmax = 1073741824 
kernel.shmmni = 4096 
kernel.sem = 250 32000 100 128 
fs.file-max = 6815744 
net.ipv4.ip_local_port_range = 9000 65500 
net.core.rmem_default = 4194304 
net.core.rmem_max = 4194304 
net.core.wmem_default = 262144 
net.core.wmem_max = 1048576 
fs.aio-max-nr=1048576 

透過getconf獲取分頁的大小,用來計算SHMALL的合理設定值: 

SQL> select 32*1024*1024*1024/4096 from dual; 

32*1024*1024*1024/4096 
---------------------- 
8388608 

對於32G的記憶體,4K分頁大小的系統而言,SHMALL的值應該設定為8388608。 
shmmax設定為實體記憶體大小 

[root@rac1 ~]# sysctl -p 

#vi /etc/security/limits.conf 
grid soft nproc 2047 
grid hard nproc 16384 
grid soft nofile 1024 
grid hard nofile 65536 
oracle soft nproc 2047 
oracle hard nproc 16384 
oracle soft nofile 1024 
oracle hard nofile 65536 

#vi /etc/pam.d/login 
session required /lib64/security/pam_limits.so 
session required  

# vi /etc/rc.local 
modprobe hangcheck-timer hangcheck-tick=30 hangcheck_margin=180 

二.建立組和使用者 
groupadd -g 1000 oinstall 
groupadd -g 1001 dba 
groupadd -g 1002 oper 
groupadd -g 1003 asmadmin 
groupadd -g 1004 asmoper 
groupadd -g 1005 asmdba 

useradd -u 1000 -g oinstall -G dba,asmdba,oper oracle 
useradd -u 1001 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid 

mkdir -p /u01/grid 
mkdir -p /u01/gridhome 
mkdir -p /u01/oracle 

chown -R grid:oinstall /u01/grid 
chmod -R 755 /u01/grid 
chown -R grid:oinstall /u01/gridhome 
chmod -R 755 /u01/gridhome 
chown -R oracle:oinstall /u01/oracle 
chmod -R 755 /u01/oracle 

四.停止ntp服務 
service ntpd stop 
chkconfig ntpd off 
mv /etc/ntp.conf /etc/ntp. 
mv /var/run/ntpd.pid /var/run/ntpd. 


rpm -qa | grep binutils-2.17.50.0.6 
rpm -qa | grep compat-libstdc++-33-3.2.3 
rpm -qa | grep compat-libstdc++-33-3.2.3 (32 bit) 
rpm -qa | grep elfutils-libelf-0.125 
rpm -qa | grep elfutils-libelf-devel-0.125 
rpm -qa | grep gcc-4.1.2 
rpm -qa | grep gcc-c++-4.1.2 
rpm -qa | grep glibc-2.5-24 
rpm -qa | grep glibc-2.5-24 (32 bit) 
rpm -qa | grep glibc-common-2.5 
rpm -qa | grep glibc-devel-2.5 
rpm -qa | grep glibc-devel-2.5 (32 bit) 
rpm -qa | grep glibc-headers-2.5 
rpm -qa | grep ksh-20060214 
rpm -qa | grep libaio-0.3.106 
rpm -qa | grep libaio-0.3.106 (32 bit) 
rpm -qa | grep libaio-devel-0.3.106 
rpm -qa | grep libaio-devel-0.3.106 (32 bit) 
rpm -qa | grep libgcc-4.1.2 
rpm -qa | grep libgcc-4.1.2 (32 bit) 
rpm -qa | grep libstdc++-4.1.2 
rpm -qa | grep libstdc++-4.1.2 (32 bit) 
rpm -qa | grep libstdc++-devel 4.1.2 
rpm -qa | grep make-3.81 
rpm -qa | grep sysstat-7.0.2 
rpm -qa | grep unixODBC-2.2.11 (32-bit) or later 
rpm -qa | grep unixODBC-devel-2.2.11 (64-bit) or later 
rpm -qa | grep unixODBC-2.2.11 (64-bit) or later 

安裝asm包 
CentOS6.5 
yum -y install kmod-oracleasm 
[root@asmrac2 ~]# rpm -ivh /u01/oracleasm-support-2.1.8-1.el6.x86_64.rpm 
warning: /u01/oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY 
Preparing... ########################################### [100%] 
1:oracleasm-support ########################################### [100%] 
[root@asmrac2 ~]# rpm -ivh /u01/oracleasmlib-2.0.4-1.el6.x86_64.rpm 
warning: /u01/oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY 
Preparing... ########################################### [100%] 
1:oracleasmlib ########################################### [100%] 
[root@asmrac2 ~]# 


CentOS5 
[root@rac1 software]# rpm -ivh oracleasm-support-2.1.7-1.el5.x86_64.rpm 
warning: oracleasm-support-2.1.7-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 
Preparing... ########################################### [100%] 
1:oracleasm-support ########################################### [100%] 
[root@rac1 software]# rpm -ivh oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm 
warning: oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 
Preparing... ########################################### [100%] 
1:oracleasm-2.6.18-308.el########################################### [100%] 
[root@rac1 software]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm  
warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 
Preparing... ########################################### [100%] 
1:oracleasmlib ########################################### [100%] 
[root@rac1 software]# rpm -ivh oracleasm-2.6.18-308.el5-debuginfo-2.0.5-1.el5.x86_64.rpm 
warning: oracleasm-2.6.18-308.el5-debuginfo-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 
Preparing... ########################################### [100%] 
1:oracleasm-2.6.18-308.el########################################### [100%] 



磁碟分割槽 
[root@rac1 CentOS]# fdisk /dev/sdb 
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 5221. 
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): n 
Command action 
e extended 
p primary partition (1-4) 
Partition number (1-4): 1 
First cylinder (1-5221, default 1): 
Using default value 1 
Last cylinder or +size or +sizeM or +sizeK (1-5221, default 5221): 
Using default value 5221 

Command (m for help): w 
The partition table has been altered! 

Calling ioctl() to re-read partition table. 
Syncing disks. 


--2個節點全部執行 
註冊asm(兩個節點) 

[root@rac2 u01]# /usr/sbin/oracleasm configure -i 
Configuring the Oracle ASM library driver. 

This will configure the on-boot properties of the Oracle ASM library 
driver. The following questions will determine whether the driver is 
loaded on boot and what permissions it will have. The current values 
will be shown in brackets ('[]'). Hitting <ENTER> without typing an 
answer will keep that current value. Ctrl-C will abort. 

Default user to own the driver interface []: grid 
Default group to own the driver interface []: asmadmin 
Start Oracle ASM library driver on boot (y/n) [n]: y 
Scan for Oracle ASM disks on boot (y/n) [y]: y 
Writing Oracle ASM library driver configuration: done 

初始化ASM(兩個節點) 
[root@rac1 CentOS]# /usr/sbin/oracleasm init 
Creating /dev/oracleasm mount point: /dev/oracleasm 
Loading module "oracleasm": oracleasm 
Mounting ASMlib driver filesystem: /dev/oracleasm 


建立asm磁碟(一個節點) 
[root@rac1 CentOS]# /usr/sbin/oracleasm createdisk OCR1 /dev/sda1 
Writing disk header: done 
Instantiating disk: done 

[root@rac1 CentOS]# /usr/sbin/oracleasm createdisk DATA1 /dev/sdb1 
Writing disk header: done 
Instantiating disk: done 

[root@rac1 CentOS]# /usr/sbin/oracleasm listdisks 
DATA1 
OCR1 

完成後,在另一個節點上 
[root@rac2 u01]# /usr/sbin/oracleasm scandisks 
Reloading disk partitions: done 
Cleaning any stale ASM disks... 
Scanning system for ASM disks... 
Instantiating disk "OCR1" 
Instantiating disk "DATA1" 

[root@rac2 u01]# /usr/sbin/oracleasm listdisks 
DATA1 
OCR1 


RHEL使用裸裝置 
1)獲取需要繫結為ASM Disk的磁碟uuid,例如/dev/mpathc 與/dev/mpathd;2個節點分別執行並比對UUID是否是共享磁碟 
[root@rac2 ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb 
1ATA_VBOX_HARDDISK_VB40857a49-8ca6587f 
[root@rac2 ~]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdc 
1ATA_VBOX_HARDDISK_VB181a0e3f-47677003 
2)2個節點編寫udev rules檔案(RESULT為uuid,NAME部分可以自己命名其餘不需要改動) 
[root@rac2 ~]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules 
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB40857a49-8ca6587f", NAME="asm-disk1", OWNER="grid", GROUP="asmadmin", MODE="0660" 
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB181a0e3f-47677003", NAME="asm-disk2", OWNER="grid", GROUP="asmadmin", MODE="0660" 

linux 5 多路徑繫結 
vi /etc/rc.local 
chown grid.asmadmin /dev/mapper/crs* 
chmod 660 /dev/mapper/crs* 
chown grid.asmadmin /dev/mapper/data[1-3] 
chmod 666 /dev/mapper/data[1-3] 


六.oracle使用者和grid分別建立使用者等效性 
oracle: 
cd /home/oracle 
mkdir ~/.ssh 
chmod 700 ~/.ssh 
ssh-keygen -t rsa 
ssh-keygen -t dsa 

cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys 
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys 
ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys 
ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys 

scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys 

ssh rac2 date;ssh rac1 date 
ssh rac2-priv date;ssh rac1-priv date 

grid: 
cd /home/grid 
mkdir ~/.ssh 
chmod 700 ~/.ssh 
ssh-keygen -t rsa 
ssh-keygen -t dsa 

cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys 
cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys 
ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys 
ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys 

scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys 

ssh rac2 date;ssh rac1 date 
ssh rac2-priv date;ssh rac1-priv date 

時間同步 
ntpdate  
ntpdate  
ntpdate  

七.oracle使用者和grid使用者修改.bash_profile 
oracle: 
export ORACLE_BASE=/u01/oracle 
export ORACLE_HOME=$ORACLE_BASE/11g 
export ORACLE_SID=RACDB1 
PATH=$ORACLE_HOME/bin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin 
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 


export ORACLE_BASE=/u01/oracle 
export ORACLE_HOME=$ORACLE_BASE/11g 
export ORACLE_SID=RACDB2 
PATH=$ORACLE_HOME/bin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin 
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 




grid: 
export ORACLE_BASE=/u01/grid 
export ORACLE_HOME=/u01/gridhome/11g 
export ORACLE_SID=+ASM1 
PATH=$ORACLE_HOME/bin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin 
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 


export ORACLE_BASE=/u01/grid 
export ORACLE_HOME=/u01/gridhome/11g 
export ORACLE_SID=+ASM2 
PATH=$ORACLE_HOME/bin:$PATH 
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin 
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib 

八.安裝Oracle Grid Infrastructure 
安裝cvuqdisk rpm包,這個包在Oracle Grid Infrastructure安裝介質中 
以root使用者登入 
export CVUQDISK_GRP=oinstall 

[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose >> check.txt 


# yum groupinstall "GNOME Desktop Environment"(CentOS 5.x安裝GNOME桌面環境) 
# yum groupinstall "X Window System" "Desktop"(CentOS 6.x安裝GNOME桌面環境) 




ERROR: 
PRVF-7617 : Node connectivity between 
解決: 
service iptables stop 
chkconfig --list | grep iptables 
chkconfig --level 345 iptables off 

關閉selinux 
setenforce 0 
/etc/selinux/config 
將SELINUX=enforcing改為SELINUX=disabled 


報錯 
 
/u01/app/11.2.0/grid/bin/clscfg.bin: error while loading shared libraries: libcap.so.1:cannot open shared object file: No such file or directory 

解決思路: 
yum -y install compat-libcap1 
或者: 
確定libcap包已安裝 
建立連線 
在/lib64 
ln -s libcap.so.2.16 libcap.so.1 

九 忽略錯誤: 
device checks for asm 
oracle cluster verification utility 

11gR2 grid安裝最後報錯[INS-20802] Oracle Cluster Verification Utility failed 
日誌中也報錯: 
INFO: Checking Single Client Access Name (SCAN)... 
INFO: Checking name resolution setup for "rac-scan"... 
INFO: ERROR: 
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan" 
INFO: ERROR: 
INFO: PRVF-4657 : Name resolution setup check for "rac-scan" (IP address: 192.168.0.20) failed 
INFO: ERROR: 
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan" 
INFO: Verification of SCAN VIP and Listener setup failed 
搜了一下發現老楊(yangtingkun)的文章中也提到了這個錯誤: 
F:RHEL5.532oracle_patchyangtingkun 安裝Oracle11_2 RAC for Solaris10 sparc64(二).mht 
老楊在文章的最後提到: 
導致這個錯誤的原因是在/etc/hosts中配置了SCAN的地址,嘗試ping這個地址資訊,如果可以成功,則這個錯誤可以忽略。 
我嘗試ping scan ip可以ping通,所以暫時也就忽略了這個錯誤。 
----- 
11gR2 RAC安裝中的Task resolv.conf Integrity問題 
沒有配置DNS的話 檢測/etc/resolv.conf 這步驟是會失敗的, 但是不影響安裝 ,直接 ignore 即可 





安裝rdbms提示: 
single client access name scan 


#開啟歸檔 
關閉其他節點,保留一個節點 
SQL> alter system set db_recovery_file_dest='+data2' scope=spfile; 

System altered. 

SQL> alter system set db_recovery_file_dest_size=2048G scope=spfile; 

System altered. 

SQL> shutdown immediate 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 
SQL> startup mount 
ORACLE instance started. 

Total System Global Area 3.0331E+10 bytes 
Fixed Size 2268032 bytes 
Variable Size 4831839360 bytes 
Database Buffers 2.5434E+10 bytes 
Redo Buffers 63033344 bytes 
Database mounted. 
SQL> alter database archivelog; 

Database altered. 

SQL> alter database open; 

Database altered. 

SQL> archive log list 
Database log mode Archive Mode 
Automatic archival Enabled 
Archive destination USE_DB_RECOVERY_FILE_DEST 
Oldest online log sequence 4 
Next log sequence to archive 9 
Current log sequence 9 
SQL> show parameter recovery 

NAME TYPE VALUE 
------------------------------------ ----------- ------------------------------ 
db_recovery_file_dest string +data2 
db_recovery_file_dest_size big integer 2048G 
recovery_parallelism integer 0 




RACDB = 
(DESCRIPTION = 
(ADDRESS = (PROTOCOL = TCP)(HOST = racscan)(PORT = 1521)) 
(CONNECT_DATA = 
(SERVER = DEDICATED) 
(SERVICE_NAME = RACDB) 


刪除rac 
rm -rf /etc/oracle/;rm -f /etc/init.d/init.cssd;rm -f /etc/init.d/init.crs;rm -f /etc/init.d/init.crsd;rm -f /etc/init.d/init.evmd;rm -f /etc/rc2.d/K96init.crs;rm -f /etc/rc2.d/S96init.crs;rm -f /etc/rc3.d/K96init.crs;rm -f /etc/rc3.d/S96init.crs;rm -f /etc/rc5.d/K96init.crs;rm -f /etc/rc5.d/S96init.crs;rm -Rf /etc/oracle/scls_scr;rm -f /etc/inittab.crs;rm -f /etc/ohasd;rm -f /etc/oraInst.loc;rm -f /etc/oratab;rm -rf /tmp/.oracle;rm -rf /tmp/ora*;rm -rf /var/tmp/.oracle;rm -rf /tmp/CVU*;rm -rf /tmp/Ora*;rm -rf /home/grid/.oracle 
rm -rf /u01/grid/*;rm -rf /u01/gridhome/* 
mv /etc/init.d/init.ohasd /etc/init.d/init.ohasd.bak 
init 6 
ps -ef | grep crs;ps -ef | grep evm;ps -ef | grep css 
dd if=/dev/zero of=/dev/mapper/crs bs=1M count=50000

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

相關文章