VirtualBox中實施ASM擴容實施記錄

來源:互聯網
上載者:User

VirtualBox中實施ASM擴容實施記錄

實施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密碼

如何將ASM中的資料檔案複製到作業系統中

Oracle 11g RAC ASM磁碟全部丟失後的恢複

Oracle 11g從入門到精通 PDF+光碟片原始碼

RHEL6 ASM方式安裝Oracle 11g R2

Oracle 10g 手工建立ASM資料庫

Ubuntu 12.04(amd64)安裝完Oracle 11gR2後各種問題解決方案

如何修改Oracle 10g ASM的sys密碼

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.