1. 前提條件node
1.1 認證操做系統ios
Certification Information for Oracle Database on Linux x86-64 (Doc ID 1304727.2)web
1)HP-UX 11i V3 patch Bundle Sep/ 2008 (B.11.31.0809.326a) or higher (Part Number E10851-01)api
1.2 系統硬件和軟件環境檢查bash
1) 系統運行級別服務器
# who -r網絡
--Check the daemon (pwgrd) is runningoracle
# ps -aef |grep pwgrdapp
2) 操做系統版本要求(參考文檔ID169706.1)ssh
# uname -a
# /bin/getconf KERNEL_BITS
HP-UX 11i V3 patch Bundle Sep/ 2008 (B.11.31.0809.326a) or higher (Part Number E10851-01)
3) 物理內存至少4G
# /usr/contrib/bin/machinfo|grep -i Memory
4)swap大小(大於16G則設置16G,不知足須要擴容內存。物理內存1G-2G,建議設置爲物理內存1.5倍,內存2G-16G,建議設置爲物理內存同樣大小。)
# /usr/sbin/swapinfo -a
5) tmp至少1G,不知足需擴容
# bdf /tmp
6)軟件目錄大小建議80g
7)系統軟件包
For HP-UX 11i V3 (11.31):
PHCO_40381 11.31 Disk Owner Patch
PHCO_41479 11.31 (fixes an 11.2.0.2 ASM disk discovery issue)
PHKL_38038 VM patch - hot patching/Core file creation directory
PHKL_38938 11.31 SCSI cumulative I/O patch
PHKL_39351 Scheduler patch : post wait hang
PHSS_36354 11.31 assembler patch
PHSS_37042 11.31 hppac (packed decimal)
PHSS_37959 Libcl patch for alternate stack issue fix (QXCR1000818011)
PHSS_39094 11.31 linker + fdp cumulative patch
PHSS_39100 11.31 Math Library Cumulative Patch
PHSS_39102 11.31 Integrity Unwind Library
PHSS_38141 11.31 aC++ Runtime
Pro*C/C++, Oracle Call Interface, Oracle C++
Pro*C/C++, Oracle Call Interface, Oracle C++ Call Interface, Oracle XML Developer's Kit (XDK):-
Patch for HP-UX 11i V3 (11.31) on HP-UX Itanium:-
PHSS_39824 - 11.31 HP C/aC++ Compiler (A.06.23) patch
PHKL_40941 - Scheduler patch : post wait hang
-- 查看系統包是否安裝
/usr/sbin/swlist -l bundle
/usr/sbin/swlist -l patch|grep PHCO_40381
/usr/sbin/swlist -l patch|grep PHCO_41479
/usr/sbin/swlist -l patch|grep PHKL_38038
/usr/sbin/swlist -l patch|grep PHKL_38938
/usr/sbin/swlist -l patch|grep PHKL_39351
/usr/sbin/swlist -l patch|grep PHSS_36354
/usr/sbin/swlist -l patch|grep PHSS_37042
/usr/sbin/swlist -l patch|grep PHSS_37959
/usr/sbin/swlist -l patch|grep PHSS_39094
/usr/sbin/swlist -l patch|grep PHSS_39100
/usr/sbin/swlist -l patch|grep PHSS_39102
/usr/sbin/swlist -l patch|grep PHSS_38141
/usr/sbin/swlist -l patch|grep PHSS_39824
/usr/sbin/swlist -l patch|grep PHKL_40941
-- 查看特定補丁包的替代包
/usr/sbin/swlist -l patch -a supersedes | grep -in PHCO_40381
/usr/sbin/swlist -l patch -a supersedes | grep -in PHCO_41479
/usr/sbin/swlist -l patch -a supersedes | grep -in PHKL_38038
/usr/sbin/swlist -l patch -a supersedes | grep -in PHKL_38938
/usr/sbin/swlist -l patch -a supersedes | grep -in PHKL_39351
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_36354
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_37042
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_37959
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_39094
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_39100
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_39102
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_38141
/usr/sbin/swlist -l patch -a supersedes | grep -in PHSS_39824
/usr/sbin/swlist -l patch -a supersedes | grep -in PHKL_40941
1.2 Lun分配建議
1) ocr voting:3個1G的lun,ASM對應劃分1個normal的dg
2) 控制文件:3個1G的lun,ASM對應劃分3個dg
3)redo:2個48G的lun(建議raid 1+0,儘可能不用raid5),ASM對應劃分2個dg
4) 數據文件:最多500G 1個lun,ASM對應劃分1個dg,注意單個dg不超過10t
1.3 網絡配置
--查看網卡信息
# lanscan
--網卡速率 lanadmin -s <網卡號>
# lanadmin -s 0
--經過「lanadmin -x <網卡號>」命令肯定網卡實際生效的速率和通信方式
# lanadmin –x 0
參數說明以下:
1) Current Speed:實際生效速率,單位是Mbit/s。
2) Full-Duplex:全雙工通信方式。
3) Half-Duplex:半雙工通信方式。
4) Autonegotiation:自適應工做方式。
1.4 IP需求
每一個節點一個public IP,一個virtual IP,一個private IP;
整個集羣須要至少一個SCAN IP;
# cat /etc/rc.config.d/netconf |grep -v ^#|perl -pe 's/^\s+$//g'
1.5 配置/etc/hosts文件
--查看IP地址設置
# lanscan
--顯示各個接口的ip和狀態 (須要保證每臺節點上使用的接口具備相同的名字)
# netstat -in
--顯示指定接口的當前配置
# ifconfig lanX
--查看路由
# netstat -rn
注1:hostname不容許使用下劃線_,建議統一使用小寫字母和數字組合,不然安裝過程可能會報錯。
cp /etc/hosts{,_$(date +%Y%m%d)}
cat >> /etc/hosts <EOF
127.0.0.1 loopback localhost
::1 loopback localhost
# Public Network - (bond0)
192.168.8.145 orcl1
192.168.8.146 orcl2
# Private Interconnect - (bond1)
192.168.168.145 orcl1-priv
192.168.168.146 orcl2-priv
# Public Virtual IP (VIP) addresses - (bond0:X)
192.168.8.147 orcl1-vip
192.168.8.148 orcl2-vip
# SCAN IP - (bond0:X)
192.168.8.149 orcl-scan
EOF
1.7 lib配置
--全部節點設置:
# cd /usr/lib
# ln -s libX11.3 libX11.sl
# ln -s libXIE.2 libXIE.sl
# ln -s libXext.3 libXext.sl
# ln -s libXhp11.3 libXhp11.sl
# ln -s libXi.3 libXi.sl
# ln -s libXm.4 libXm.sl
# ln -s libXp.2 libXp.sl
# ln -s libXt.3 libXt.sl
# ln -s libXtst.2 libXtst.sl
1.8 內核參數配置要求
NPROC 4096
KSI_ALLOC_MAX (NPROC*8)
EXECUTABLE_STACK=0
MAX_THREAD_PROC 1024
MAXDSIZ 1073741824
MAXDSIZ_64BIT 2147483648
MAXTSIZE_64BIT 1073741824
MAXSSIZ 134217728 bytes
MAXSSIZ_64BIT 1073741824
MAXUPRC ((NPROC*9)/10)+1
MSGMAP (MSGTQL+2) *
MSGMNI (NPROC)
MSGSEG 32767 *
MSGTQL (NPROC)
NCSIZE (NINODE+1024)
NFILE (15*NPROC+2048) *
NFLOCKS (NPROC)
NINODE (8*NPROC+2048)
NKTHREAD (((NPROC*7)/4)+16)
SEMMNI (NPROC)
SEMMNS (SEMMNI*2)
SEMMNU (NPROC - 4)
SEMVMX 32767
SHMMAX AvailMem
SHMMNI 4096
SHMSEG 512
VPS_CEILING 64
-- 檢查內核配置參數
# /usr/sbin/kctune –d
/usr/sbin/kctune ksi_alloc_max
/usr/sbin/kctune executable_stack
/usr/sbin/kctune max_thread_proc
/usr/sbin/kctune maxdsiz
/usr/sbin/kctune maxdsiz_64bit
/usr/sbin/kctune maxfiles
/usr/sbin/kctune maxfiles_lim
/usr/sbin/kctune maxssiz
/usr/sbin/kctune maxssiz_64bit
/usr/sbin/kctune maxuprc
/usr/sbin/kctune msgmni
/usr/sbin/kctune msgtql
/usr/sbin/kctune ncsize
/usr/sbin/kctune ninode
/usr/sbin/kctune nflocks
/usr/sbin/kctune nkthread
/usr/sbin/kctune nproc
/usr/sbin/kctune semmni
/usr/sbin/kctune semmns
/usr/sbin/kctune semmnu
/usr/sbin/kctune semvmx
/usr/sbin/kctune shmmax
/usr/sbin/kctune shmmni
/usr/sbin/kctune shmseg
/usr/sbin/kctune vps_ceiling
/usr/bin/ndd /dev/tcp tcp_largest_anon_port
/usr/bin/ndd /dev/udp udp_largest_anon_port
--內核參數設置命令:(kctune PARAMETRE=value)
/usr/sbin/kctune -h maxfiles_lim=32767
/usr/sbin/kctune -h maxssiz_64bit=1073741824
/usr/sbin/kctune -h msgmni=4200
/usr/sbin/kctune -h ncsize=36672
/usr/sbin/kctune -h ninode=35648
/usr/sbin/kctune -h nflocks=4200
/usr/sbin/kctune -h nkthread=7366
-- 應用參數設置
/usr/sbin/kcweb -F
-- 列出改變的參數
kmtune
1.9 UDP/TCP參數
--使用ndd命令檢查確認UDP/TCP 端口範圍是否爲9000-65500
/usr/bin/ndd /dev/tcp tcp_smallest_anon_port tcp_largest_anon_port
/usr/bin/ndd /dev/udp udp_smallest_anon_port udp_largest_anon_port
--編輯/etc/rc.config.d/nddconf文件更新配置,以下:
TRANSPORT_NAME[0]=tcp
NDD_NAME[0]=tcp_smallest_anon_port
NDD_VALUE[0]=9000
TRANSPORT_NAME[1]=tcp
NDD_NAME[1]=tcp_largest_anon_port
NDD_VALUE[1]=65500
TRANSPORT_NAME[2]=udp
NDD_NAME[2]=udp_smallest_anon_port
NDD_VALUE[2]=9000
TRANSPORT_NAME[3]=udp
NDD_NAME[3]=udp_largest_anon_port
NDD_VALUE[3]=65500
1.10 開啓異步IO
# ls -l /dev/async (默認是開啓的)
crw-rw-rw- 1 bin bin 101 0x000000 Apr 29 2013 /dev/async
--若沒有開啓異步I/O,則能夠經過一下方法開啓
-- 建立/dev/async character device
/sbin/mknod /dev/async c 101 0x0
chown oracle:dba /dev/async
chmod 660 /dev/async
1.11 建立用戶和組並賦予權限
-- 建立用戶組:
# /usr/sbin/groupadd -g 1000 oinstall
# /usr/sbin/groupadd -g 1020 asmadmin
# /usr/sbin/groupadd -g 1021 asmdba
# /usr/sbin/groupadd -g 1022 asmoper
# /usr/sbin/groupadd -g 1031 dba
# /usr/sbin/groupadd -g 1032 oper
-- 建立用戶:
/usr/sbin/useradd –u 1101 -g oinstall -G dba,asmdba,oper -m oracle
/usr/sbin/useradd –u 1100 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba –m grid
-- 修改用戶密碼
passwd oracle
passwd grid
-- su測試一下密碼是否修改爲功
-- 檢查確認
id oracle
uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1031(dba),1021(asmdba),1032(oper)
id grid
uid=1100(grid) gid=1000(oinstall) groups=1000(oinstall),1031(dba),1020(asmadmin),1022(asmoper),1021(asmdba)
-- 檢查/etc/privgroup 是否存在,
-- 不然,建立並編輯文件
vi /etc/privgroup
oinstall RTPRIO MLOCK RTSCHED
-- 若存在,則受權
# /usr/sbin/setprivgrp oinstall RTPRIO MLOCK RTSCHED
if [ -f "/etc/privgroup" ]; then
/usr/sbin/setprivgrp oinstall RTPRIO MLOCK RTSCHED
else
cat > /etc/privgroup <<EOF
oinstall RTPRIO MLOCK RTSCHED
EOF
fi
--檢查確認oinstall Oracle Inventory group受權
# /usr/bin/getprivgrp oinstall
oinstall: RTPRIO MLOCK RTSCHED
1.12 建立目錄
-- 建立目錄
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/11.2.0/grid
chown -R grid:oinstall /oracle
mkdir -p /oracle/app/oracle
mkdir -p /oracle/app/oracle/product/11.2.0/db_1
chown oracle:oinstall /oracle/app/oracle
chown oracle:oinstall /oracle/app/oracle/product/11.2.0/db_1
chmod -R 775 /oracle
-- 檢查目錄屬性,確認修改是否正確
ls -ltrd /oracle/app/grid /oracle/app/11.2.0/grid /oracle/app/oracle /oracle /oracle/app/oracle/product/11.2.0/db_1
1.13 配置grid、oracle用戶環境變量
su - grid
vi $HOME/.profile
export ORACLE_SID=+ASM1
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/app/11.2.0/grid/product/db_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
su - oracle
$HOME/.bash_profile
export ORACLE_SID=orcl1
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORA_CRS_HOME=/oracle/app/11.2.0/grid/product/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:${ORA_CRS_HOME}/bin:$PATH:$HOME/dba
umask 022
export TNS_ADMIN=${ORA_CRS_HOME}/network/admin
其它節點參照配置
1.14 共享磁盤配置
從存儲劃分共享存儲至兩臺主機,經過多路徑軟件識別。
# 注意:在使用這些lun以前,先進行格式化,以下操做
dd if=/dev/zero of=/dev/rdisk/disk3 bs=8192 count=1280
1)磁盤聚合路徑信息
# ioscan –fnNkCdisk
2)查看磁盤大小
# diskinfo /dev/rdisk/disk3
3)找出對應盤符的惟一ID,並找出其WWN(盤符應該是字符設備文件)
# scsimgr lun_map -D /dev/rdisk/disk3 |grep WWID
4)檢查確認磁盤未被VG使用
# vgdisplay –v
5)根據一一對應的WWN值,將相應WWN對應全部節點的盤符設置成一致:
for i in `ls -l /dev/rdisk/disk* |awk '{print $NF}'|grep -v _p`
do
echo $i
scsimgr lun_map -D $i |grep WWID
diskinfo $i |grep size
done
-- 舉例:
ls -l /dev/rdisk/disk*
crw-r----- 1 bin sys 13 0x000006 Aug 1 22:16 /dev/rdisk/disk4
crw-r----- 1 bin sys 13 0x000007 Aug 1 22:16 /dev/rdisk/disk5
crw-r----- 1 bin sys 13 0x000008 Aug 1 22:16 /dev/rdisk/disk6
crw-r----- 1 bin sys 13 0x000008 Aug 1 22:16 /dev/rdisk/disk7
-- node1
/dev/rdisk/disk4
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c000000a8
size: 209715840 Kbytes
/dev/rdisk/disk5
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c00000f25
size: 1049280 Kbytes
/dev/rdisk/disk6
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c00000f24
size: 1049280 Kbytes
/dev/rdisk/disk7
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c00000f26
size: 1049280 Kbytes
-- node2
/dev/rdisk/disk14
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c000000a8
size: 209715840 Kbytes
/dev/rdisk/disk15
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c00000f24
size: 1049280 Kbytes
/dev/rdisk/disk16
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c00000f26
size: 1049280 Kbytes
/dev/rdisk/disk17
World Wide Identifier(WWID) = 0x60060e8006d69c000000d69c00000f25
size: 1049280 Kbytes
-- 綁定盤符
-- node1
mkdir -p /dev/oracle
mknod /dev/oracle/ocr1 c 13 0x000007
mknod /dev/oracle/ocr2 c 13 0x000008
mknod /dev/oracle/ocr3 c 13 0x000009
mknod /dev/oracle/data1 c 13 0x000006
-- node2
crw-r----- 1 bin sys 13 0x000005 Aug 2 04:33 /dev/rdisk/disk14
crw-r----- 1 bin sys 13 0x000006 Aug 2 04:33 /dev/rdisk/disk15
crw-r----- 1 bin sys 13 0x000007 Aug 2 04:33 /dev/rdisk/disk16
crw-r----- 1 bin sys 13 0x000008 Aug 2 04:33 /dev/rdisk/disk17
mkdir -p /dev/oracle
mknod /dev/oracle/ocr1 c 13 0x000008
mknod /dev/oracle/ocr2 c 13 0x000006
mknod /dev/oracle/ocr3 c 13 0x000007
mknod /dev/oracle/data1 c 13 0x000005
--修改用戶,用戶組及權限
chown -R grid:asmadmin /dev/oracle
chmod 660 /dev/oracle/*
-- 清空磁盤頭數據
dd if=/dev/zero of=/dev/oracle/ocr1 bs=8192 count=1280
dd if=/dev/zero of=/dev/oracle/ocr2 bs=8192 count=1280
dd if=/dev/zero of=/dev/oracle/ocr2 bs=8192 count=1280
dd if=/dev/zero of=/dev/oracle/data1 bs=8192 count=1280
1.15配置ntp服務
-- 查看當前時區
echo $TZ
or
cat /etc/TIMEZONE
or
cat /etc/default/tz
-- 設置時區
# set_parms timezone
____________________________________________________________________________
The following procedure enables you to set the time zone.
Select your location from the following list:
1) North America or Hawaii
2) Central America
3) South America
4) Europe
5) Africa
6) Asia
7) Australia, New Zealand
8) Russia / CIS
____________________________________________________________________________
Enter the number for your location (1-7) then press [Enter] #
-- 添加ntp服務器,根據實際環境添加或修改NTP服務端IP地址
vi /etc/ntp.conf
server 127.127.0.1
-- 更改兩個參數的值
vi /etc/rc.config.d/netdaemons
export NTPDATE_SERVER=127.127.0.1
export XNTPD=1 (1表示啓動xntpd;0表示不啓動xntpd)
export XNTPD_ARGS=」-x」
-- 配置ntpd的參數,咱們主要強調的是要配置成"微調的模式" 。HP默認是微調模式。
-- 啓動ntp服務
/sbin/init.d/xntpd start
-- 檢查是否生效
ntpq -p
ps -ef |grep ntp|grep -v grep
-- 安裝完成後須要使用以下命令確認
$ crsctl check ctss
1.16 配置SSH互信
1)grid用戶和oracle用戶分別配置
# su - grid
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
節點一:
-- 將生成的rsa和dsa密鑰複製到authorized_keys
$ cat ~/.ssh/*.pub >> ~/.ssh/authorized_keys
-- 將節點2的生成的密鑰追加到節點1的authorized_keys中,如有多個節點,依次執行
$ ssh node2 "cat ~/.ssh/*.pub" >> ~/.ssh/authorized_keys
-- 將最終的authorized_keys文件傳輸到其它全部節點
$ scp ~/.ssh/authorized_keys node2:~/.ssh/authorized_keys
-- 修改文件權限
$ chmod 600 ~/.ssh/authorized_keys
-- oracle用戶參照上面步驟配置
-- 互信驗證(oracle,grid)全部節點操做
su - grid
export SSH='ssh -o ConnectTimeout=3 -o ConnectionAttempts=5 -o PasswordAuthentication=no -o StrictHostKeyChecking=no'
$ ${SSH} rac1 date
$ ${SSH} rac1-priv date
$ ${SSH} rac2 date
$ ${SSH} rac2-priv date
2) oralce11g能夠在安裝時進行自動配置ssh,第一次設置,點擊「Setup」,設置成功後點擊「Test」,成功後需兩邊節點測試驗證互信。
2. 圖形界面安裝
2.1 預檢查
su - grid
./runcluvfy.sh stage -pre crsinst -n vpar4,vpar5 -fixup -verbose
2.2 圖形界面安裝GI軟件
以grid用戶登陸,進入到安裝文件解壓目錄
./runInstaller
……
-- root用戶,分別在兩個節點執行如下腳本
/oracle/app/oraInventory/orainstRoot.sh
/oracle/app/11.2.0/grid/root.sh
2.3 檢查集羣狀態
注意:gsd爲OFFLINE狀態正常,配置ntp服務則ora.ctssd爲OBSERVER的狀態
su - grid
crsctl stat res -t -init
crsctl stat res -t
2.4
建立ASM磁盤組
su – grid
asmca
2.5 圖形界面安裝RDBMS 軟件
注意事項:兩個DB的安裝包需解壓在同個目錄下。
su - oracle
./runInstaller
……
--節點root用戶運行腳本
/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
2.6 dbca建庫
su – oracle
dbca