Oracle中被忽略的好功能: Server Pool, Policy-Managed, RAC One Node - 3

1.2  RAC one node 

      RAC One Node 是 RAC数据库,并且通过Oracle集群软件(Grid)管理实现只启动RAC数据库的一个实例(其他节点上的实例以standby的形式存在,但又不同于我们常见的standby),当运行实例的节点需要维护停机的情况下,可以通过online database relocation的方式将数据库实例切换到集群中的其他节点上运行。RAC One Node采用cold failover方式,RAC one node检查到fail后,首先会在相同节点尝试restart,如果当前节点出现问题或实例异常,数据库实例会被切换到standby的节点上去,relocated的过程是自动实现的,不需要人工介入。Relocated使用的是Omotion, 使用Omotion可以对实例进行migration和relocation。 RAC One Node的fail over使用的是instance relocation,通过在新server上 re-mounting disk以及使用spfile来开启实例。

RAC One Node优势及场景:
1).对比RAC数据库,RAC One Node 数据库在性能方面也有优势,比如减少了RAC实例之间消息/数据请求传输的时间以及GC等待时间。
2).RAC One Node 数据库很容易转变成RAC数据库, 转变过程是online的,不需要停RAC One node数据库.
3).在GRID环境中可以创建多个RAC One Node数据库,分别运行在不同的节点上,增强了硬件的利用率。
4).如果当前运行节点需要维护(升级或patch等)或者服务器资源不足等等,可以手动切换数据库(relocate)到备用服务器,采用online database relocation,可以减少业务中断时间(应用需要配置TAF).
5).一个节点中的多个数据库使用Instance Caging限定CPU资源使用,需要使用resource manager,按数据库分不同的资源组(而不是用户)。
6).提供了服务器和数据库双重级别的failover,由oracle clusterware来实现的。
7).RAC one node不适合非常关键的业务及应用;不提供load balance功能。

Oracle RAC One Node 引入了2个新工具:
1). Oracle Database Resource Manager Instance Caging:
The new instance caging features is part of the database resource manager in RAC One Node, a tool to allocate server resources to multiple instances running on the sameserver.
 
2). Omotiononline migration utility:
This is a new RAC One Node utility that allows for a RAC instance to be quickly "lifted" and copied to a new server node.
 

2.  RAC one node常见操作 


2.1 查看RAC one node数据库的一些属性 

[oracle@szxcld103 ~]$ srvctl config  database  -d wqaaj
Database unique name: wqaaj
Database name: wqaaj
Oracle home: /data01/oracle/db/11204
Oracle user: oracle
Spfile: +DATA/wqaaj/spfilewqaaj.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: wqaaj
Database instances: 
Disk Groups: DATA
Mount point paths: 
Services: wqaaj_srv
Type: RACOneNode
Online relocation timeout: 30    --- 30分钟 
Instance name prefix: wqaaj
Candidate servers: szxcld104,szxcld102,szxcld103,szxcld101
Database is administrator managed


大多数参数不用解释。
Online Relocation Timeout : 
This is the time that’s going to be given to the sessions to complete their transactions and switchover to the target node without any issue. If the transactions fail to get completed in this time period, it would be aborted and session would be switched over to the target node. The default unit of this parameter is in minutes and the value is 30(minutes) . Maximum value allowed for this parameter would be 12hours (720 minutes) .

Database is administrator managed:表示RAC one node数据库是Admin-Managed 。 


2.2  手工relocate数据库实例到其他节点(GI中任意节点执行)
$ srvctl relocate database -d  wqbbb -n szh101db09 

例子:   Admin-Managed方式下的RAC one node,szh101db08,szh101db09在同一个GI下。  

1). szh101db08上安装有RAC one node:  wqbbb_1   
[root@szh101db08 ~]# su - oracle
[oracle@szh101db08 ~]$ 
[oracle@szh101db08 ~]$  ps -ef | grep  smon 
grid      2381     1  0 Sep04       00:01:53 asm_smon_+ASM15
root      5774     1  9 Sep04       5-07:40:39 /u01/app/11.2.0.4/grid/bin/osysmond.bin
oracle    8623     1  0 Oct29       00:00:04 ora_smon_wqbbb_1
oracle   12002     1  0 Oct29       00:00:03 ora_smon_wqaaa1
[oracle@szh101db08 ~]$ 


szh101db09上没有实例信息。


[oracle@szh101db09 ~]$ 
[oracle@szh101db09 ~]$ ps -ef | grep smon 
root      7741     1 10 Sep09       5-13:54:15 /u01/app/11.2.0.4/grid/bin/osysmond.bin
grid     28201     1  0 Sep09       00:01:37 asm_smon_+ASM6
oracle   29724 26884  0 15:55 pts/2    00:00:00 grep smon


在此GI任意节点上执行
[root@szh101db08 ~]# su - oracle
[oracle@szh101db08 ~]$ 
[oracle@szh101db08 ~]$ srvctl relocate database -d wqbbb -n szh101db09

切换约需要 2-5分钟,注意前面可以看到 Online relocation timeout: 30,默认是30分钟timeout,30分钟不结束,所有transaction会被abort,切换到target节点 。


可以看到,节点szh101db08上实例不存在了。
[oracle@szh101db08 ~]$ ps -ef | grep  smon
grid      2381     1  0 Sep04       00:01:53 asm_smon_+ASM15
root      5774     1  9 Sep04       5-07:42:44 /u01/app/11.2.0.4/grid/bin/osysmond.bin
oracle   12002     1  0 Oct29       00:00:04 ora_smon_wqaaa1
oracle   22668 18364  0 16:17 pts/5    00:00:00 grep smon


实例wqbbb_2在节点szh101db09上出现了。 
[oracle@szh101db09 ~]$ ps -ef | grep  smon
root      7741     1 10 Sep09       5-13:56:41 /u01/app/11.2.0.4/grid/bin/osysmond.bin
oracle   16039     1  0 16:12       00:00:00 ora_smon_wqbbb_2
grid     28201     1  0 Sep09       00:01:37 asm_smon_+ASM6
[oracle@szh101db09 ~]$ 


当初创建的wqbbbs服务也在新节点上运行。 
[oracle@szh101db09 ~]$ srvctl status service -d  wqbbb
Service wqbbbs is running on instance(s) wqbbb_2
[oracle@szh101db09 ~]$ 

再次切回去

[oracle@szh101db09 trace]$ srvctl relocate database -d wqbbb -n szh101db08
[oracle@szh101db09 trace]$ 

szh101db09上实例消失。
[oracle@szh101db09 trace]$ ps -ef | grep smon 
root      7741     1 10 Sep09       5-13:58:15 /u01/app/11.2.0.4/grid/bin/osysmond.bin
oracle   19031 25087  0 16:32 pts/5    00:00:00 grep smon
grid     28201     1  0 Sep09       00:01:37 asm_smon_+ASM6
[oracle@szh101db09 trace]$ 


szh101db08上实例wqbbb_1又重新回来了。
[oracle@szh101db08 ~]$ 
[oracle@szh101db08 ~]$ ps -ef | grep smon 
grid      2381     1  0 Sep04       00:01:53 asm_smon_+ASM15
root      5774     1  9 Sep04       5-07:44:10 /u01/app/11.2.0.4/grid/bin/osysmond.bin
oracle   12002     1  0 Oct29       00:00:04 ora_smon_wqaaa1
oracle   21095     1  0 16:31       00:00:00 ora_smon_wqbbb_1
oracle   32582 23661  0 16:32 pts/8    00:00:00 grep smon
[oracle@szh101db08 ~]$ 


请使用浏览器的分享功能分享到微信等