前置的 Grid 與 ASM 準備完成後,接下來就是安裝 Database 軟體並建立資料庫。以下依序記錄安裝、root 腳本執行、dbca 建庫、狀態檢查與登入驗證的整個流程。
先以 root 關閉圖形介面的存取控制,再切換成 oracle 使用者啟動安裝程式:
[root@rac10g01 ~]# xhost + access control disabled, clients can connect from any host [root@rac10g01 ~]# su - oracle [oracle@rac10g01 ~]$ cd database/ [oracle@rac10g01 database]$ ./runInstaller
安裝精靈結束後,必須在兩個節點各跑一次 root 腳本,否則 RAC 無法正常運作。
rac10g01 節點:
[root@rac10g01 ~]# sh /u01/oracle/product/10.2.0.1/db_1/root.sh Running Oracle10 root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/oracle/product/10.2.0.1/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Finished running generic part of root.sh script. Now product-specific root actions will be performed.
rac10g02 節點:
[root@rac10g02 ~]# sh /u01/oracle/product/10.2.0.1/db_1/root.sh Running Oracle10 root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/oracle/product/10.2.0.1/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Finished running generic part of root.sh script. Now product-specific root actions will be performed.
以 oracle 身分啟動 Database Configuration Assistant:
[oracle@rac10g01 database]$ dbca
精靈中要特別留意兩點:資料庫類型選擇 Real Application Clusters,並確認兩個節點都被勾選;儲存配置使用先前準備好的 ASM 磁碟群組。
兩個節點都執行
crs_stat -t,重點是每一項資源的 Target 與 State 都要是 ONLINE:
[oracle@rac10g01 ~]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora.rac10g.db application ONLINE ONLINE rac10g02 ora....c10g.cs application ONLINE ONLINE rac10g02 ora....0g1.srv application ONLINE ONLINE rac10g01 ora....0g2.srv application ONLINE ONLINE rac10g02 ora....g1.inst application ONLINE ONLINE rac10g01 ora....g2.inst application ONLINE ONLINE rac10g02 ora....SM1.asm application ONLINE ONLINE rac10g01 ora....01.lsnr application ONLINE ONLINE rac10g01 ora....g01.gsd application ONLINE ONLINE rac10g01 ora....g01.ons application ONLINE ONLINE rac10g01 ora....g01.vip application ONLINE ONLINE rac10g01 ora....SM2.asm application ONLINE ONLINE rac10g02 ora....02.lsnr application ONLINE ONLINE rac10g02 ora....g02.gsd application ONLINE ONLINE rac10g02 ora....g02.ons application ONLINE ONLINE rac10g02 ora....g02.vip application ONLINE ONLINE rac10g02
rac10g02 節點輸出內容相同,代表兩邊資源都已就位。
[oracle@rac10g01 ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.1.0 - Production on Sun Nov 13 21:29:15 2016 Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP and Data Mining options SQL> select * from dual; D - X SQL> select inst_id,name from gv$database; INST_ID NAME ---------- --------- 2 RAC10G 1 RAC10G
從
gv$database能看到兩個 instance 編號,RAC 建置即告完成。
本文出自「一起走過的日子」部落格,請務必保留此出處 https://tongcheng.blog.51cto.com/6214144/1872299