|
1. 从Admin-Managed Oracle RAC数据库转化成Policy-Managed:
把Admin-managed的Oracle数据库转化成Policy-Managed的本质上就是添加Serverpool。而Serverpool可以直接添加进入当前的策略,也可以由创建策略集时通过相应的指令创建。如果是Flex集群,那么这些Serverpool就会通过策略归属于某些Category,由这些Category来决定哪些Serverpool是HUB,哪些Serverpool是LEAF。
下面通过实验来演示如何把一个Admin-Managed Oracle RAC数据库转化成Policy-Managed,首先安装好一套Admin-Managed Oracle RAC数据库:
- [grid@racdb01 ~]$ srvctl config database -d racdb
- Database unique name: racdb
- Database name: racdb
- Oracle home: /u01/app/oracle/product/12.2.0/dbhome_1
- Oracle user: oracle
- Spfile: +DATA/racdb/spfileracdb.ora
- Domain:
- Start options: open
- Stop options: immediate
- Database role: PRIMARY
- Management policy: AUTOMATIC
- Server pools:
- Database instances: racdb1,racdb2
- Disk Groups: DATA,FRA
- Mount point paths:
- Services:
- Type: RAC
- Database is administrator managed
复制代码 添加服务器池 mypool(最小数目 0 ,最大数目 2)- [oracle@racdb01 ~]$ srvctl add serverpool -g mypool -l 0 -u 2
复制代码 将Server Pool加入数据库的定义:
- [oracle@racdb01 ~]$ srvctl modify database -d racdb -g mypool
复制代码 检查RAC数据库racdb新的配置:
- [grid@racdb01 ~]$ srvctl config database -d racdb
- Database unique name: racdb
- Database name: racdb
- Oracle home: /u01/app/oracle/product/12.2.0/dbhome_1
- Oracle user: oracle
- Spfile: +DATA/racdb/spfileracdb.ora
- Domain:
- Start options: open
- Stop options: immediate
- Database role: PRIMARY
- Management policy: AUTOMATIC
- Server pools:
- Database instances: racdb1,racdb2
- Disk Groups: DATA,FRA
- Mount point paths:
- Services: mypool
- Type: RAC
复制代码 发现数据库已经使用Policy Managed选项了。
在数据库层面查看Free Serverpool的配置:
- [grid@racdb01 ~]$ srvctl config serverpool -g Free
- Server pool name: Free
- Importance: 0, Min: 0, Max: -1
- Candidate server names:
复制代码 在数据库层面查看Generic Serverpool的配置,(Generic Serverpool不让直接管理):
- [grid@racdb01 ~]$ srvctl config serverpool -g Generic
- PRKO-3160 : Server pool Generic is internally managed as part of administratormanaged database configuration and therefore cannot be queried directly via
- srvpool object.
复制代码 在数据库层面查看mypool Serverpool的配置:- [grid@racdb01 ~]$ srvctl config serverpool -g mypool
- Server pool name: mypool
- Importance: 0, Min: 0, Max: 2
- Candidate server names:
复制代码 注意:min_size属性指定节点的基数。假设min_size为2,数据库实例可以运行在服务器池的两台服务器上。
Serverpool不仅可以在数据库层面上查看,也可以在集群件层面查看(也可以使用crsctl添加服务器池到集群):
- [grid@racdb02 ~]$ crsctl add serverpool sp1 -attr "MIN_SIZE=1, MAX_SIZE=1,IMPORTANCE=1" -f
- CRS-2673: Attempting to stop 'ora.racdb.db' on 'racdb01'
- CRS-2677: Stop of 'ora.racdb.db' on 'racdb01' succeeded
复制代码- [grid@racdb02 ~]$ crsctl status serverpool -p
- NAME=Free
- IMPORTANCE=0
- MIN_SIZE=0
- MAX_SIZE=-1
- SERVER_NAMES=
- PARENT_POOLS= EXCLUSIVE_POOLS=
- ACL=owner:grid:rwx,pgrp:oinstall:rwx,other::r-x
- NAME=Generic
- IMPORTANCE=0
- MIN_SIZE=0
- MAX_SIZE=-1
- SERVER_NAMES=
- PARENT_POOLS= EXCLUSIVE_POOLS=
- ACL=owner:grid:r-x,pgrp:oinstall:r-x,other::r-x
- NAME=ora.mypool
- IMPORTANCE=0
- MIN_SIZE=0
- MAX_SIZE=2
- SERVER_NAMES=
- PARENT_POOLS= EXCLUSIVE_POOLS=
- ACL=owner:oracle:rwx,pgrp:oinstall:rwx,other::r--
- NAME=sp1
- IMPORTANCE=1
- MIN_SIZE=1
- MAX_SIZE=1
- SERVER_NAMES=
- PARENT_POOLS= EXCLUSIVE_POOLS=
- ACL=owner:grid:rwx,pgrp:oinstall:rwx,other::r—
复制代码- [grid@racdb02 ~]$ crsctl add serverpool sp2 -attr "MIN_SIZE=1, MAX_SIZE=1, IMPORTANCE=2"
复制代码
2. 从Policy-Managed Oracle RAC数据库转化成Admin-Managed:
你不能直接转换Policy-Managed的RAC数据库为Administrator-Managed的RAC数据库。而是可以使用srvctl remove service和srvctl remove database命令删除Policy-Managed配置,然后再使用srvctl add database和srvctl add instance命令注册该数据库为一个Admin-Managed的RAC数据库。一旦注册了数据库和实例,最后必需使用srvctl add service命令添加回服务。
1)使用SRVCTL工具删除数据库 :
- [oracle@racdb01 ~]$ srvctl remove database -d racdb
- PRKO-3141 : Database racdb could not be removed because it was running
复制代码 如果数据库正在运行可以使用-f(force)删除正在运行的数据库,但是不推荐使用该方式。我们采用正常停止数据库并删除的方式(数据库的数据不会被删除,删除的只是集群件中数据库的注册信息):
- [oracle@racdb01 ~]$ srvctl remove database -d racdb
- PRKO-3141 : Database racdb could not be removed because it was running
复制代码- [oracle@racdb01 ~]$ srvctl stop database -d racdb
- [oracle@racdb01 ~]$ srvctl status database -d racdb
- Instance racdb_1 is not running on node racdb01
- Instance racdb2 is not running on node racdb02
- [oracle@racdb01 ~]$ srvctl remove database -d racdb
- Remove the database racdb? (y/[n]) y
- [oracle@racdb01 ~]$ srvctl status database -d racdb
- PRCD-1120 : The resource for database racdb could not be found.
- PRCR-1001 : Resource ora.racdb.db does not exist
复制代码 2)添加Admin-Managed数据库:- [oracle@racdb01 ~]$ srvctl add database -d racdb -o /u01/app/oracle/product/12.2.0/dbhome_1 -y automatic
复制代码- [grid@racdb01 ~]$ srvctl config database -d racdb
- Database unique name: racdb
- Database name: racdb
- Oracle home: /u01/app/oracle/product/12.2.0/dbhome_1
- Oracle user: oracle
- Spfile: +DATA/racdb/spfileracdb.ora
- Domain:
- Start options: open
- Stop options: immediate
- Database role: PRIMARY
- Management policy: AUTOMATIC
- Server pools:
- Database instances: racdb1,racdb2
- Disk Groups: DATA,FRA
- Mount point paths:
- Services:
- Type: RAC
- Database is administrator managed
复制代码 3)添加数据库实例:- [oracle@racdb01 ~]$ srvctl add instance -d racdb -i racdb1 -n racdb01
- [oracle@racdb01 ~]$ srvctl add instance -d racdb -i racdb2 -n racdb02
- [oracle@racdb01 ~]$ srvctl start database -d racdb
- [oracle@racdb01 ~]$ srvctl status database -d racdb
- Instance racdb1 is running on node racdb01
- Instance racdb2 is running on node racdb02
复制代码 如果有非默认service需使用srvctl add service命令添加回改服务,并且注意Admin-Managed的服务的语法和Policy-Managed的服务的语法是不一样的。
|
|