1、环境与准备

  • oracle 11gR2 RAC +
  • 实施前安全起见,操作之前停数据库实例、ASM实例

2、节点1、2磁盘信息

  1. 查看磁盘信息及新添加磁盘;
    共享磁盘信息:ls -l /dev/asm*
    需新添加磁盘:ls -l /dev/sd*
  2. udev方式将新磁盘配置为ASM共享磁盘(节点1、2都要执行)
    查看磁盘的UUID:

    for disk in `ls /dev/sd*`
    do
      echo $disk
      /usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=$disk
    done

    cd /etc/udev/rules.d
    添加vi 99-oracle-asmdevices.rules

    KERNEL=="sd?", ENV{ID_SERIAL}=="36000d310008ec3000000000000000036", SYMLINK+="asm_ocr",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
    KERNEL=="sd?", ENV{ID_SERIAL}=="36000d310008ec3000000000000000016", SYMLINK+="asm_data",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
    KERNEL=="sd?", ENV{ID_SERIAL}=="36000d310008ec3000000000000000035", SYMLINK+="asm_fra",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
    KERNEL=="sd?", ENV{ID_SERIAL}=="36000d310008ec300000000000000002c", SYMLINK+="asm_bak",  OWNER="grid",  GROUP="asmadmin", MODE="0660"
    KERNEL=="sd?", ENV{ID_SERIAL}=="36000d310008ec3000000000000000039", SYMLINK+="asm_data3",  OWNER="grid",  GROUP="asmadmin", MODE="0660"                                                               
  3. 重启udev服务
    start_udev
  4. 检查/dev/sdh是否已为/dev/asm-diskh格式的asm磁盘
    s -l /dev/asm*
  5. 向ASM磁盘组中加盘(grid用户的sysasm)

    SQL>select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS,MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;
    SQL>alter diskgroup data add disk '/dev/asm-data3';
    SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS,MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;
  6. 添加完磁盘之后,oracle会自动做重平衡rebalance操作,可以通过视图查看

    SQL> select * from v$asm_operation;
    SOFAR:就是目前为止挪动的AU数量
    EST_WORK:估计要挪动的AU数量
    EST_RATE:估计每分钟挪动的AU数量
    EST_MINUTES:估计挪动多少分钟
    
    重平衡的过程就是从其他的磁盘向新磁盘挪动数据的过程,如果数据量很大,这个时间会很长,可以更改power值加快速度,默认power值为1,可根据存储性能将此值设置大一些(power取值0-11),数据平衡完毕复原power值即可
    SQL> show parameter asm_power_limit
    SQL> alter diskgroup data_dg rebalance power 11;
    注:power=0是停止rebalance操作
    
    或也可在加盘时直接添加rebalance指令,如下:
    SQL> alter diskgroup data_dg add disk '/dev/asm-diskh' rebalance power 8;
    注:如添加磁盘报错(新增磁盘不为全新盘,有旧数据在里头),可使用dd命令将磁盘头信息清除掉
    dd if=/dev/zero of=/dev/sdd bs=4096 count=256 --磁盘头信息大小一般是1M。
  7. 删除ASM磁盘

    SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;
    
    SQL> alter diskgroup data_dg drop disk 'DATA_DG_0002'; --按照name来删除
    或:SQL> alter diskgroup data_dg drop disk 'DATA_DG_0002' rebalance power 8;
    
    SQL> select * from v$asm_operation;
    SQL> select GROUP_NUMBER,DISK_NUMBER, MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

    相关资料:
    http://the7.net/news/show-735...
    https://www.361shipin.com/blo...


MothurView
7 声望1 粉丝