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

65次阅读
没有评论

共计 6280 个字符,预计需要花费 16 分钟才能阅读完成。

这篇文章主要讲解了“单实例 GI 环境怎么转换为集群环境”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着丸趣 TV 小编的思路慢慢深入,一起来研究和学习“单实例 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 环境怎么转换为集群环境这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是丸趣 TV,丸趣 TV 小编将为大家推送更多相关知识点的文章,欢迎关注!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-28发表,共计6280字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)