实际执行:
[root@jystdrac2 app]# ls -ld /opt/app
drwxr-xr-x. 6 root oinstall 4096 Jun 4 13:34 /opt/app
[root@jystdrac2 app]# mkdir -p /opt/app/oracle
[root@jystdrac2 app]# chown oracle:oinstall /opt/app/oracle/
[root@jystdrac2 app]# ls -ld /opt/app/oracle/
drwxr-xr-x 2 oracle oinstall 4096 Jun 4 14:25 /opt/app/oracle/
--添加RAC节点:
cd $ORACLE_HOME/oui/bin
./addNode.sh "CLUSTER_NEW_NODES={jystdrac2}"
然后按提示执行root脚本。
2.5 执行root.sh脚本
2.5 Run the Grid_home/root.sh script on the node3 as root and run the subsequent script, as instructed.
2.6 验证集群完整性
2.6 cluvfy stage -post nodeadd -n node3 [-verbose]
Check whether either a policy-managed or administrator-managed Oracle RAC database is configured to run on node3 (the newly added node). If you configured an administrator-managed Oracle RAC database, you may need to use DBCA to add an instance to the database to run on this newly added node.
cluvfy stage -post nodeadd -n jystdrac2 -verbose
3.其他配置工作
此时需要将单节点RAC修改为两节点RAC,可以按照官方文档说的直接使用dbca,也可以手工来配置。
如果此时直接尝试启动新加节点的实例,会报错:
[oracle@jystdrac2 ~]$ srvctl add instance -d ractest -i ractest2
[oracle@jystdrac2 ~]$ srvctl start instance -d ractest -i ractest2
PRCR-1013 : Failed to start resource ora.ractest.db
PRCR-1064 : Failed to start resource ora.ractest.db on node jystdrac2
CRS-5017: The resource action "ora.ractest.db start" encountered the following error:
ORA-29760: instance_number parameter not specified
. For details refer to "(:CLSN00107:)" in "/opt/app/11.2.0/grid/log/jystdrac2/agent/crsd/oraagent_oracle/oraagent_oracle.log".
CRS-2674: Start of 'ora.ractest.db' on 'jystdrac2' failed
[oracle@jystdrac2 ~]$
下面手工折腾下配置:
3.1 配置参数文件
在目标端通过spfile创建一个pfile
create pfile='/tmp/pfilerac.ora' from spfile;
修改改pfile,添加/修改RAC相关配置类似如下(之前只有实例1,没有实例2):
ractest1.instance_number=1
ractest2.instance_number=2
ractest1.instance_name=ractest1
ractest2.instance_name=ractest2
ractest1.thread=1
ractest2.thread=2
ractest1.undo_tablespace='UNDOTBS1'
ractest2.undo_tablespace='UNDOTBS2'
ractest1.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST= 192.168.1.62)(PORT=1521))'
ractest2.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST= 192.168.1.64)(PORT=1521))'
使用修改后的pfile启动数据库
SQL> startup nomount pfile='/tmp/pfilerac.ora';
3.2 配置节点2实例相关对象
返回节点1操作,添加节点2的日志组:
SQL>
alter database add logfile thread 2 group 21 size 50M;
alter database add logfile thread 2 group 22 size 50M;
alter database add logfile thread 2 group 23 size 50M;
添加实例2的undo:
SQL>
CREATE UNDO TABLESPACE UNDOTBS2 DATAFILE '+DATA' SIZE 100M;
启用thread 2(确保节点2可以mount):
SQL>
alter database enable public thread 2;
新加节点创建spfile,内容就是当前使用的pfile:
SQL>
create spfile='+DATA/ractest/spfileractest.ora' from pfile='/tmp/pfilerac.ora';
新加节点重新使用spfile重启新加的节点:
SQL> shutdown immediate
startup
附:运行catclust.sql建立集群相关字典视图(需确认是否需要执行)
--需确认是否需要执行(加节点一般不需要)
@?/rdbms/admin/catclust.sql
3.3 最终确定数据库信息
--srvctl config database -d ractest
[oracle@jystdrac2 ~]$ srvctl config database -d ractest
Database unique name: ractest
Database name: ractest
Oracle home: /opt/app/oracle/product/11.2.0/dbhome_1
Oracle user: oracle
Spfile: +DATA/ractest/spfileractest.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: ractest
Database instances: ractest1,ractest2
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Database is administrator managed