温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2021-09-03 16:27:08 来源:亿速云 阅读:134 作者:chen 栏目:关系型数据库

这篇文章主要讲解了“单实例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
--转换路径信息 (配置文件中提示源和目标的目录可以一致)
<!--Specify OracleHome where the rac database should be configured. It can be same as SourceDBHome -->
:%s#/oracle/product/11.2.0/db_1#/oracle/app/oracle/product/11.2.0.4/db_1#g

--实例信息
<n:SourceDBInfo SID="sales">
替换为:
<n:SourceDBInfo SID="a42amsdb">


--节点信息
<n:NodeList>
  <n:Node name="node1"/>
  <n:Node name="node2"/>
</n:NodeList>

替换为:
<n:NodeList>
  <n:Node name="a42ams1"/>
  <n:Node name="a42ams2"/>
</n:NodeList>

--实例前缀信息
<n:InstancePrefix>sales</n:InstancePrefix>
替换为:
<n:InstancePrefix>a42amsdb</n:InstancePrefix>

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

<n:TargetFlashRecoveryArea>+ASMDG</n:TargetFlashRecoveryArea>
替换为:
<n:TargetFlashRecoveryArea></n:TargetFlashRecoveryArea>

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

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

<n:Convert verify="YES">
替换为:
<n:Convert verify="ONLY">

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

--2.3.4 执行转换

[oracle@a42ams1 ~]$ vi ConvertToRAC_AdminManaged.xml

<n:Convert verify="ONLY">
替换为:
<n:Convert verify="YES">

[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环境怎么转换为集群环境这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

gi
AI