一、RAC One Node介紹 1、rac one node數(shù)據(jù)庫可以轉(zhuǎn)換成RAC數(shù)據(jù)庫,轉(zhuǎn)換過程可以在線,無需停止RAC one node數(shù)據(jù)庫; 2、rac one node可以創(chuàng)建多個rac onde node數(shù)據(jù)庫運行在不同的節(jié)點上; 3、當運行節(jié)點需要維護,如打patch,可以手動切換(relocate)使用online database relocate,減少業(yè)務中斷時間; 4、rac one node比RAC數(shù)據(jù)庫減少了節(jié)點間數(shù)據(jù)傳輸時間以及GC類的等待事件; 5、從11.2.0.1開始就有了rac one node特性,但僅僅支持linux平臺,在11.2.0.2以后支持所有平臺; 參考文檔:Oracle RACOne Node -- Changes in 11.2.0.2 (文檔 ID 1232802.1)? 二、使用DBCA創(chuàng)建RAC One Node [oracle@jzh2 ~]$ dbca 2.1 選擇"Oracle RAC One Node database"
后面創(chuàng)建數(shù)據(jù)庫與創(chuàng)建RAC數(shù)據(jù)庫基本一致,過程省略。。。。。 2.2、RAC one數(shù)據(jù)庫基本信息 $ srvctl config database -d jzh Database unique name: jzh Database name: jzh Oracle home: /u01/app/oracle/product/11.2.0/db_1 Oracle user: oracle Spfile: +DATA/jzh/spfilejzh.ora Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: jzh Database instances: Disk Groups: DATA,ARCH Mount point paths: Services: jzhdb==============》新建的Service Type: RACOneNode===========》數(shù)據(jù)庫類型是 one node Online relocation timeout: 30 Instance name prefix: jzh Candidate servers: jzh2,jzh3 Database is administrator managed 2.3、數(shù)據(jù)庫配置信息 SQL> show parameter name NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_file_name_convert string db_name string jzh db_unique_name string jzh global_names boolean FALSE instance_name string jzh_1==========》實例名,在RAC數(shù)據(jù)庫中實例一般為jzh2,而在RAC One Node中多了"_"。 lock_name_space string log_file_name_convert string processor_group_name string service_names string jzhdb 2.4、集群信息 SQL> show parameter cluster_database NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ cluster_database boolean TRUE cluster_database_instances integer 2 2.5、RAC One Node切換(relocate) 查詢當前實例運行情況: $ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ARCH.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.DATA.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.LISTENER.lsnr ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.VOTE.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.asm ONLINE ONLINE jzh2 Started ONLINE ONLINE jzh3 Started ora.gsd OFFLINE OFFLINE jzh2 OFFLINE OFFLINE jzh3 ora.net1.network ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.ons ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE jzh3 ora.cvu 1 OFFLINE OFFLINE ora.jzh.db 1 ONLINE ONLINE jzh2 Open ora.jzh.jzhdb.svc 1 ONLINE ONLINE jzh2 ora.jzh2.vip 1 ONLINE ONLINE jzh2 ora.jzh3.vip 1 ONLINE ONLINE jzh3 ora.oc4j 1 ONLINE ONLINE jzh3 ora.scan1.vip 1 ONLINE ONLINE jzh3 數(shù)據(jù)庫與service均運行在節(jié)點1上(jzh2) 2.6、使用relocate將RAC One Node數(shù)據(jù)庫切到節(jié)點2上(jzh3) $ srvctl relocate database -d jzh -n jzh3 relocate之后,再次查詢RAC One Node運行情況: $ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ARCH.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.DATA.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.LISTENER.lsnr ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.VOTE.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.asm ONLINE ONLINE jzh2 Started ONLINE ONLINE jzh3 Started ora.gsd OFFLINE OFFLINE jzh2 OFFLINE OFFLINE jzh3 ora.net1.network ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.ons ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE jzh3 ora.cvu 1 OFFLINE OFFLINE ora.jzh.db 2 ONLINE ONLINE jzh3 Open ora.jzh.jzhdb.svc 1 ONLINE ONLINE jzh3 ora.jzh2.vip 1 ONLINE ONLINE jzh2 ora.jzh3.vip 1 ONLINE ONLINE jzh3 ora.oc4j 1 ONLINE ONLINE jzh3 ora.scan1.vip 1 ONLINE ONLINE jzh3 此時,數(shù)據(jù)庫與service切換至節(jié)點2上(jzh3)。 2.7、查看數(shù)據(jù)庫配置信息 [grid@jzh2 ~]$ srvctl config service -d jzh Service name: jzhdb Service is enabled Server pool: jzh Cardinality: 1 Disconnect: false Service role: PRIMARY Management policy: AUTOMATIC DTP transaction: false AQ HA notifications: false Failover type: NONE Failover method: NONE TAF failover retries: 0 TAF failover delay: 0 Connection Load Balancing Goal: LONG Runtime Load Balancing Goal: NONE TAF policy specification: BASIC Edition: Preferred instances: jzh_2 Available instances: 2.8 轉(zhuǎn)換RAC One Node至RAC 注:以RAC One Node database擁有者執(zhí)行以下命令: $ su - oracle $ srvctl convert database -d jzh -c RAC -n jzh2 $ srvctl config database -d jzh Database unique name: jzh Database name: jzh Oracle home: /u01/app/oracle/product/11.2.0/db_1 Oracle user: oracle Spfile: +DATA/jzh/spfilejzh.ora Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: jzh Database instances: jzh_1 Disk Groups: DATA,ARCH Mount point paths: Services: jzhdb Type: RAC Database is administrator managed 我們可以看到Type類型變成RAC了。 2.9、添加節(jié)點2(jzh3)實例 $ srvctl add instance -d jzh -i jzh_2 -n jzh3 $ srvctl config database -d jzh Database unique name: jzh Database name: jzh Oracle home: /u01/app/oracle/product/11.2.0/db_1 Oracle user: oracle Spfile: +DATA/jzh/spfilejzh.ora Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: jzh Database instances: jzh_1,jzh_2 Disk Groups: DATA,ARCH Mount point paths: Services: jzhdb Type: RAC Database is administrator managed 這里我們看到jzh_2添加進來了。 $ srvctl start database -d jzh $ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ARCH.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.DATA.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.LISTENER.lsnr ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.VOTE.dg ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.asm ONLINE ONLINE jzh2 Started ONLINE ONLINE jzh3 Started ora.gsd OFFLINE OFFLINE jzh2 OFFLINE OFFLINE jzh3 ora.net1.network ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 ora.ons ONLINE ONLINE jzh2 ONLINE ONLINE jzh3 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE jzh3 ora.cvu 1 OFFLINE OFFLINE ora.jzh.db 1 ONLINE ONLINE jzh2 Open 2 ONLINE ONLINE jzh3 Open ora.jzh.jzhdb.svc 1 ONLINE ONLINE jzh2 ora.jzh2.vip 1 ONLINE ONLINE jzh2 ora.jzh3.vip 1 ONLINE ONLINE jzh3 ora.oc4j 1 ONLINE ONLINE jzh3 ora.scan1.vip 1 ONLINE ONLINE jzh3 這里可以看到DB運行在jzh2,jzh3上。 2.10、重新配置服務 $ srvctl stop service -d jzh -s jzhdb $ srvctl remove service -d jzh -s jzhdb $ srvctl add service -d jzh -s jzhdb -r jzh_1,jzh_2 -P BASIC $ srvctl start service -d jzh -s jzhdb 至此,RAC One Node配置完成!