修改RAC环境中的ASM DG名称

发布时间:2020-06-30 07:50:15 作者:背向天堂
来源:网络 阅读:312

--------------------------------------------------------------------------------------------------------

# 1. 生成数据文件重命名脚本

--------------------------------------------------------------------------------------------------------


---------------------------------------

--1.1 日志文件路径替换

---------------------------------------

SQL > select 'ALTER DATABASE RENAME FILE '''||MEMBER||''' TO '''||REPLACE(MEMBER,'+ARCH_DG','+helloWorldARCH')||'''; ' FROM v$logfile where member like '%ARCH_DG%';


ALTER DATABASE RENAME FILE '+ARCH_DG/helloWorlddb/onlinelog/group_1.257.946749259' TO '+helloWorldARCH/helloWorlddb/onlinelog/group_1.257.946749259';

......


---------------------------------------

--1.2 日志文件路径替换

---------------------------------------

SQL > select 'ALTER DATABASE RENAME FILE '''||MEMBER||''' TO '''||REPLACE(MEMBER,'+DATA01_DG','+helloWorldDATA1')||'''; ' FROM v$logfile where member like '%DATA01_DG%';


ALTER DATABASE RENAME FILE '+DATA01_DG/helloWorlddb/onlinelog/group_1.257.946749257' TO '+helloWorldDATA1/helloWorlddb/onlinelog/group_1.257.946749257';

......


---------------------------------------

--1.3 数据文件路径替换

---------------------------------------

SQL > select 'ALTER DATABASE RENAME FILE '''||NAME||''' TO '''||REPLACE(NAME,'+DATA01_DG','+helloWorldDATA1')||'''; ' FROM v$datafile;


ALTER DATABASE RENAME FILE '+DATA01_DG/helloWorlddb/datafile/system.267.946748147' TO '+helloWorldDATA1/helloWorlddb/datafile/system.267.946748147';

......


---------------------------------------

--1.4 临时文件路径替换

---------------------------------------

SQL > select 'ALTER DATABASE RENAME FILE '''||NAME||''' TO '''||REPLACE(NAME,'+DATA01_DG','+helloWorldDATA1')||'''; ' FROM v$tempfile;


ALTER DATABASE RENAME FILE '+DATA01_DG/helloWorlddb/tempfile/temp.264.946748289' TO '+helloWorldDATA1/helloWorlddb/tempfile/temp.264.946748289';

......


---------------------------------------

--1.5 备份参数文件

---------------------------------------

SQL> create pfile='/home/oracle/helloWorld.pfile' from spfile;


--------------------------------------------------------------------------------------------------------

# 2. 停数据库

--------------------------------------------------------------------------------------------------------

oracle@helloWorlddb1:[/home/oracle]srvctl config database -d helloWorlddb


oracle@helloWorlddb1:[/home/oracle]srvctl stop database -d helloWorlddb



--------------------------------------------------------------------------------------------------------

# 3. 重命名DG (grid用户操作)

--------------------------------------------------------------------------------------------------------


---------------------------------------

--3.1 查看DG信息

---------------------------------------

grid@helloWorlddb1:[/home/grid]kfod a='/dev/rdisk/*' disks=all ds=true o=all 


grid@helloWorlddb1:[/home/grid]crsctl stat res -t


---------------------------------------

--3.2 删除旧DG信息

---------------------------------------

grid@helloWorlddb1:[/home/grid]srvctl stop diskgroup -g ARCH_DG -n helloWorlddb1,helloWorlddb2  

grid@helloWorlddb1:[/home/grid]srvctl stop diskgroup -g DATA01_DG -n helloWorlddb1,helloWorlddb2  

grid@helloWorlddb1:[/home/grid]srvctl remove diskgroup -g ARCH_DG -f

grid@helloWorlddb1:[/home/grid]srvctl remove diskgroup -g DATA01_DG -f


---------------------------------------

--3.3 重命名DG

---------------------------------------

grid@helloWorlddb1:[/home/grid]renamedg dgname=DATA01_DG newdgname=helloWorldDATA1 asm_diskstring='/dev/rdisk/disk*' verbose=true

grid@helloWorlddb1:[/home/grid]renamedg dgname=ARCH_DG newdgname=helloWorldARCH asm_diskstring='/dev/rdisk/disk*' verbose=true


---------------------------------------

--3.4 查看新DG信息

---------------------------------------

grid@helloWorlddb1:[/home/grid]kfod a='/dev/rdisk/*' disks=all ds=true o=all 


---------------------------------------

--3.5 挂载新DG

---------------------------------------

grid@helloWorlddb1:[/home/grid]sqlplus / as sysasm

SQL> alter diskgroup helloWorldDATA1 mount;

SQL> alter diskgroup helloWorldARCH mount;


---------------------------------------

--3.6 检查ASM实例中参数信息

---------------------------------------

SQL> show parameter asm_diskgroups;


--如果有需要,手工调整参数所对应的磁盘组信息

SQL> alter system set asm_diskgroups=helloWorldDATA1,helloWorldARCH sid='+ASM1';

SQL> alter system set asm_diskgroups=helloWorldDATA1,helloWorldARCH sid='+ASM2';

---------------------------------------

--3.7 检查crs资源信息

---------------------------------------

grid@helloWorlddb1:[/home/grid]crsctl stat res -t


--------------------------------------------------------------------------------------------------------

# 4. 修改数据库相关DG路径 (oracle用户)

--------------------------------------------------------------------------------------------------------


---------------------------------------

--4.1 修改数据库参数文件路径 (两个节点)

---------------------------------------


oracle@helloWorlddb1:[/home/oracle]cd $ORACLE_HOME/dbs

oracle@helloWorlddb1:[/oracle/app/oracle/11.2.0.4/db_1/dbs]vi inithelloWorlddb1.ora

oracle@helloWorlddb2:[/oracle/app/oracle/11.2.0.4/db_1/dbs]vi inithelloWorlddb2.ora

:%s/DATA01_DG/helloWorldDATA1/g


---------------------------------------

--4.2 修改crs中记录的参数文件与DG信息

---------------------------------------

oracle@helloWorlddb1:[/home/oracle]srvctl modify database -d helloWorlddb -p +helloWorldDATA1/helloWorlddb/spfilehelloWorlddb.ora -a helloWorldDATA1,helloWorldARCH


---------------------------------------

--4.3 启动数据库到nomount状态

---------------------------------------

oracle@helloWorlddb1:[/home/oracle]sqlplus / as sysdba

SQL> startup nomount;


---------------------------------------

--4.4 修改与DG名称相关的数据库参数

---------------------------------------

oracle@helloWorlddb1:[/home/oracle]grep DATA01_DG helloWorld.pfile  

oracle@helloWorlddb1:[/home/oracle]grep ARCH_DG helloWorld.pfile


oracle@helloWorlddb1:[/home/oracle]sqlplus / as sysdba

alter system set control_files='+helloWorldDATA1/helloWorlddb/controlfile/current.265.946748283', '+helloWorldARCH/helloWorlddb/controlfile/current.256.946748283' scope=spfile;

alter system set db_create_file_dest='+helloWorldDATA1' scope=spfile;

alter system set db_create_online_log_dest_1='+helloWorldDATA1' scope=spfile;

alter system set db_create_online_log_dest_2='+helloWorldARCH' scope=spfile;


---------------------------------------

--4.5 重新启动并挂载数据库

---------------------------------------

SQL> shutdown immediate;

SQL> startup mount;


---------------------------------------

--4.6 执行步骤1中生成的数据库重命名脚本

---------------------------------------


---------------------------------------

--4.7 打开数据库

---------------------------------------

SQL> alter database open;


---------------------------------------

--4.8 重启集群进行验证

---------------------------------------


推荐阅读:
  1. Oracle RAC 删除ASM磁盘组
  2. ORACLE RAC数据库修改名称

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

oracle asm

上一篇:如何开始使用Cocoapods

下一篇:G3CMS 数据查询接口协议

相关阅读

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

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