oracle 11g rac集群 asm磁盘组增加硬盘

 

创建asm磁盘的几种方式

复制代码
创建asm磁盘方式很多主要有以下几种
1、Faking方式
2、裸设备方式
3、udev方式(它下面有两种方式)
  3.1 uuid方式
  3.2 raw方式(裸设备方式)
4、asmlib方式(oracleasm)

 

本次的操作需求

1、要增加磁盘的磁盘组为:DATA
2、增加磁盘 /dev/sdb1到磁盘组DATA
请参考 https://www.cnblogs.com/aozhejin/p/16006140.html

asm磁盘要求:

1、A disk or partition from a storage array    //一个磁盘或者是磁盘阵列的分区2、An entire disk or the partitions of a disk  //是一个完整的磁盘 或者是一个磁盘的分区
3、Logical volumes               //逻辑卷
4、Network-attached files (NAS)  //NAS(Network-attached storage,网络连接存储)

在第一个节点上的磁盘先分区:

[root@sh01 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-391, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-391, default 391):
Using default value 391

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
//并不需要格式化

[root@sh01 ~]# ll /dev/oracleasm/disks  //列出当前的磁盘

total 0
brw-rw---- 1 oracle dba 8, 49 Jan 20 16:45 CRS
brw-rw---- 1 oracle dba 8, 17 Jan 20 16:45 DATA1
brw-rw---- 1 oracle dba 8, 33 Jan 20 16:45 DATA2

[root@sh02 disks]# oracleasm listdisks  //这个命令也可以
 

 格式化为oracleasm这种格式

[root@sh01 ~]# /etc/init.d/oracleasm createdisk DATA3 /dev/sdb1 
 Writing disk header: done
Instantiating disk: done

[root@sh01 ~]# ll /dev/oracleasm/disks  //已经多出来一个磁盘,被添加为了asm磁盘,已被识别

total 0
brw-rw---- 1 oracle dba 8, 49 Jan 20 16:47 CRS
brw-rw---- 1 oracle dba 8, 17 Jan 20 16:47 DATA1
brw-rw---- 1 oracle dba 8, 33 Jan 20 16:47 DATA2
brw-rw---- 1 oracle dba 8, 65 Jan 20 16:47 DATA3

在第二个节点操作

[root@sh02 ~]#  /etc/init.d/oracleasm scandisks   //扫描集群中的asm磁盘,让其他节点识别
Scanning the system for Oracle ASMLib disks:               [  OK  ]
[root@sh02 ~]#  ll /dev/oracleasm/disks/
total 0
brw-rw---- 1 oracle dba 8, 49 Jan 20 16:54 CRS
brw-rw---- 1 oracle dba 8, 17 Jan 20 16:54 DATA1
brw-rw---- 1 oracle dba 8, 33 Jan 20 16:54 DATA2
brw-rw---- 1 oracle dba 8, 65 Jan 20 16:53 DATA3

 增加asm磁盘到磁盘组操作

[root@sh01 ~]# su - grid
[grid@sh01 ~]$ export ORACLE_SID=+ASM1  //asm实例

  [gird@sh02 ~]$ sqlplus / as sysdba
  SQL*Plus: Release 11.2.0.4.0 Production on Tue Mar 15 22:52:02 2022

  Copyright (c) 1982, 2013, Oracle. All rights reserved.

  Connected to:

  Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

  With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

  Data Mining and Real Application Testing options

SQL> set line 999
SQL> select name,path from v$asm_disk;  //查看原有ASM 磁盘

  NAME PATH
  ------------------------------ --------------------- 
  DATA_0000 /dev/oracleasm/disks/DATA1
  DATA_0001 /dev/oracleasm/disks/DATA2

  2 rows selected.

SQL> alter diskgroup DATA add disk '/dev/oracleasm/disks/DATA3' name DATA_0002;
Diskgroup altered.

  SQL> select name,path from v$asm_disk;  //查看添加的ASM磁盘

  NAME PATH
  ------------------------------ --------------------- 
  DATA_0000 /dev/oracleasm/disks/DATA1
  DATA_0001 /dev/oracleasm/disks/DATA2
  DATA_0002 /dev/oracleasm/disks/DATA3 

  3 rows selected.

//另外我们也可以使用asmca添加磁盘到磁盘组data

 

posted @ 2022-03-14 21:23  jinzi  阅读(3057)  评论(0编辑  收藏  举报