共计 5046 个字符,预计需要花费 13 分钟才能阅读完成。
实施 ASM 在线扩容
1. 首先关闭集群
[root@node1 bin]# ./crsctl stop crs
[root@node2 bin]# ./crsctl stop crs
关机,halt
再第一台主机上创建添加两块磁盘 vdi,并设置共享,挂载给 node2
asmn6.vdi 5G
asmn7.vdi 8G
2. 开机挂载,为 Oracle ASM 创建磁盘分区
[root@node1 dev]# ls -la sd*
brw-rw—- 1 root disk 8, 0 May 9 20:56 sda
brw-rw—- 1 root disk 8, 1 May 9 20:56 sda1
brw-rw—- 1 root disk 8, 2 May 9 20:56 sda2
brw-rw—- 1 root disk 8, 96 May 9 20:56 sdg
brw-rw—- 1 root disk 8, 112 May 9 20:56 sdh
[root@node1 ~]# fdisk -l
Disk /dev/sdg: 5368 MB, 5368709120 bytes
Disk /dev/sdh: 8589 MB, 8589934592 bytes
发现 sdg,sdh 两块盘
3. 格式化分区:### 也可以不用。
fdisk /dev/sdg
fdisk /dev/sdh
Command (m for help): n
e extended
p primary partition (1-4)p
Partition number (1-4): 1
First cylinder (1-512, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610):
Using default value 2610
Command (m for help): w
The partition table has been altered!
calling ioctl() to re-read partition table.
Syncing disks.
第一种方法:用 UDEV 绑定裸设备
vi /etc/udev/rules.d/60-raw.rules
ACTION==”add”,KERNEL==”sdg”,RUN+=”/bin/raw /dev/raw/raw1 %N”
ACTION==”add”,KERNEL==”sdh”,RUN+=”/bin/raw /dev/raw/raw2 %N”
ACTION==”add”,KERNEL==”raw[1-2]”,OWNER=”grid”, GROUP=”asmadmin”, MODE=”660″
查看裸设备:
raw -qa
/dev/raw/raw1: bound to major 8, minor 96
/dev/raw/raw2: bound to major 8, minor 112
传送到 node2 节点:
scp /etc/udev/rules.d/60-raw.rules node2:/etc/udev/rules.d/
partprobe
start_UDEV
第二种方法:UDEV 绑定磁盘
for i in g h ;
do
echo “KERNEL==\”sd*\”, BUS==\”scsi\”, PROGRAM==\”/sbin/scsi_id -g -u -s %p\”, RESULT==\”`scsi_id -g -u -s /block/sd$i`\”, NAME=\”asm-disk$i\”, OWNER=\”grid\”, GROUP=\”asmadmin\”, MODE=\”0660\””
done
KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”360080e50003f55d6000007a7535c0dad”, NAME=”asm-diskc”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”360080e50003f55d6000007a9535c0dd1″, NAME=”asm-diske”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”360080e50003f55d6000007a7535c0dad”, NAME=”asm-diskc”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
KERNEL==”sd*”, BUS==”scsi”, PROGRAM==”/sbin/scsi_id -g -u -s %p”, RESULT==”360080e50003f55d6000007a9535c0dd1″, NAME=”asm-diske”, OWNER=”grid”, GROUP=”asmadmin”, MODE=”0660″
传输到其他节点。
scp /etc/udev/rules.d/99-oracle-asmdevices.rules jdserver24:/etc/udev/rules.d/
artprobe
start_udev
[root@quan-rac1 /]# ls -la /dev/a*
crw-rw—- 1 root audio 14, 12 Jul 26 12:58 /dev/adsp
brw-rw—- 1 oracle oinstall 8, 32 Jul 26 13:40 /dev/asm-diskg
brw-rw—- 1 oracle oinstall 8, 48 Jul 26 13:40 /dev/asm-diskh
4.ASM 磁盘组操作
查看磁盘组状态:
select group_number,total_mb,required_mirror_free_mb,free_mb,usable_file_mb,state from v$asm_diskgroup;
GROUP_NUMBER TOTAL_MB REQUIRED_MIRROR_FREE_MB FREE_MB USABLE_FILE_MB STATE
———— ———- ———————– ———- ————– ———–
1 1024 0 922 922 MOUNTED
2 1024 0 748 748 MOUNTED
3 3072 0 468 468 MOUNTED
4 1024 0 628 628 MOUNTED
–TOTAL_MB:磁盘组的大小
–FREE_MB:在不考虑冗余的情况下,剩余的空间大小
–USABLE_FILE_MB:1). 在外部冗余情况下 USABLE_FILE_MB=FREE_MB
2). 普通冗余 USABLE_FILE_MB=FREE_MB/2
3). 高冗余 USABLE_FILE_MB=FREE_MB/3
select group_number,disk_number,name,failgroup,state,path from v$asm_disk order by 1,2;
SELECT GROUP_NUMBER, OPERATION, STATE,POWER,EST_MINUTES FROM V$ASM_OPERATION;
检查 asm_diskstring, 看新加的磁盘是否在相应的目录下
show parameter asm_diskstring
设置 asm_diskstring
alter system set asm_diskstring=’/dev/asm*’,’/dev/raw/raw*’ sid=’*’;
ASM_DISKSTRING = ‘path1′[,’path2’, . . .]
用最简单的话说,就是设置 ASM 启动时检查的磁盘,该选项可以同时指定多个值,并且支持通配符。比如说,只检查 /dev/dsk/ 下的设备,可以设置该参数如下:/dev/dsk/*,默认情况下该参数为空,为空的话,表示 ASM 将查找系统中所有 ASM 拥有读写权限的设备。
ASM_DISKSTRING specifies an operating system-dependent value used by Automatic Storage Management to limit the set of disks considered for discovery. When a new disk is added to a disk group, each Automatic Storage Management instance that has the disk group mounted must be able to discover the new disk using the value of ASM_DISKSTRING.
An attempt to dynamically modify ASM_DISKSTRING will be rejected and the old value retained if the new value cannot be used to discover a disk that is in a disk group that is already mounted.
创建外部冗余磁盘组:
create diskgroup AUX_DATA external redundancy disk ‘/dev/asm-diskg’,’/dev/asm-diskh’;
给现有磁盘组添加磁盘:
alter diskgroup DT02 add disk ‘/dev/raw/raw1′,’/dev/raw/raw2’ rebalance power 10;
select * from v$asm_opration;
注意:
新添加的 asmdiskgroup 并不能在实例重启后自动 mount, 原因在于 asm 采用 pfile 启动实例 默认会去找 asm_diskgroups 参数所列出 diskgroup 并在实例启动时执行 mount.
为了避免有些 diskgroup 不能自动 mount,可采用如下两种办法:
手工修改 pfile, asm_diskgroups 改成 PROD_DATA,AUX_DATA
创建 spfile:create spfile from pfile;
alter system set asm_diskgroups=PROD_DATA,AUX_DATA sid=’*’;
最终:
SQL> select GROUP_NUMBER,DISK_NUMBER,NAME,PATH,TOTAL_MB,FREE_MB from v$asm_disk order by NAME;
如何修改 ASM 的 sys 密码 http://www.linuxidc.com/Linux/2013-09/89744.htm
如何将 ASM 中的数据文件复制到操作系统中 http://www.linuxidc.com/Linux/2013-08/88418.htm
Oracle 11g RAC ASM 磁盘全部丢失后的恢复 http://www.linuxidc.com/Linux/2013-07/87000.htm
Oracle 11g 从入门到精通 PDF+ 光盘源代码 http://www.linuxidc.com/Linux/2013-06/85670.htm
RHEL6 ASM 方式安装 Oracle 11g R2 http://www.linuxidc.com/Linux/2013-06/86002.htm
Oracle 10g 手工创建 ASM 数据库 http://www.linuxidc.com/Linux/2013-01/78229.htm
Ubuntu 12.04(amd64) 安装完 Oracle 11gR2 后各种问题解决方法 http://www.linuxidc.com/Linux/2013-06/86155.htm
如何修改 Oracle 10g ASM 的 sys 密码 http://www.linuxidc.com/Linux/2012-11/75163.htm
更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2016-05/131330.htm