oracle11G ASM文件磁盘组更换

概述:最近公司的一台存储磁盘两块磁盘同时损失导致有一套数据库存在坏块,还有其他相关数据库存在风险;在修复完受损严重的数据库后,需要对存储进行更换维修时,需要将未受损的数据库存在风险数据进行迁移,主要涉及到的问题是rac 存储数据如何迁移至新的存储?现在还未实施,我先依照现存的环境在虚拟机中进行模拟实验:

1、环境:我这边相关损坏的存储没有底层复制镜像等功能(存储较老旧,领导反馈客户准备全部更换后利久做备份容灾等)

2、rac的磁盘组当初配置的是外部冗余,数据库版本为10.2.0.5;如果磁盘组是normal,或者是high的话只需要对 相应的磁盘组进行添加磁盘,删除磁盘,重新reblance就ok了。

3、我这边实验是11.2.0.4的oracle 和grid 配置问单机模式,主要是过程模拟操作都是类似的。

实验步骤:

1、创建新磁盘组

2、迁移数据库数据:归档路径、redolog file、control file、datafile、spfile(包裹asm)

3、删除旧磁盘组

4、重启数据库验证


实验:

CREATE DISKGROUP datanew EXTERNAL REDUNDANCY DISK '$ORACLE_HOME/disks/c*';


alter system set db_recovery_file_dest='+DATANEW';


alter database add logfile thread 1 group 4 '+DATANEW' size 50M;
alter database add logfile thread 1 group 5 '+DATANEW' size 50M;
alter database add logfile thread 1 group 6 '+DATANEW' size 50M;

select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
+DATA/cube/onlinelog/group_3.266.979466699
+DATA/cube/onlinelog/group_3.267.979466699
+DATA/cube/onlinelog/group_2.264.979466699
+DATA/cube/onlinelog/group_2.265.979466699
+DATA/cube/onlinelog/group_1.262.979466697
+DATA/cube/onlinelog/group_1.263.979466697
+DATANEW/cube/onlinelog/group_4.256.979468249
+DATANEW/cube/onlinelog/group_5.257.979468259

+DATANEW/cube/onlinelog/group_6.258.979468263


select GROUP#,THREAD#,bytes/1024/1024,MEMBERS,STATUS from v$log;
    GROUP#    THREAD# BYTES/1024/1024    MEMBERS STATUS
---------- ---------- --------------- ---------- ----------------
         1          1              50          2 CURRENT
         2          1              50          2 INACTIVE
         3          1              50          2 INACTIVE
         4          1              50          1 UNUSED
         5          1              50          1 UNUSED

         6          1              50          1 UNUSED

alter database drop logfile group 2;
alter database drop logfile group 3;
alter system switch logfile;
ALTER SYSTEM ARCHIVE LOG CURRENT;
alter system checkpoint;

alter database drop logfile group 1;

select property_name,property_value from database_properties where property_name like '%TABLESPACE';
PROPERTY_NAME    PROPERTY_VALUE

DEFAULT_TEMP_TABLESPACE  TEMP

create temporary tablespace temp01 tempfile '+DATANEW' size 30M autoextend on;

alter database default temporary tablespace temp01;

SQL> show parameter contro 


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DATA/cube/controlfile/current
                                                 .261.979466695, +DATA/cube/con
                                                 trolfile/current.260.979466695
control_management_pack_access       string      DIAGNOSTIC+TUNING

alter system set control_files='+DATANEW' scope=spfile;
shutdown immediate;

startup nomount;


[root@cube2 dbs]# su - oracle
rman target /
restore controlfile from '+DATA/cube/controlfile/current.261.979466695';

alter database mount;

SQL> show parameter contro
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DATANEW/cube/controlfile/curr
                                                 ent.262.979469215
control_management_pack_access       string      DIAGNOSTIC+TUNING

backup as copy database format '+DATANEW';
list copy;
switch database to copy;
recover database;
alter database open;

spfile修改:
grid:
create spfile='+datanew' from pfile='/tmp/asmpfile.ora';

SQL> shutdown immediate;
ASM diskgroups volume disabled
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started
Total System Global Area 1135747072 bytes
Fixed Size                  2260728 bytes
Variable Size            1108320520 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled


oracle:

create pfile='/tmp/orapfile.ora' from spfile;
create spfile='+DATANEW' from pfile='/tmp/orapfile.ora';
[oracle@cube2 dbs]$ vi initcube.ora
SPFILE='+datanew/cube/PARAMETERFILE/spfile.269.979469717'

shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
 startup nomount;
ORACLE instance started.

Total System Global Area  784998400 bytes
Fixed Size                  2257352 bytes
Variable Size             515903032 bytes
Database Buffers          264241152 bytes

Redo Buffers                2596864 bytes


alter database mount;
alter database open;
show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATANEW/cube/parameterfile/sp
                                                 file.269.979469717

alter diskgroup data dismount;  确定所有文件都已移动至新磁盘组

alter diskgroup data mount;
删除data组中的文件

drop diskgroup data;

总结:此致ASM磁盘组外部冗余更换完成;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值