效率工具,rhel7 生成emcpower udev定义

160阅读 0评论2021-07-21 brjl
分类:Oracle


扩15个盘,要一个一个写太麻烦了

  1. # 查看当前配置(oracle、grid 都可以)

  2. sqlplus / as sysdba
  3. col path for a40
  4. set lin 120 pages 100
  5. select group_number,path,total_mb,free_mb from v$asm_disk order by 1,2;
 select GROUP_NUMBER,name from v$asm_diskgroup order by 1;
  1. # 查看asm磁盘组使用率

  2. col name for a15
  3. select GROUP_NUMBER,name,trunc((total_mb-free_mb)/1024) used_g,trunc(total_mb/1024) total_g, trunc(free_mb/1024) free_g,round((total_mb-free_mb)/total_mb*100,2) used_percent from v$asm_diskgroup order by used_percent desc ;


  4. # 先备份

  5. cp /etc/udev/rules.d/99-oracle-asmdevices.rules /tmp/99-oracle-asmdevices.rules_$(date "+%Y%m%d%H%M%S")

  6. # 取出还没授权的新盘,编辑好直接插入规则文件

  7. for i in `cat /proc/partitions | awk {'print $4'} |grep emcpower`; do val=`/sbin/blockdev --getsize64 /dev/$i` ; val2=`expr $val / 1073741824`; echo "/dev/$i: $val2 `/usr/lib/udev/scsi_id -gud /dev/$i`" ; done

  8. # 将描述信息存放到临时文件

  9. ls -l /dev/emcpower*

  10. rm -fr /tmp/a.rules
  11. for i in ` grep emcpower /proc/partitions|awk {'print $4'} ` ;
  12. do
  13.  echo "KERNEL==\"emcpower*\",SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/usr/lib/udev/scsi_id -gud /dev/$i`\", SYMLINK+=\"asmdisk/ARCH05\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\" " >> /tmp/a.rules ;
  14. done
  15. cat /tmp/a.rules

  16. # 手工检查修改一下设备名称,将ARCH05改为实际需要的

  17. vi /etc/udev/rules.d/99-oracle-asmdevices.rules

  18. 生效

  19. /sbin/udevadm control --reload-rules
  20. /sbin/udevadm trigger --type=devices --action=change

  21. ls -l /dev/asmdisk/* 确认是否有新的asm磁盘,且属主正确

  22. 如果没问题直接复制到节点2

  23. scp /etc/udev/rules.d/99-oracle-asmdevices.rules node2:/etc/udev/rules.d/99-oracle-asmdevices.rules
  24. 执行上面两个 udevadm 命令,然后ls 看是否和主机1一样

  25. 添加到磁盘组(grid用户)

  26. sqlplus / as sysdba
  27. alter diskgroup ARCHDG add disk '/dev/asmdisk/ARCH05','dev/asmdisk/ARCH06','dev/asmdisk/ARCH07' rebalance power 11;

  28. 查进度

  29. col error_code for a50
  30. set lin 300 pages 100
  31. select group_number,operation,state,power,actual,sofar,est_work,est_minutes,error_code,round(sofar/ est_work*100,1) per from v$asm_operation;



希望能管用
上一篇:监控dg延时多少秒
下一篇:dg归档gap的处理