由于归档日志占用了较大空间,共享存储磁盘空间不足,因此需要对共享存储进行扩容。
#查看下目前磁盘组大小,可用空间,方便后面扩容后进行比对
select group_number,name,total_mb,free_mb from v$asm_diskgroup;
--这里演示用virtualbox模拟添加共享磁盘,然后进行扩容,详细步骤可以参考
virtualbox里怎样实现共享存储_雅冰石的博客-CSDN博客_virtualbox 共享磁盘
这里添加了一块儿5G的盘/dev/sdd。
生产环境添加共享盘需要运维同事添加磁盘。
在其中一个节点上执行(这里在rac1上执行):
fdisk -l
先看下新增了哪个磁盘,这里是新增了sdd
- [root@rac1 ~]# fdisk /dev/sdd
-
- Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
-
- Building a new DOS disklabel with disk identifier 0xa7799732.
-
- 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)
- WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
-
- switch off the mode (command 'c') and change display units to
-
- sectors (command 'u').
-
-
-
- Command (m for help): n
-
- Command action
-
- e extended
-
- p primary partition (1-4)
-
- p
-
- Partition number (1-4): 1
-
- First cylinder (1-1305, default 1):
-
- Using default value 1
-
- Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
-
- Using default value 1305
-
-
-
- Command (m for help): t
-
- Selected partition 1
-
- Hex code (type L to list codes): 8e
-
- Changed system type of partition 1 to 8e (Linux LVM)
-
-
-
- Command (m for help): p
-
-
-
- Disk /dev/sdd: 10.7 GB, 10737418240 bytes
-
- 255 heads, 63 sectors/track, 1305 cylinders
-
- Units = cylinders of 16065 * 512 = 8225280 bytes
-
- Sector size (logical/physical): 512 bytes / 512 bytes
-
- I/O size (minimum/optimal): 512 bytes / 512 bytes
-
- Disk identifier: 0xa7799732
-
-
-
- Device Boot Start End Blocks Id System
-
- /dev/sdd1 1 1305 10482381 8e Linux LVM
-
-
-
- Command (m for help): w
-
- The partition table has been altered!
-
-
-
- Calling ioctl() to re-read partition table.
-
- Syncing disks.
在另一个节点上也能看到分区后的共享盘了:

/*
创建之前先进数据库里查询下现有asm磁盘,避免建重复了,示例:
SQL> select GROUP_NUMBER,name from v$asm_disk;
GROUP_NUMBER NAME
------------ ------------------------------
1 DATA_0000
*/
#在rac1上执行
oracleasm createdisk DATA_0001 /dev/sdd1
#在其他节点上识别下刚建的asm磁盘
[root@rac2 opt]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "DATA_0001"
[root@rac2 opt]# oracleasm listdisks
DATA
DATA_0001
su - grid
sqlplus / as sysasm
SELECT NVL(a.name, '[CANDIDATE]') disk_group_name , b.path disk_file_path , b.name disk_file_name , b.failgroup disk_file_fail_group FROM v$asm_diskgroup a RIGHT OUTER JOIN v$asm_disk b USING (group_number)ORDER BY a.name;

可以看到DATA_0001的disk_group目前是CANDIDATE状态,我们需要将其加入到DATA磁盘组里。
ALTER DISKGROUP 磁盘组名称 ADD DISK '磁盘文件路径/磁盘名';
/*
磁盘组这样查,示例:
SQL> select name from v$asm_diskgroup;
NAME
------------------------------
DATA
*/
示例:
ALTER DISKGROUP DATA ADD DISK '/dev/oracleasm/disks/DATA_0001';
注意,这里一定要在磁盘名前指定磁盘路径,否则执行命令的时候会报错:
ORA-15031: disk specification 'DATA_0001' matches no disks
示例:

SQL> select name from v$asm_disk;
NAME
------------------------------------------------------------
DATA_0000
DATA_0001
select group_number,name,total_mb,free_mb from v$asm_diskgroup;

--本篇文章主要参考了
--udev方式的可以参考这篇文章扩容(还没验证,有时间了可以验验):