在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)

tolywang發表於2007-12-13
基本環境
體系結構: 32位
作業系統: Red Hat Enterprise Linux AS4 2.6.9-42.ELsmp
RAM: 2G
交換空間: 2G
網路協議: TCP/IP
網路介面卡: 2*NIC's
儲存: 本地SCSI硬碟140G;共享SCSI硬碟陣列(raid 5 400G)

 一、準備叢集
1. 檢查需求
(1)檢查硬體需求
實體記憶體至少1G、交換區至少2G、臨時目錄空間至少400M、硬碟空間、CPU型別與Oracle相容等
在每個節點以 root 使用者執行下面命令:
cat /proc/cpuinfo
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
df -h
(2)識別網路需求每個節點至少2塊網路卡、三個IP地址,一個公共IP、一個私有IP、一個虛擬IP
在每個節點以 root 使用者執行下面命令:
/sbin/ifconfig(3)檢驗作業系統和軟體需求檢視作業系統版本、核心版本、所需軟體包等
在每個節點以 root 使用者執行下面命令:
cat /etc/issue
uname -r
rpm -q binutils compat-db control-center gcc gcc-c++ glibc gnome-libs libstdc++ libstdc++-devel make openmotif21
2. 配置網路檢視當前主機名
hostname
兩個節點的主機名為 longshi_rac01、longshi_rac02,可以編輯 /etc/sysconfig/network 檔案修改主機名,重啟機器後生效。

網路規劃如下:

主機名 型別IP地址 註冊位置
longshi_rac01 公共192.168.0.125DNS
longshi_rac02公共192.168.0.89DNS
longshi_rac01-vip虛擬192.168.0.225主機檔案
longshi_rac02-vip 虛擬 192.168.0.189主機檔案
longshi_rac01-priv 專用10.1.1.1主機檔案
longshi_rac02-priv專用 10.1.1.2主機檔案

主機檔案

在每個節點以 root 使用者編輯/etc/hosts檔案,內容如下:
127.0.0.1 localhost
192.168.0.125 longshi_rac01
192.168.0.89 longshi_rac02
192.168.0.225 longshi_rac01-vip
192.168.0.189 longshi_rac02-vip
10.1.1.1 longshi_rac01-priv
10.1.1.2 longshi_rac02-priv
(1)檢驗網路配置在每個節點以 root 使用者執行下面命令:ping -c 3 longshi_rac01
ping -c 3 longshi_rac01-priv

ping -c 3 longshi_rac02
ping -c 3 longshi_rac02-priv

route # 檢視預設閘道器
ping -c 3 192.168.0.1 # ping 預設閘道器
3. 準備伺服器
(1)配置作業系統使用者和組
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
useradd -u 200 -g oinstall -G dba -d /home/oracle -r oracle -m
passwd oracle
id oracle
注意:oracle 使用者的屬性包括使用者名稱、使用者ID、所屬組名、所屬組ID在所有節點必須相同
(2)配置安全的 Shell
a)生成 RSA 和 DSA 金鑰
在每個節點以 oracle 使用者執行下面命令:
ls -la $HOME
mkdir ~/.ssh
chmod 700 ~/.ssh
/usr/bin/ssh-keygen -t rsa
/usr/bin/ssh-keygen -t dsa
注意:提示輸入金鑰儲存檔案和passphrase時回車
b)在授權金鑰檔案中新增金鑰在節點1上以 oracle 使用者執行下面命令:cd ~/.ssh
cat id_rsa.pub >>authorized_keys
cat id_dsa.pub >>authorized_keys
ls
scp authorized_keys longshi_rac02:/home/oracle/.ssh/
ssh longshi_rac02
cd .ssh
cat id_rsa.pub >> authorized_keys
cat id_dsa.pub >> authorized_keys
在節點2上以 oracle 使用者執行下面命令:
cd ~/.ssh
scp authorized_keys longshi_rac01:/home/oracle/.ssh/
(3)配置 SSH 等價使用者在每個節點上以 oracle 使用者執行下面命令:exec /usr/bin/ssh-agent $SHELL
/usr/bin/ssh-add
在每個節點以 oracle 使用者執行下面命令:
ssh longshi_rac01 date
ssh longshi_rac02 date
4. 準備作業系統和軟體
(1)在兩個節點上設定時間
兩個節點指向同一個NTP Server,NTP配置參考
http://wxy0327.itpub.net/post/16888/291676

(2)配置核心引數在每個節點以 root 使用者執行以下操作:
編輯/etc/sysctl.conf檔案,在檔案尾新增內容:
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 2147483648
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=1048576
net.core.rmem_max=1048576
net.core.wmem_default=262144
net.core.wmem_max=262144
執行以下命令:
sysctl -p(3)配置Shell對Oracle使用者的限制在每個節點以 root 使用者執行以下操作:
編輯/etc/security/limits.conf檔案,在檔案尾新增內容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
編輯/etc/pam.d/login檔案,在檔案尾新增內容:
session required /lib/security/pam_limits.so5. 配置安裝路徑和共享儲存
(1)決定共享儲存方案
專案 儲存系統 儲存位置
Clusterware ext3 本地磁碟
OCR RAW Device 共享磁碟
Voting disk RAW Device 共享磁碟
資料庫軟體 ext3 本地磁碟
資料庫 ASM 共享磁碟
恢復檔案 ASM 共享磁碟
(2)配置裸裝置及分割槽在節點1上以 root 使用者執行下面命令:/sbin/fdisk -l
/sbin/fdisk /dev/sdb
p -> n -> p -> 1 -> 回車 -> +1000M -> n -> p -> 2 -> 回車 -> +1000M -> n-> p -> 3 -> 回車 -> +200000M -> w

在每個節點上以 root 使用者執行下面操作:
/usr/bin/raw -qa編輯檔案/etc/sysconfig/rawdevices,在檔案尾新增內容:#OCR Devices
/dev/raw/raw1 /dev/sdb1
#Voting Disk Devices
/dev/raw/raw2 /dev/sdb2

在每個節點上以 root 使用者執行下面命令
# 編輯 /etc/rc.d/rc.local 在檔案末尾前加入以下內容
/bin/chown root:oinstall /dev/raw/raw1
/bin/chown oracle:oinstall /dev/raw/raw2
/bin/chmod 660 /dev/raw/raw1
/bin/chmod 660 /dev/raw/raw2

重啟裸裝置服務
/sbin/service rawdevices restart
重啟兩個節點
reboot
在每個節點上以 root 使用者執行下面命令安裝 ASM 驅動軟體包
rpm -Uvh oracleasm-support-2.0.3-1.i386.rpm
rpm -Uvh oracleasm-2.6.9-42.EL-2.0.3-1.i686.rpm
rpm -Uvh oracleasm-2.6.9-42.ELhugemem-2.0.3-1.i686.rpm
rpm -Uvh oracleasm-2.6.9-42.ELsmp-2.0.3-1.i686.rpm
rpm -Uvh oracleasmlib-2.0.2-1.i386.rpm
檢查 ASM 驅動軟體包:
rpm -q oracleasm-support oracleasm-2.6.9-42.EL oracleasm-2.6.9-42.ELhugemem oracleasm-2.6.9-42.ELsmp oracleasmlib/etc/init.d/oracleasm configureDefault user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Fix permissions of Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: [ OK ]
Loading module "oracleasm": [ OK ]
Mounting ASMlib driver filesystem: [ OK ]
Scanning system for ASM disks: [ OK ]

在節點1上以 root 使用者執行下面命令:
/etc/init.d/oracleasm createdisk DISK1 /dev/sdb3
在每個節點上以 root 使用者執行下面命令:
/etc/init.d/oracleasm scandisks

chkconfig --level 345 rawdevices on
建立新檔案
/etc/udev/permissions.d/oracle.permissions
內容如下:
# OCR
raw/raw1:root:oinstall:0660
# Voting Disks
raw/raw2:oracle:oinstall:0660
(3)選擇 Oracle Base 目錄和 Oracle Clusterware 主目錄在每個節點上以 root 使用者執行下面命令:mkdir -p /opt/oracle/10gR2
mkdir -p /opt/oracle/crs
chown -R oracle:oinstall /opt/oracle/10gR2 /opt/oracle/crs

重啟兩個節點
reboot
驗證 ASM DISK,在每個節點上以 root 使用者執行下面命令:
/etc/init.d/oracleasm listdisks
ls -l /dev/oracleasm/disks/

二、安裝並配置 Oracle Clusterware 和 Oracle RAC
1. 準備 Oracle 介質安裝檔案
在節點1上以 root 使用者執行下面操作:
mkdir -p /stage/oracle/10.2.0/db
mkdir -p /stage/oracle/10.2.0/crs
cp 10201_clusterware_linux32.zip /stage/oracle/10.2.0/crs
cp oralinux102.zip /stage/oracle/10.2.0/db
cd /stage/oracle/10.2.0/db
unzip oralinux102.zip
cd /stage/oracle/10.2.0/crs
unzip 10201_clusterware_linux32.zip
chown -R oracle:oinstall /stage/oracle/10.2.0/db /stage/oracle/10.2.0/crs
chmod -R 777 /stage/oracle/10.2.0/db /stage/oracle/10.2.0/crs
2. 安裝 Oracle Clusterware 10g(1)配置作業系統環境
在所有節點上以 oracle 使用者執行下面命令:
cd $HOME
vi .bash_profile
新增內容如下:
export ORACLE_SID=sms
export ORACLE_BASE=/opt/oracle/10gR2
export ORACLE_HOME=/opt/oracle/crs
export PATH=$PATH:$ORACLE_HOME/bin
執行下面命令使設定生效:
source .bash_profile(2)使用 CVU 驗證配置在節點1上以 root 使用者執行下面操作:chmod -R 777 /tmp/在節點1上以 oracle 使用者執行下面操作:

利用 CVU 檢查 CRS 的安裝前任務
cd /stage/oracle/10.2.0/crs/clusterware/cluvfy
./runcluvfy.sh stage -pre crsinst -n longshi_rac01,longshi_rac02 -verbose
/************************************* 有可以忽略的錯誤 *************************************/檢視 CVU 報告。注意,報告中幾個可以忽略的錯誤。

第一個錯誤有關“oinstall”組 [作為基本組] 中的使用者“oracle”的成員資格。考慮到本文的目的,“oracle”使用者帳戶只能分配給“dba”組,因此可以忽略該錯誤,沒什麼問題。

第二個錯誤與為 VIP 查詢一組適合的介面有關。這是 Metalink 說明 338924.1 中的一個錯誤檔案:

Suitable interfaces for the private interconnect on subnet "192.168.2.0":
linux2 eth1:192.168.2.101
linux1 eth1:192.168.2.100

ERROR:
Could not find a suitable set of interfaces for VIPs.

Result: Node connectivity check failed.
如說明中所述,可以忽略該錯誤,沒什麼問題。

最後一組可忽略的錯誤與處理 RHEL4 Update 4 中不存在的特定 RPM 程式包版本有關。例如:


compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128

這些特定的程式包在 CVU 報告中列為缺少,請確保在叢集中的兩個 Oracle RAC 節點上安裝了正確版本的 compat-* 程式包。例如,在 RHEL4 Update 4 中,這些程式包應為:


compat-gcc-32-3.2.3-47.3
compat-gcc-32-c++-3.2.3-47.3
compat-libstdc++-33-3.2.3-47.3
/************************************* 有可以忽略的錯誤 *************************************/
利用 CVU 檢查硬體和作業系統設定
cd /stage/oracle/10.2.0/crs/clusterware/cluvfy
./runcluvfy.sh stage -post hwos -n longshi_rac01,longshi_rac02 -verbose
/************************************* 有可以忽略的錯誤 *************************************/檢視 CVU 報告。與之前的檢查(CRS 的安裝前任務)一樣,為 VIP 查詢一組合適的介面將失敗,可將其忽略,沒什麼問題。

另請注意,檢查共享儲存可訪問性將失敗。

Checking shared storage accessibility...

WARNING:
Unable to determine the sharedness of /dev/sde on nodes:
linux2,linux2,linux2,linux2,linux2,linux1,linux1,linux1,linux1,linux1


Shared storage check failed on nodes "linux2,linux1".
該警告也可忽略,沒什麼問題。雖然我們知道這些磁碟可見並在叢集中的兩個 Oracle RAC 節點中共享,但本身將失敗。導致該錯誤的若干原因已得到證明。第一個原因來自 Metalink,指出 cluvfy 當前沒有使用 SCSI 裝置之外的其他裝置。這將包括裝置(如 EMC PowerPath)和卷組(如 Openfiler 中的卷組)。截至本文撰寫之日,除了使用手動方法檢測共享裝置外沒有其他解決方法。該錯誤的另一個原因由 Oracle Corporation 的 Bane Radulovic 提出。他的研究表明,CVU 在 Linux 上呼叫 smartclt 時,smartclt 不會從 iSCSI 裝置返回序列號。例如,針對 /dev/sde 進行的檢查顯示:

# /usr/sbin/smartctl -i /dev/sde
smartctl version 5.33 [i686-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: Openfile Virtual disk Version: 0
Serial number:
Device type: disk
Local Time is: Wed Oct 25 23:41:20 2006 EDT
Device supports SMART and is Disabled
Temperature Warning Disabled or Not Supported
截至本文撰寫之日,我們還不知道 Openfiler 開發人員是否打算對此進行修復。
/************************************* 有可以忽略的錯誤 *************************************/(3)使用 OUI 安裝 Oracle Clusterware在節點1上以 oracle 使用者執行下面操作:cd /stage/oracle/10.2.0/crs/clusterware
./runInstaller
歡迎視窗 -> next
Specify Inventory directory and credentials 輸入 /opt/oracle/10gR2/oraInventory -> next
Home Detail 選擇 /opt/oracle/crs -> next
Product-Specific Prerequisite Checks -> next
Specify Cluster Configuration
Edit節點1
Public Node Name:longshi_rac01
Private Node Name:longshi_rac01-priv
Virtual Host Name:longshi_rac01-vip
Add節點2
Public Node Name:longshi_rac02
Private Node Name:longshi_rac02-priv
Virtual Host Name:longshi_rac02-vip
-> next -> eth0 Interface Type 選擇 Public;eth1 Interface Type 選擇 Private
-> next
Specify Oracle Cluster Registry(OCR)Location
選擇 External Redundancy
Specify OCR Location:/dev/raw/raw1 -> next
選擇 External Redundancy
Voting Disk Location:/dev/raw/raw2 -> next
-> Install
Execute Configuration scripts
在節點以上1上以 oracle 使用者執行以下命令:
cd /opt/oracle/10gR2/oraInventory
su
./orainstRoot.sh
執行完畢後,在節點以上2上以 root 使用者執行以下命令:
ssh longshi_rac02
cd /opt/oracle/10gR2/oraInventory
./orainstRoot.sh
執行完畢後,在節點以上1上以 root 使用者執行以下命令:
cd /opt/oracle/crs
./root.sh
# 這步執行時間較長
執行完畢後,在節點以上2上以 root 使用者執行以下命令:
cd /opt/oracle/crs
./root.sh
/************************************* 嚴重錯誤 *************************************/您在所有節點上執行 root.sh 時將收到多個警告。可以忽略這些警告,沒什麼問題。

可能需要等一會兒才會執行 root.sh。在最後一個節點上執行 root.sh 時,您將收到一個嚴重錯誤,其輸出如下所示:

...
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
linux1
linux2
CSS is active on all nodes.
Waiting for the Oracle CRSD and EVMD to start
Oracle CRS stack installed and running under init(1M)
Running vipca(silent) for configuring nodeapps
The given interface(s), "eth0" is not public.Public interfaces should be used to configure virtual IPs.
此問題為 Oracle 10.2.0.1(Metalink 文章 338924.1 中有說明)所特有,需要在繼續操作之前將其解決。最簡單的變通方法是從出現錯誤的上一個節點中以 root 使用者的身份手動重新執行 vipca (GUI)。請記住,vipca 是一個 GUI,需要根據您的 X 伺服器設定 DISPLAY 變數:

# $ORA_CRS_HOME/bin/vipca

出現“VIP Configuration Assistant”時,我按如下所示回應螢幕提示:

Welcome: 單擊 Next
Network interfaces: 選擇兩個介面 — eth0 和 eth1
Virtual IPs for cluster notes:
Node Name: linux1
IP Alias Name: linux1-vip
IP Address: 192.168.1.200
Subnet Mask: 255.255.255.0


Node Name: linux2
IP Alias Name: linux2-vip
IP Address: 192.168.1.201
Subnet Mask: 255.255.255.0


Summary: 單擊 Finish
Configuration Assistant Progress Dialog: 配置完成後單擊 OK。
Configuration Results: 單擊 Exit
/************************************* 嚴重錯誤 *************************************/-> OK -> Exit(4)完成 Oracle Clusterware 配置在節點1上以 oracle 使用者執行下面操作:/opt/oracle/crs/bin/./crs_stat -t
在每個節點上以 oracle 使用者執行下面命令:
# 檢查叢集節點
/opt/oracle/crs/bin/olsnodes -n# 檢查 Oracle 叢集件自動啟動指令碼ls -l /etc/init.d/init.*3. 在一個 ASM 主目錄中配置 ASM在節點1上以 oracle 使用者執行下面操作:cd /stage/oracle/10.2.0/db
./runInstaller
歡迎視窗 -> next
選擇企業版 -> next
Specify Home Details
Name 輸入OraASM10g_home Path輸入/opt/oracle/10gR2/asm -> next
Specify Hardware Cluster Install Mode 選擇 Select All -> next
Product-Specific Prerequisite Checks -> next
Select Configuration Option 選擇 Configure Automatic Storage Management(ASM) 並輸入密碼 -> next
Configure Automatic Storage Management
Disk Group Name 輸入diskgroup1
Redundancy 選擇 External
Add Disks 選擇ORCL:DISK1 -> next
-> Install
Configuration Assistants -> next
Execute configuration scripts
在節點1上以 root 使用者執行下面操作:
cd /opt/oracle/10gR2/asm
su
./root.sh
執行完畢後,在節點2以 root 使用者執行以下命令:
cd /opt/oracle/10gR2/asm
./root.sh
OK -> Exit
(1)驗證 ASM 安裝在每個節點上以 oracle 使用者執行以下操作:cd /opt/oracle/crs/bin
./srvctl status asm -n longshi_rac01
# ASM 例項 +ASM1 正在節點 longshi_rac01 上執行。
./srvctl status asm -n longshi_rac02
# ASM 例項 +ASM2 正在節點 longshi_rac02 上執行。
4. 安裝 Oracle 資料庫軟體並建立一個叢集資料庫在節點1上以 oracle 使用者執行下面操作:cd /stage/oracle/10.2.0/db
./runInstaller
歡迎視窗 -> next
選擇企業版 -> next
Specify Home Details
Name 輸入OraDb10g_home Path輸入/opt/oracle/10gR2/db_1 -> next
Specify Hardware Cluster Install Mode 選擇 Select All -> next
Product-Specific Prerequisite Checks -> next
Select Configuration Option 選擇 Create a Database -> next
Database Configuration 選擇 General Purpose -> next
Database Configuration Options Global Database Name 輸入sms.longshi.com SID 輸入sms
Select Database Character set 選擇 AL32UTF8,不選擇 Create Database with sample schemas -> next
Select Database Management Option 選擇 Use Database Control for Database Management,不選擇 Enable Email Notifications -> next
Database Storage OPtion 選擇 Automatic Storage Management -> next
Specify Backup and Recovery Options 選擇 Do not enbale Automated backup -> next
Select ASM Disk Group 選擇 DISKGROUP1 -> next
Specify Databse Schema Passwords 選擇 Use the same password for all the accounts 輸入密碼 -> next
Install(安裝程式建立並配置資料庫,需要較長時間)-> OK
Execute Configuration scripts
在節點1上以 root 使用者執行下面操作:
cd /opt/oracle/10gR2/db_1
su
./root.sh
# 回答問題是回車選擇預設值
執行完畢後,在節點2上以 root 使用者執行以下命令:
cd /opt/oracle/10gR2/db_1
./root.sh
OK -> Exit
(1)驗證 Oracle RAC 資料庫安裝在每個節點上以 oracle 使用者執行下面命令:cd /opt/oracle/crs/bin
./crs_stat -t
(2)為資料庫管理配置作業系統環境,再配置使用者Shell Profile在每個節點以 oracle 使用者執行以下命令:cd $HOME
vi .bash_profile
編輯內容如下:
export ORACLE_SID=sms
export ORACLE_BASE=/opt/oracle/10gR2
export ORACLE_HOME=/opt/oracle/10gR2/db_1
export PATH=$PATH:$ORACLE_HOME/bin
執行下面命令使設定生效:
source .bash_profile
安裝後配置:
1. 網路連線
分別編輯兩個節點的 $ORACLE_HOME/network/admin/sqlnet.ora 檔案新增如下條目:
SQLNET.INBOUND_CONNECT_TIMEOUT = 60
SQLNET.RECV_TIMEOUT = 60
SQLNET.SEND_TIMEOUT = 60

分別編輯兩個節點的 $ORACLE_HOME/network/admin/listener.ora 檔案新增如下條目:
INBOUND_CONNECT_TIMEOUT_LISTENER = 60
重啟兩個節點的監聽器,分別在兩個節點上執行如下命令:
lsnrctl stop
lsnrctl start
在任一節點上執行如下命令(longshi_rac01、longshi_rac02為節點名):
srvctl start listener -n longshi_rac01
srvctl start listener -n longshi_rac02

使用預設的 tnsnames 配置,不用做任何改動。

客戶端連線:
# 本機客戶端連線
# 在任意節點上執行
sqlplus sys@sms as sysdba
# 遠端客戶端連線,修改客戶端 tnsnames.ora 檔案
# 客戶機在同一內網中,如下修改 tnsnames.ora,HOST 也可用 VIP
SMS_RAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.225)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.189)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sms.longshi.com)
)
)

# 如果有防火牆設定,外網地址對映為VIP,還要注意開放相應埠,如下修改 tnsnames.oraSMS_RAC =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 221.212.180.1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 221.212.180.2)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sms.longshi.com)
)
)

解決方案一:

在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)SQL> CONN SYS@sms1 AS SYSDBA
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)輸入口令:
****
已連線。
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)SQL
> ALTER
SYSTEM
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
2 SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.225)(PORT = 1521))'

在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
3 SID = 'sms1'
;
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)系統已更改。
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)SQL
> CONN SYS@sms2 AS
SYSDBA
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)輸入口令:
****
已連線。
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)SQL
> ALTER
SYSTEM
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
2 SET LOCAL_LISTENER = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.189)(PORT = 1521))'

在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
3 SID = 'sms2'
;
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)系統已更改。
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)
在 Red Hat Advanced Server 4 上安裝 Oracle 10.2.0.1 RAC (zt)

重啟例項、重啟監聽器

解決方案二:修改客戶端的 C:WINDOWSsystem32driversetchosts(windows)或者 /etc/hosts 檔案,新增以下條目:# 客戶端在防火牆內192.168.0.225 longshi_rac01-vip
192.168.0.189 longshi_rac02-vip

# 客戶端在防火牆外221.212.180.1 longshi_rac01
221.212.180.2 longshi_rac02


2. 修改 spfile 引數
(1)分別在各個節點上建立該節點的pfile
sqlplus sys@sms1 as sysdba
create pfile from spfile;
sqlplus sys@sms2 as sysdba
create pfile from spfile;
(2)更改各個節點的pfile中的相應引數值,儲存。注意各節點引數值要統一vi /opt/oracle/10gR2/db_1/dbs/initsms1.ora
vi /opt/oracle/10gR2/db_1/dbs/initsms2.ora
(3)分別在各個節點上建立該節點的 spfilesqlplus sys@sms1 as sysdba
create spfile from pspfile;
sqlplus sys@sms2 as sysdba
create spfile from pfile;
(4)啟動各節點,檢查更改後的引數值是否統一、正確srvctl stop instance -d sms -i sms1,sms2
srvctl start instance -d sms -i sms1,sms2
sqlplus sys@sms1 as sysdba
show parameter spfile;
sqlplus sys@sms2 as sysdba
show parameter spfile;
簡單管理:停止資料庫:srvctl stop database -d sms啟動資料庫:srvctl start database -d sms停止資料庫例項:srvctl stop instance -d sms -i sms1,sms2啟動資料庫例項:srvctl start instance -d sms -i sms1,sms2停止 ASM 例項:srvctl stop asm -n longshi_rac01啟動 ASM 例項:srvctl start asm -n longshi_rac01檢視 ASM 例項:srvctl status asm -n longshi_rac01檢視資料庫狀態:srvctl status database -d sms檢視例項狀態:srvctl status instance -d sms -i sms1,sms2刪除監聽器:crs_unregister ora.longshi_rac02.LISTENER_LONGSHI_LONGSHI_RAC02.lsnr
crs_unregister ora.longshi_rac01.LISTENER_LONGSHI_LONGSHI_RAC01.lsnr
啟動監聽器:srvctl start listener -n longshi_rac01遺留問題:1. 監聽器配置,如增加 local_listener、修改預設埠(1521)等
2. 節點重啟後 crs 服務不能自動重啟, 配置 ntp 後問題依然,只能如下手工啟動相應服務,懷疑是 bug
crs_stop -all
crs_start -all
crs_stat
crs_stop ora.longshi_rac01.gsd
crs_start ora.longshi_rac01.gsd
crs_stop ora.longshi_rac01.ASM1.asm
crs_start ora.longshi_rac01.ASM1.asm
crs_stop ora.longshi_rac01.LISTENER_LONGSHI_RAC01.lsnr
crs_start ora.longshi_rac01.LISTENER_LONGSHI_RAC01.lsnr
crs_stop ora.longshi_rac01.ons
crs_start ora.longshi_rac01.ons
crs_stop ora.sms.sms1.inst
crs_start ora.sms.sms1.inst
crs_stat -t

Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE long...ac01
ora....01.lsnr application ONLINE ONLINE long...ac01
ora....c01.gsd application ONLINE ONLINE long...ac01
ora....c01.ons application ONLINE ONLINE long...ac01
ora....c01.vip application ONLINE ONLINE long...ac01
ora....SM2.asm application ONLINE ONLINE long...ac02
ora....02.lsnr application ONLINE ONLINE long...ac02
ora....c02.gsd application ONLINE ONLINE long...ac02
ora....c02.ons application ONLINE ONLINE long...ac02
ora....c02.vip application ONLINE ONLINE long...ac02
ora.sms.db application ONLINE ONLINE long...ac01
ora....s1.inst application ONLINE ONLINE long...ac01
ora....s2.inst application ONLINE ONLINE long...ac02

# 連線資料庫sqlplus sys@sms_rac as sysdba
注意:客戶端連線到 RAC 資料庫的時候經常會出現 ORA-12545 錯誤,METALINK上指出,是Oracle的一個小bug。

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

相關文章