对于Linux使用MultiPath的设备,使用以下命令查看多路径聚合后的设备

multipath –ll
ls -l /dev/mapper/*

使用以下命令,查看在统一设备管理下的dm_uuid设备标识号:

for i in votinghds1 votinghds2 votinghds3 asm_hdsdata1 asm_hdsdata2 asm_hdsarch1 asm_hdsarch2; do
printf "%s %s/n" "$i" "$(udevadm info --query=all --name=/dev/mapper/$i |
grep -i dm_uuid)"; done在99-oracle-asmdevices.rules文件中加入以下内容
KERNEL=="dm-*",SUBSYSTEM=="block",ENV{DM_UUID}=="mpath-36485702100cc1b0b002b63e600000000",SYMLINK+="votinghds1",OWNER="grid",GROUP="asmadmin",MODE="0660"


保存并退出,重启udev服务。

start_udev
Starting udev: [ OK ]
ls -l /dev/dm*

1.5. 创建测试ASM磁盘组
1.5.1. 登录asm实例
以grid 用户执行​​

su - grid
sqlplus / as sysasm

1.5.2. 查看有哪些可用的disk

set line 200 
col PATH for a20
col NAME for a20
select NAME,PATH,OS_MB,TOTAL_MB,FREE_MB from v$asm_disk;


NAME PATH OS_MB TOTAL_MB FREE_MB
-------------------- -------------------- ---------- ---------- ----------
/dev/asm-data17 1048576 0 0
/dev/asm-data20 1048576 0 0
/dev/asm-data16 1048576 0 0
/dev/asm-data19 1048576 0 0
/dev/asm-data18 1048576 0 0

1.5.3. 创建测试磁盘组

create diskgroup hdsdata normal redundancy
failgroup fa1 disk
'/dev/asm-hdsdata1',
'/dev/asm-hdsdata2',
'/dev/asm-hdsdata3',
'/dev/asm-hdsdata4',
'/dev/asm-hdsdata5'
failgroup fa2 disk
'/dev/asm-hdsdata6',
'/dev/asm-hdsdata7',
'/dev/asm-hdsdata8',
'/dev/asm-hdsdata9',
'/dev/asm-hdsdata10';
create diskgroup hdsvote extenal redundancy disk
'/dev/hdsvote1',
'/dev/hdsvote2',
'/dev/hdsvote3',
'/dev/hdsvote4',
'/dev/hdsvote5';

1.5.4. 挂载测试磁盘组

alter diskgroup hdsdata mount;
alter diskgroup hdsvote mount;

1.5.5. 查看磁盘组情况​

set line 200 
col PATH for a20
col NAME for a20
select group_number,disk_number,NAME,PATH,OS_MB,TOTAL_MB,FREE_MB,failgroup,create_date from v$asm_disk;

select group_number,name,TYPE,STATE,TOTAL_MB,REQUIRED_MIRROR_FREE_MB,FREE_MB,USABLE_FILE_MB,ALLOCATION_UNIT_SIZE,OFFLINE_DISKS fromV$asm_diskgroup;

1.6. 测试磁盘组稳定性
1.6.1. 创建测试表空间和用户

su - oracle
$ sqlplus "/as sysdba"
SQL>create tablespace hds_test_tbs datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>alter tablespace hds_test_tbs add datafile '+HDSDATA' size 10240M autoextend on;
SQL>create user hdsuser identified by hdsuser1234 default tablespace hds_test_tbs temporary tablespace temp;
SQL>grant connect,resource,unlimited tablespace,select any dictionary to hdsuser;
SQL>create tablespace hds_vote_tbs datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>alter tablespace hds_vote_tbs add datafile '+HDSVOTE' size 10240M autoextend on;
SQL>create user hdsvote identified by hdsvote1234 default tablespace hds_vote_tbs temporary tablespace temp;
SQL>grant connect,resource,unlimited tablespace,select any dictionary to hdsvote;

1.6.2. 配置SWINGBENCH
按照《SWINGBENCH安装及使用说明.docx》,在PC服务器上配置SWINGBENCH,并按TPC或OLAP测试样例,连接到用户hdsuser和hdsvote持续对数据库实例进行压力加载。但在测试过程中不应负载过大,建议不多于10并行用户。持续压力加载的时间不应该小于120小时。
1.6.3. 测试目的
测试的目的在于提前发现新接入的设备可能存在的问题。以尽可能防止磁盘设备的稳定性影响磁盘组Loadbalance和可能出现的故障。​

  1. 正试迁移
    2.1. 删除测试用户和表空间

sqlplus "/as sysdba"
SQL>drop user hdsuser cascade;
SQL>drop user hdsvote cascade;
SQL>drop tablespace hds_vote_tbs;
SQL>drop tablespace hds_test_tbs;

  1. 2.2. 删除测试磁盘组

sqlplus "/as sysasm"
SQL>drop diskgroup hdsdata;
SQL>drop diskgroup hdsvote;

  1. 2.3. 迁移ocr磁盘组

SQL>select NAME,PATH,FAILGROUP,STATE from v$asm_disk where group_number=<ocr_group_number>;
SQL>alter diskgroup ocrdg
add failgroup VOTE1 disk '/dev/hdsvote1',
failgroup VOTE2 disk '/dev/hdsvote2',
failgroup VOTE3 disk '/dev/hdsvote3',
failgroup VOTE4 disk '/dev/hdsvote4',
failgroup VOTE5 disk '/dev/hdsvote5' rebalance power 8;
SQL>select NAME,PATH,FAILGROUP,STATE from v$asm_disk where group_number=<ocr_group_number>;
SQL> select * from v$asm_operation;
SQL> alter diskgroup ocrdg drop disk ocrdg_001,ocrdg_002,ocrdg_003,ocrdg_004,ocrdg_005 rebalance power 8;
SQL>select NAME,PATH,FAILGROUP,STATE from v$asm_disk where group_number=<ocr_group_number>;

2.4. 利用ASM磁盘组迁移数据
为了减少磁盘组的平衡时间,建议将所有drop/add磁盘放在一个命令中执行,以下示例迁移数据磁盘组磁盘:

SQL>alter diskgroup datadg drop disk datadg_0001,
datadg_0002,datadg_0003,datadg_0004,datadg_0005,
datadg_0006,datadg_0007,datadg_0008
add failgroup fa1 disk
'/dev/asm-hdsdata1',
'/dev/asm-hdsdata2',
'/dev/asm-hdsdata3'
failgroup fa1 disk
'/dev/asm-hdsdata4',
'/dev/asm-hdsdata5',
'/dev/asm-hdsdata6' rebalance power 8;
SQL> select * from v$asm_operation;

以下命令迁移归档磁盘组示例:

SQL>alter diskgroup archdg drop disk archdg_0001,
archdg_0002,archdg_0003,archdg_0004
add failgroup fa1 disk
'/dev/asm-hdsdata7',
'/dev/asm-hdsdata8'
failgroup fa1 disk
'/dev/asm-hdsdata9',
'/dev/asm-hdsdata10' rebalance power 8;
SQL> select * from v$asm_operation;

版权声明:本文为博主原创文章,未经博主允许不得转载。

oracle