单实例GI环境怎么转换为集群环境

这篇文章主要讲解了“单实例GI环境怎么转换为集群环境”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“单实例GI环境怎么转换为集群环境”吧!

在宜春等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站制作、成都网站建设 网站设计制作按需网站建设,公司网站建设,企业网站建设,高端网站设计,成都全网营销,外贸营销网站建设,宜春网站建设费用合理。



----------------------------------------------------------------------------------------------------------------
1. 单机ASM转换集群ASM
----------------------------------------------------------------------------------------------------------------

------------------------------
1.1 关闭GI环境资源.
------------------------------

[oracle@a42ams1 ~]$ sqlplus / as sysdba
SQL> shutdown immediate;

[grid@a42ams1 ~]$ crsctl stop has

------------------------------
1.2 检查安装环境信息
------------------------------

--1.2.1 配置互信

./sshUserSetup.sh -hosts "a42ams1 a42ams2" -user grid -advanced -noPromptPassphrase
./sshUserSetup.sh -hosts "a42ams1 a42ams2" -user oracle -advanced -noPromptPassphrase
more /etc/hosts | grep -Ev '^#|^$|127.0.0.1|vip|scan|:' | awk '{print "ssh " $2 " date;"}' > ping.sh

--1.2.2 执行集群安装校验
./runcluvfy.sh stage -pre crsinst -n a42ams1,a42ams2 -verbose

------------------------------
1.3 卸载单机环境GI,清除软件文件
------------------------------

[root@a42ams1 ~]# cd /grid/app/11.2.0/
[root@a42ams1 grid]# cd crs/install/
[root@a42ams1 install]# ./roothas.pl -deconfig -force
Using configuration parameter file: ./crsconfig_params
CRS resources for listeners are still configured
PRKO-2573 : ONS daemon is already stopped.
CRS-2673: Attempting to stop 'ora.A42AMSARCH.dg' on 'a42ams1'
CRS-2673: Attempting to stop 'ora.A42AMSDATA1.dg' on 'a42ams1'
CRS-2673: Attempting to stop 'ora.A42AMSOCR.dg' on 'a42ams1'
CRS-2677: Stop of 'ora.A42AMSOCR.dg' on 'a42ams1' succeeded
CRS-2677: Stop of 'ora.A42AMSDATA1.dg' on 'a42ams1' succeeded
CRS-2677: Stop of 'ora.A42AMSARCH.dg' on 'a42ams1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'a42ams1'
CRS-2677: Stop of 'ora.asm' on 'a42ams1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'a42ams1'
CRS-2677: Stop of 'ora.cssd' on 'a42ams1' succeeded
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'a42ams1'
CRS-2673: Attempting to stop 'ora.evmd' on 'a42ams1'
CRS-2677: Stop of 'ora.evmd' on 'a42ams1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'a42ams1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
Successfully deconfigured Oracle Restart stack

--11.2.0.4已经不支持 (How to Convert a Single-Instance ASM to Cluster ASM (文档 ID 452758.1)    )
[oracle@a42ams1 ~]$ cd $ORACLE_HOME/bin
[oracle@a42ams1 bin]$ dbca -silent -deleteASM
This is no longer a supported operation. Use Automatic Storage Management Configuration Assistant (ASMCA) from grid infrastructure/clusterware home to delete ASM.

--分离GI的ORACLE_HOME信息
[grid@a42ams1 ~]$  
$ORACLE_HOME/oui/bin/runInstaller -silent -detachHome ORACLE_HOME=$ORACLE_HOME

------------------------------
1.4 新装GI/DB环境 (注意调整目录及环境变量)
------------------------------

--如果需要使用原有磁盘作为OCR磁盘,需要清空磁盘信息
[root@a42ams1 ~]# dd if=/dev/zero of=/dev/asm-ocr1 bs=1M count=100
[root@a42ams1 ~]# dd if=/dev/zero of=/dev/asm-ocr2 bs=1M count=100
[root@a42ams1 ~]# dd if=/dev/zero of=/dev/asm-ocr3 bs=1M count=100

----------------------------------------------------------------------------------------------------------------
2. 单机数据库转换集群数据库
----------------------------------------------------------------------------------------------------------------

------------------------------
2.1 挂载原有DG (两个节点都可以进行挂载)
------------------------------

[grid@a42ams1 ~]$ kfod a='/dev/asm*' disks=all ds=true o=all
[grid@a42ams1 ~]$ sqlplus / as sysasm
SQL> alter diskgroup A42AMSDATA1 mount;
SQL> alter diskgroup A42AMSARCH mount;

------------------------------
2.2 启动原有数据库 (需要修改oracle可执行程序权限,否则启动数据库时无法访问磁盘组)
------------------------------

--2.2.1 复制原有的参数文件和口令文件到新安装目录下,启动数据库
[oracle@a42ams1 ~]$ sqlplus / as sysdba
SQL> startup
ORA-01565: error in identifying file '+A42AMSDATA1/a42amsdb/spfilea42amsdb.ora'
ORA-17503: ksfdopn:2 Failed to open file +A42AMSDATA1/a42amsdb/spfilea42amsdb.ora
ORA-15001: diskgroup "A42AMSDATA1" does not exist or is not mounted
ORA-15040: diskgroup is incomplete

--2.2.2 调整oracle可执行程序文件权限
[oracle@a42ams1 trace]$ ls -la $ORACLE_HOME/bin/oracle
-rwsr-s--x 1 oracle oinstall 239626689 Jun 14 10:23 /oracle/app/oracle/product/11.2.0.4/db_1/bin/oracle
[root@a42ams1 bin]# /grid/app/11.2.0.4/grid/bin/setasmgidwrap o=/oracle/app/oracle/product/11.2.0.4/db_1/bin/oracle

--2.2.3 启动数据库
[oracle@a42ams1 ~]$ sqlplus / as sysdba
SQL> startup;

--2.2.4 将数据库加入crs资源中,并校验环境信息
[oracle@a42ams1 ~]$ srvctl add database -d a42amsdb -o /oracle/app/oracle/product/11.2.0.4/db_1 -p +A42AMSDATA1/a42amsdb/spfilea42amsdb.ora -c Single -x a42ams1
[oracle@a42ams1 ~]$ srvctl config database -d a42amsdb

------------------------------
2.3 进行rac数据库转换 (MOS ID 1362116.1)
------------------------------
[oracle@a42ams1 ~]$ cd $ORACLE_HOME/assistants/rconfig/sampleXMLs
[oracle@a42ams1 sampleXMLs]$ cp ConvertToRAC_AdminManaged.xml ~

--2.3.1 替换转换信息
[oracle@a42ams1 ~]$ vi ConvertToRAC_AdminManaged.xml
--转换路径信息 (配置文件中提示源和目标的目录可以一致)

:%s#/oracle/product/11.2.0/db_1#/oracle/app/oracle/product/11.2.0.4/db_1#g

--实例信息

替换为:



--节点信息

 
 


替换为:

 
 


--实例前缀信息
sales
替换为:
a42amsdb

--DG信息调整 (由于不需要进行数据迁移,DG信息置空)
+ASMDG
替换为:


+ASMDG
替换为:


--2.3.2 修改sys用户口令为oracle
SQL> alter user sys identified by oracle;

--2.3.3 对转换文件进行校验
[oracle@a42ams1 ~]$ vi ConvertToRAC_AdminManaged.xml


替换为:


[oracle@a42ams1 ~]$ $ORACLE_HOME/bin/rconfig ./ConvertToRAC_AdminManaged.xml

--2.3.4 执行转换

[oracle@a42ams1 ~]$ vi ConvertToRAC_AdminManaged.xml


替换为:


[oracle@a42ams1 ~]$ $ORACLE_HOME/bin/rconfig ./ConvertToRAC_AdminManaged.xml
Converting Database "a42amsdb" to Cluster Database. Target Oracle Home: /oracle/app/oracle/product/11.2.0.4/db_1. Database Role: PRIMARY.
Setting Data Files and Control Files
Adding Database Instances
Adding Redo Logs
Enabling threads for all Database Instances
Setting TEMP tablespace
Adding UNDO tablespaces
Adding Trace files
Setting Fast Recovery Area
Updating Oratab
Creating Password file(s)
Configuring Listeners
Configuring related CRS resources
Starting Cluster Database

--2.3.5 执行转换检查转换结果,修改环境变量
[oracle@a42ams1 ~]$ srvctl config database -d a42amsdb
[oracle@a42ams1 ~]$ crsctl stat res ora.a42amsdb.db -t
[oracle@a42ams1 ~]$ ps -ef | grep ora_smon
[oracle@a42ams2 ~]$ ps -ef | grep ora_smon

感谢各位的阅读,以上就是“单实例GI环境怎么转换为集群环境”的内容了,经过本文的学习后,相信大家对单实例GI环境怎么转换为集群环境这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


网站栏目:单实例GI环境怎么转换为集群环境
当前链接:http://pwwzsj.com/article/jcijgc.html