开发者社区> 余二五> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

oracle 11g 使用ASM存储迁移

简介:
+关注继续查看
一、环境描述
rhel 6.6 + Oracle 11.2.0.4
存储更换,需要添加新盘,替换掉旧的存储盘,以下为测试步骤。

二、测试过程
[root@roidb1 ~]# cd /etc/udev
[root@roidb1 udev]# ls
makedev.d  rules.d  udev.conf
[root@roidb1 udev]# cd rules.d/
[root@roidb1 rules.d]# ls
55-usm.rules                 60-pcmcia.rules         70-persistent-net.rules  98-kexec.rules
60-fprint-autosuspend.rules  60-raw.rules            90-alsa.rules            99-oracle-asmdevices.rules
60-openct.rules              70-persistent-cd.rules  90-hal.rules
[root@roidb1 rules.d]# cat 99-oracle-asmdevices.rules 
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB134477b8-eb4c906a", 

NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB02fff4da-d0a0c3a3", 

NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBdfa1c4b9-379f6810", 

NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB47ca97bf-4f2e68c0", 

NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"     
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 

##添加一块新盘
[root@roidb1 rules.d]# scsi_id --whitelisted --replace-whitespace --device=/dev/sdf
1ATA_VBOX_HARDDISK_VBf00cea14-af091329
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# ls
55-usm.rules                 60-pcmcia.rules         70-persistent-net.rules  98-kexec.rules
60-fprint-autosuspend.rules  60-raw.rules            90-alsa.rules            99-oracle-asmdevices.rules
60-openct.rules              70-persistent-cd.rules  90-hal.rules

##修改配置文件
[root@roidb1 rules.d]# vi 99-oracle-asmdevices.rules 
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VB134477b8-eb4c906a", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VB02fff4da-d0a0c3a3", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VBdfa1c4b9-379f6810", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VB47ca97bf-4f2e68c0", NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1AT
A_VBOX_HARDDISK_VBf00cea14-af091329", NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"  Â  
~                                                                                                                        

##传输到节点2~                         
scp 99-oracle-asmdevices.rules 到rac2

[root@roidb1 rules.d]# cat 99-oracle-asmdevices.rules 
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB134477b8-eb4c906a", 

NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB02fff4da-d0a0c3a3", 

NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBdfa1c4b9-379f6810", 

NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB47ca97bf-4f2e68c0", 

NAME="asm-diske", OWNER="grid", GROUP="asmadmin", MODE="0660"     
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBf00cea14-af091329", 

NAME="asm-diskf", OWNER="grid", GROUP="asmadmin", MODE="0660"     
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 
[root@roidb1 rules.d]# 

##重启udev服务,加载配置文件
[root@roidb1 rules.d]# start_udev 
Starting udev: udevd[5477]: GOTO 'pulseaudio_check_usb' has no matching label in: '/lib/udev/rules.d/90-pulseaudio.rules'

##生产/dev/asm-diskf                                                           [  OK  ]
[root@roidb1 rules.d]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Jan 30 19:36 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 32 Jan 30 19:36 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 48 Jan 30 19:36 /dev/asm-diskd
brw-rw---- 1 grid asmadmin 8, 64 Jan 30 19:36 /dev/asm-diske
brw-rw---- 1 grid asmadmin 8, 80 Jan 30 19:36 /dev/asm-diskf

/dev/asm:
total 0

##查看asm磁盘
SQL> col name for a40
SQL> set line 200
SQL> select name,path,state,HEADER_STATUS from v$asm_disk;

NAME                                     PATH                                     STATE            HEADER_STATUS
---------------------------------------- ---------------------------------------- ---------------- ------------------------
                                         /dev/asm-diskf                           NORMAL           CANDIDATE  --要添加的磁盘
CRSDG_0002                               /dev/asm-diskd                           NORMAL           MEMBER
CRSDG_0000                               /dev/asm-diskb                           NORMAL           MEMBER
DATADG_0000                              /dev/asm-diske                           NORMAL           MEMBER
CRSDG_0001                               /dev/asm-diskc                           NORMAL           MEMBER

##使用sysasm添加磁盘
alter diskgroup datadg add disk '/dev/asm-diskf' ;

##加快平衡速度,power=0就是停止rebalance操作,不建议使用11
alter diskgroup datadg rebalance power 11;           

SQL> alter diskgroup datadg rebalance power 11;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERATION  STATE         POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR_CODE
------------ ---------- -------- ---------- ---------- ---------- ---------- ---------- ----------- 

----------------------------------------------------------------------------------------
           2 REBAL      RUN              11         11         22         22          0           0

SQL> 

##继续查看磁盘状态,已添加完成

col name for a15
col path for a15
col state for a10
set line 200
select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

SQL> col name for a15
SQL> col path for a15
SQL> col state for a10
SQL> set line 200
SQL> select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

MODE_STATUS    HEADER_STATUS            MODE_STATUS    STATE        TOTAL_MB    FREE_MB NAME            PATH
-------------- ------------------------ -------------- ---------- ---------- ---------- --------------- ---------------
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0002      /dev/asm-diske
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3788 CRSDG_0001      /dev/asm-diskd
ONLINE         MEMBER                   ONLINE         NORMAL           6144       3977 DATADG_0000     /dev/asm-diskb
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0000      /dev/asm-diskc
ONLINE         MEMBER                   ONLINE         NORMAL           8192       5306 DATADG_0001     /dev/asm-diskf

SQL> 

##删除磁盘

alter diskgroup datadg drop disk 'DATADG_0000'; --按照name来删除

alter diskgroup datadg rebalance power 11;

col error_code for a5
set line 200
select * from v$asm_operation;

##查看平衡速度
SQL> col error_code for a5
SQL> set line 200
SQL> select * from v$asm_operation;

GROUP_NUMBER OPERATION  STATE         POWER     ACTUAL      SOFAR   EST_WORK   EST_RATE EST_MINUTES ERROR
------------ ---------- -------- ---------- ---------- ---------- ---------- ---------- ----------- -----
           2 REBAL      RUN              11         11         47        768       2334           0

SQL> 

SQL> col name for a15
SQL> col path for a15
SQL> col state for a10
SQL> set line 200
SQL> select MODE_STATUS,HEADER_STATUS, MODE_STATUS,state,TOTAL_MB,FREE_MB,name,PATH from v$asm_disk;

MODE_STATUS    HEADER_STATUS            MODE_STATUS    STATE        TOTAL_MB    FREE_MB NAME            PATH
-------------- ------------------------ -------------- ---------- ---------- ---------- --------------- ---------------
ONLINE         FORMER                   ONLINE         NORMAL              0          0                 /dev/asm-diske   ##已删除
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3788 CRSDG_0001      /dev/asm-diskc
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0000      /dev/asm-diskb
ONLINE         MEMBER                   ONLINE         NORMAL           8192       3095 DATADG_0001     /dev/asm-diskf
ONLINE         MEMBER                   ONLINE         NORMAL           4096       3787 CRSDG_0002      /dev/asm-diskd

SQL> 









本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/2067834,如需转载请自行联系原作者

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
阿里云如何打破Oracle迁移上云的壁垒
2018第九届中国数据库技术大会,阿里云数据库产品专家萧少聪带来以阿里云如何打破Oracle迁移上云的壁垒为题的演讲。Oracle是指“数据库管理系统”,面对Oracle迁移上云的壁垒,阿里云如何能够打破它呢?本文提出了Oracle 到云数据库PPAS迁移的方案,这种迁移方案为什么比Oracle到 MySQL系列的迁移容易推动呢?答案即将揭晓。
10105 0
Oracle 数据库性能优化3日实战(企业培训)
课程名称一: Oracle性能优化及调整 课程时长 1天 课程深度: 高级 上机实验: 10%-30% 授课对象: Oracle开发人员、Oracle数据库管理人员,应用程序开发人员 课程描述: 本课程讲述Oracle数据库物理层规划,系统性能的监控,数据库性能参数调整,统计信息的收集,使用自动化调试工具优化数据库,I/O子系统的配置与设计以及性能优化方法论等。
1827 0
Oracle 10g Express Edition(XE) 转至数据库主页中文乱码问题的解决
Oracle 10g Express Edition是Oracle专门为小型用户提供的免费版本。
886 0
+关注
20376
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载