Oracle10203RAC環境新增新節點(四)

yangtingkun發表於2009-11-18

簡單描述一下,在Oracle 10203 for Solaris sparcRAC雙節點環境中,新增一個節點的過程。共享儲存已經在第三個節點上配置完成,這裡主要介紹作業系統上和Oracle上的配置。

這一篇新增一個新節點上的資料庫例項。

Oracle10203RAC環境新增新節點(一):http://yangtingkun.itpub.net/post/468/493738

Oracle10203RAC環境新增新節點(二):http://yangtingkun.itpub.net/post/468/493764

Oracle10203RAC環境新增新節點(三):http://yangtingkun.itpub.net/post/468/493811

 

 

首先確保資料庫處於啟動狀態,如果資料庫沒有啟動:

bash-2.03$ srvctl start inst -d testrac -i testrac1
bash-2.03$ srvctl start inst -d testrac -i testrac2

確保監聽處於啟動狀態,如果沒有啟動,使用lsnrctl start啟動監聽:

bash-2.03$ lsnrctl start

LSNRCTL for Solaris: Version 10.2.0.3.0 - Production on 01-2 -2009 00:22:24

Copyright (c) 1991, 2006, Oracle.  All rights reserved.

啟動/data/oracle/product/10.2/database/bin/tnslsnr: 請稍候...

TNSLSNR for Solaris: Version 10.2.0.3.0 - Production
系統引數檔案為/data/oracle/product/10.2/database/network/admin/listener.ora
寫入/data/oracle/product/10.2/database/network/log/listener.log的日誌資訊
監聽: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.25.198.225)(PORT=1521)))
監聽: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

正在連線到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.25.198.225)(PORT=1521)))
LISTENER
STATUS
------------------------
別名                      LISTENER
版本                      TNSLSNR for Solaris: Version 10.2.0.3.0 - Production
啟動日期                  01-2 -2009 00:22:26
正常執行時間              0 0 小時 0 0
跟蹤級別                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
監聽程式引數檔案          /data/oracle/product/10.2/database/network/admin/listener.ora
監聽程式日誌檔案          /data/oracle/product/10.2/database/network/log/listener.log
監聽端點概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.25.198.225)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
服務摘要..
服務 "PLSExtProc" 包含 1 個例程。
 
例程 "PLSExtProc", 狀態 UNKNOWN, 包含此服務的 1 個處理程式...
服務 "testrac" 包含 1 個例程。
 
例程 "testrac2", 狀態 UNKNOWN, 包含此服務的 1 個處理程式...
命令執行成功

對於新節點而言,可以首先通過NETCA來配置監聽程式:

$ netca

Oracle Net Services Configuration:

首先選擇Cluster Configuration,然後選擇全表3個節點,選擇Listener Configuration,選擇ADD,輸入監聽名稱。

在圖形介面環境下執行DBCA新增例項報錯,由於DBCA對於ASM的支援存在問題,只能選擇手工新增例項:

首先建立UNDOTBS3表空間,以及THREAD3對應的REDO.LOG的方法:

SQL> select group#, thread#, sequence#, bytes/1024/1024
  2  from v$log;

    GROUP#    THREAD#  SEQUENCE# BYTES/1024/1024
---------- ---------- ---------- ---------------
         1          1       1716             512
         2          1       1717             512
         3          2        839             512
         4          2        840             512

SQL> select member from v$logfile;

MEMBER
---------------------------------------------------
+DISK/testrac/onlinelog/group_1.258.633485433
+DISK/testrac/onlinelog/group_2.260.633485441
+DISK/testrac/onlinelog/group_3.268.633485447
+DISK/testrac/onlinelog/group_4.270.633485455

下面手工新增THREAD 3對應的REDO.LOG

SQL> alter database add logfile thread 3 group 5 '+DISK/testrac/onlinelog/redo5.log' size 512m;

資料庫已更改。

SQL> alter database add logfile thread 3 group 6 '+DISK/testrac/onlinelog/redo6.log' size 512m;

資料庫已更改。

SQL> select group#, thread#, sequence#, bytes/1024/1024
  2  from v$log;

    GROUP#    THREAD#  SEQUENCE# BYTES/1024/1024
---------- ---------- ---------- ---------------
         1          1       1716             512
         2          1       1717             512
         3          2        839             512
         4          2        840             512
         5          3          0             512
         6          3          0             512

已選擇6行。

SQL> select member from v$logfile;

MEMBER
----------------------------------------------------------------
+DISK/testrac/onlinelog/group_1.258.633485433
+DISK/testrac/onlinelog/group_2.260.633485441
+DISK/testrac/onlinelog/group_3.268.633485447
+DISK/testrac/onlinelog/group_4.270.633485455
+DISK/testrac/onlinelog/redo5.log
+DISK/testrac/onlinelog/redo6.log

已選擇6行。

接著新增UNDOTBS3表空間:

SQL> select file_name from dba_data_files
  2  where tablespace_name like 'UNDOTBS_';

FILE_NAME
----------------------------------------------------------------------
+DISK/testrac/datafile/undotbs1.263.618591197
+DISK/testrac/datafile/undotbs2.266.618591249

SQL> create undo tablespace undotbs3
  2  datafile '+DISK/testrac/datafile/undotbs3.dbf' size 4096m;

表空間已建立。

檢查資料庫的SPFILE配置:

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DISK/testrac/spfiletestrac.ora

由於系統使用的是SPFILE,下面直接修改必要的初始化引數值:

SQL> alter system set cluster_database_instances = 3 scope = spfile;

系統已更改。

SQL> alter system set instance_number = 3 scope = spfile sid = 'testrac3';

系統已更改。

SQL> alter system set local_listener =
  2  '(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.198.227)(PORT = 1521))'
  3  scope = spfile sid = 'testrac3';

系統已更改。

SQL> alter system set thread = 3 scope = spfile sid = 'testrac3';

系統已更改。

SQL> alter system set undo_tablespace = 'UNDOTBS3' scope = spfile sid = 'testrac3';

系統已更改。

下面重啟資料庫的例項,使得資料庫載入新的SPFILE

bash-2.03$ srvctl stop db -d testrac
bash-2.03$ srvctl start inst -d testrac -i testrac1
bash-2.03$ srvctl start inst -d testrac -i testrac2

登陸例項1的節點,ENABLE THREAD 3

SQL> alter database enable thread 3;

資料庫已更改。

在新增節點上編輯PFILE檔案,指向SPFILE檔案:

bash-3.00$ cd $ORACLE_HOME
bash-3.00$ cd dbs
bash-3.00$ vi inittestrac3.ora
spfile='+DISK/testrac/spfiletestrac.ora'

生成密碼檔案:

bash-3.00$ orapwd file=orapwtestrac3 password=password

建立adumpbdumpudumpcdump目錄:

bash-3.00$ cd $ORACLE_BASE/admin
bash-3.00$ ls -l
total 2
drwxr-xr-x   7 oracle   oinstall     512 Jul  1 17:37 +ASM
bash-3.00$ mkdir testrac
bash-3.00$ cd testrac
bash-3.00$ mkdir bdump cdump adump udump

下面就可以登陸sqlplus並啟動新例項了:

bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 10.2.0.3.0 - Production on 星期五 4 3 15:06:35 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

已連線到空閒例程。

SQL> startup
ORACLE
例程已經啟動。

Total System Global Area 2147483648 bytes
Fixed Size                  2031480 bytes
Variable Size             503316616 bytes
Database Buffers         1627389952 bytes
Redo Buffers               14745600 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> select inst_id, instance_number, instance_name
  2  from gv$instance;

   INST_ID INSTANCE_NUMBER INSTANCE_NAME
---------- --------------- ----------------
         3               3 testrac3
         2               2 testrac2
         1               1 testrac1

SQL> select instance_name, status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
testrac3         OPEN

隨後還需要將手工新增的例項資訊加到srvctl工具中:

$ srvctl add instance -d testrac -i testrac3 -n racnode3
$ srvctl modify instance -d testrac -i testrac3 -s +ASM3

至此,新增例項的操作完成。

還需要修改三個節點上的tnsnames.ora檔案,確保通過TESTRAC的訪問在3個例項上根據負載均衡的機制進行連線。

TESTRAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = racnode3-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = testrac)
      (FAILOVER_MODE =
        (TYPE = SELECT)
        (METHOD = BASIC)
        (RETRIES = 180)
        (DELAY = 5)
      )
    )
  )

比如配置TESTRAC服務名如上所示,下面連線資料庫:

SQL> conn test/test@testrac
已連線。
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
testrac3

SQL> host
$ sqlplus test/test@testrac

SQL*Plus: Release 10.2.0.3.0 - Production on 星期四 4 9 14:56:34 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


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

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
testrac1

SQL> host
$ sqlplus test/test@testrac

SQL*Plus: Release 10.2.0.3.0 - Production on 星期四 4 9 14:56:46 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


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

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
testrac2

 

 

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

相關文章