Solaris10下安裝Oracle1106RAC環境(四)

yangtingkun發表於2008-07-27

安裝一套RAC11G的測試環境,作業系統為Solaris 10,共享磁碟管理使用Volumn Cluster ManagerOracle版本為1106

這篇描述Oracle的建庫過程。

Solaris10下安裝Oracle1106RAC環境(一):http://yangtingkun.itpub.net/post/468/467067

Solaris10下安裝Oracle1106RAC環境(二):http://yangtingkun.itpub.net/post/468/467250

Solaris10下安裝Oracle1106RAC環境(三):http://yangtingkun.itpub.net/post/468/467251

 

 

建立資料庫之前,首先配置共享儲存裝置,配置建立資料庫所需的裸裝置:

root@newtrade1 # vxassist -g datavg make rac11g_control_1 100m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_control_2 100m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_control_3 100m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_system_1_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_sysaux_1_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_undotbs1_1_4g 4097m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_undotbs2_1_4g 4097m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_temp_1_4g 4097m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_users_1_4g 4097m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_redo1_1_1_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_redo1_2_1_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_redo1_3_1_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_redo2_2_1_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_redo2_2_2_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_redo2_2_3_1g 1025m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_pwdfile 100m user=oracle group=oinstall mode=660
root@newtrade1 # vxassist -g datavg make rac11g_spfile 100m user=oracle group=oinstall mode=660

建立一個裸裝置對映檔案:

bash-3.00$ vi rac11g_raw.conf
"rac11g_raw.conf" [New file]
control1=/dev/vx/rdsk/datavg/rac11g_control_1
control2=/dev/vx/rdsk/datavg/rac11g_control_2
control3=/dev/vx/rdsk/datavg/rac11g_control_3
system=/dev/vx/rdsk/datavg/rac11g_system_1_1g
sysaux=/dev/vx/rdsk/datavg/rac11g_sysaux_1_1g
undotbs1=/dev/vx/rdsk/datavg/rac11g_undotbs1_1_4g
undotbs2=/dev/vx/rdsk/datavg/rac11g_undotbs2_1_4g
temp=/dev/vx/rdsk/datavg/rac11g_temp_1_4g
users=/dev/vx/rdsk/datavg/rac11g_users_1_4g
redo1_1=/dev/vx/rdsk/datavg/rac11g_redo1_1_1_1g
redo1_2=/dev/vx/rdsk/datavg/rac11g_redo1_2_1_1g
redo1_3=/dev/vx/rdsk/datavg/rac11g_redo1_3_1_1g
redo2_1=/dev/vx/rdsk/datavg/rac11g_redo2_2_1_1g
redo2_2=/dev/vx/rdsk/datavg/rac11g_redo2_2_2_1g
redo2_3=/dev/vx/rdsk/datavg/rac11g_redo2_2_3_1g
pwdfile=/dev/vx/rdsk/datavg/rac11g_pwdfile
spfile=/dev/vx/rdsk/datavg/rac11g_spfile

下面透過dbca來建立資料庫。

首先選擇ORACLE RAC CLUSTER DATABASE,選擇建立資料庫,將兩個節點全部選中。

GLOBAL DTABASE NAME處輸入rac11g.us.oracle.com

檔案系統選擇裸裝置,並在這裡輸入上面對映檔案的地址和名稱:/export/home/oracle/rac11g_raw.conf

選擇歸檔,指定歸檔路徑:/data/oracle/oradata/rac11g/archivelog/

由於選擇了裸裝置方式,這裡就沒有設定FLASH RECOVERY AREA,如果願意,可以考慮啟動一個ASM專門用來設定FLASH_RECOVERY_AREA和歸檔。

下面就是一些基本的初始化引數的設定,包括MEMORY_TARGETDB_BLOCK_SIZE已經資料庫字符集的設定。

選擇使用SPFILE,檢查SPFILE路徑處是否已經自動輸入了裸裝置對映檔案中對應的值:/dev/vx/rdsk/datavg/rac11g_spfile,如果這裡的顯示正確,說明裸裝置對映檔案已經正常工作,否則裸裝置對映檔案可能存在錯誤。

下面是安全性設定,這是11g新增的功能,如果這裡選擇Oracle推薦的11g預設安全設定,就會啟用審計,而且採用新的密碼策略。包括類似密碼的大小寫敏感等設定。如果選擇阻止預設安全性設定,Oracle還允許使用者選擇阻止審計功能還是阻止新的密碼策略,或者全部組織。

下面也是11g的增強,可以啟用自動維護視窗。其實從10g的就有這個功能,不過在11g中可以在安裝的時候進行設定了。

最後設定檔案屬性,透過指定裸裝置對映檔案之後,Oracle可以自動找到表空間、控制檔案和日誌檔案對應的裸裝置。這裡只需要檢查一下是否正確的設定即可。不過Oracle不會根據裸裝置的大小設定表空間和檔案的大小,因此這裡需要根據裸裝置來調整各個檔案的大小。

最後建立模板、建庫指令碼並建立資料庫。

由於在使用DBCA之前沒有建立監聽,DBCA會提示下面的資訊:

Failed to retrieve network listener resources required for the Real Application Clusters high availability extensions configurations on the following nodes:[newtrade1, newtrade2].

Do you want listeners on port 1521 with prefix LISTENER to be created on nodes [newtrade1, newtrade2] automatically? If you world like to configure the listener with differenct properties, run NetCA before continuing.

點選NEXT,允許自動建立監聽。

由於RAC環境的特殊性,兩個節點上已經自動建立了本地TNSNAMES.ORA,內容如下:

RAC11G2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = newtrade2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac11g.us.oracle.com)
      (INSTANCE_NAME = rac11g2)
    )
  )

RAC11G1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = newtrade1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac11g.us.oracle.com)
      (INSTANCE_NAME = rac11g1)
    )
  )

LISTENERS_RAC11G =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = newtrade1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = newtrade2-vip)(PORT = 1521))
  )

RAC11G =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = newtrade1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = newtrade2-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac11g.us.oracle.com)
    )
  )

如果不需要進行其他額外的設定,資料庫的安裝就結束了。

最後登陸資料庫:

bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期一 7 14 15:20:53 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> SET PAGES 100 LINES 120
SQL> SELECT NAME FROM V$DATABASE;

NAME
---------
RAC11G

SQL> SELECT INSTANCE_NUMBER, INSTANCE_NAME, HOST_NAME FROM V$INSTANCE;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME
--------------- ---------------- --------------------------------------------
              1 rac11g1          newtrade1

SQL> SELECT INSTANCE_NUMBER, INSTANCE_NAME, HOST_NAME FROM GV$INSTANCE;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME
--------------- ---------------- --------------------------------------------
              1 rac11g1          newtrade1
              2 rac11g2          newtrade2

SQL> DISC
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
斷開

SQL> SET INSTANCE rac11g2
Oracle Database 11g Release 11.1.0.0.0 - Production
SQL> CONN SYS AS SYSDBA
輸入口令:
已連線。

SQL> SELECT NAME FROM V$DATABASE;

NAME
---------
RAC11G

SQL> SELECT INSTANCE_NUMBER, INSTANCE_NAME, HOST_NAME FROM V$INSTANCE;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME
--------------- ---------------- --------------------------------------------
              2 rac11g2          newtrade2

至此,所有安裝工作結束。

 

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

相關文章