一、RAC One Node介绍
1、rac one node数据库可以转换成RAC数据库,转换过程可以在线,无需停止RAC one node数据库;
2、rac one node可以创建多个rac onde node数据库运行在不同的节点上;
3、当运行节点需要维护,如打patch,可以手动切换(relocate)使用online database relocate,减少业务中断时间;
4、rac one node比RAC数据库减少了节点间数据传输时间以及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创建RAC One Node
[oracle@jzh2 ~]$ dbca
2.1 选择"Oracle RAC One Node database"
后面创建数据库与创建RAC数据库基本一致,过程省略。。。。。
2.2、RAC one数据库基本信息
$ 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===========》数据库类型是 one node
Online relocation timeout: 30
Instance name prefix: jzh
Candidate servers: jzh2,jzh3
Database is administrator managed
2.3、数据库配置信息
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数据库中实例一般为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
数据库与service均运行在节点1上(jzh2)
2.6、使用relocate将RAC One Node数据库切到节点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
此时,数据库与service切换至节点2上(jzh3)。
2.7、查看数据库配置信息
[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 转换RAC One Node至RAC
注:以RAC One Node database拥有者执行以下命令:
$ 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、添加节点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配置完成!
当前文章:Oracle11gRACOnenode安装与配置
文章网址:
http://cdkjz.cn/article/pigdcs.html