11g RAC 在线存储迁移实现 OCR 磁盘组完美替换
作者 | JiekeXu
来源 | JiekeXu之路(ID: JiekeXu_IT)
转载请联系授权 | (微信ID:xxq1426321293)
说明:需要将 Oracle 数据库 OCR DATA ARCH 等所有老存储磁盘替换为新存储磁盘,
华为存储 替换为 SVC 存储 进行存储迁移。数据库新磁盘如下:
rhdisk100-——rhdisk123 共 24 块盘,
rhdisk100、rhdisk101、rhdisk102 这三块准备为 1g OCR 盘,
rhdisk103 是 100g 的 ARCH 归档盘 rhdisk104-106 是 500G 的 ARCH 归档盘;
rhdisk106-——rhdisk123 是 500G 的数据盘 DATA。
操作系统 64 bit AIX 6.1,11204 RAC 环境,存储已划分好新盘,操作系统也已经完成扫盘,
剩下的步骤就是将磁盘添加进数据库然后通过 ASM 的 REBALANCE 功能将其旧盘踢出数据库,进一步踢出操作系统回收存储,即可实现迁移。
一、磁盘检查
--查看磁盘大小(单位M)
jiekeXur1:/dev#bootinfo -s rhdisk100
1024
jiekeXur1:/dev#bootinfo -s rhdisk101
1024
……………………省略部分……………………………
jiekeXur1:/dev#bootinfo -s rhdisk105
512000
jiekeXur1:/dev#bootinfo -s rhdisk123
512000
--检查磁盘属性
--- 查看磁盘的详细信息
lsattr -El hdisk100
jiekeXur1:/dev#lsattr -El hdisk123
PCM PCM/friend/sddpcm PCM True
PR_key_value none Reserve Key True
algorithm load_balance Algorithm True
clr_q no Device CLEARS its Queue on error True
dist_err_pcnt 0 Distributed Error Percentage True
dist_tw_width 50 Distributed Error Sample Time True
flashcpy_tgtvol no Flashcopy Target Lun False
hcheck_interval 60 Health Check Interval True
hcheck_mode nonactive Health Check Mode True
location Location Label True
lun_id 0x17000000000000 Logical Unit Number ID False
lun_reset_spt yes Support SCSI LUN reset True
max_coalesce 0x40000 Maximum COALESCE size True
max_transfer 0x40000 Maximum TRANSFER Size True
node_name 0x500507680c00122f FC Node Name False
pvid none Physical volume identifier False
q_err yes Use QERR bit True
q_type simple Queuing TYPE True
qfull_dly 2 delay in seconds for SCSI TASK SET FULL True
queue_depth 20 Queue DEPTH True
recoverDEDpath no Recover DED Failed Path True
reserve_policy no_reserve Reserve Policy True
retry_timeout 120 Retry Timeout True
rw_timeout 60 READ/WRITE time out value True
scbsy_dly 20 delay in seconds for SCSI BUSY True
scsi_id 0xde00f7 SCSI ID False
start_timeout 180 START unit time out value True
svc_sb_ttl 0 IO Time to Live True
timeout_policy fail_path Timeout Policy True
unique_id 33213600507680C80008AC00000000000092104214503IBMfcp Device Unique Identification False
ww_name 0x500507680c25122f FC World Wide Name False
--- 检查权限,660 属组 grid:asmadmin
【排序查看ls -ltr /dev |grep rhdisk1*】
ls -l /dev/hdisk1*
jiekeXur1:/dev#ls -l /dev/rhdisk1*
crw-rw---- 1 grid asmadmin 19, 3 Jul 20 20:30 /dev/rhdisk1
crw-rw---- 1 grid asmadmin 19, 14 Jul 20 20:30 /dev/rhdisk10
crw-rw---- 1 grid asmadmin 19, 49 Jul 20 20:11 /dev/rhdisk100
………………………………………省略部分………………………………………………………
crw-rw---- 1 grid asmadmin 19, 47 Jul 20 20:11 /dev/rhdisk109
crw-rw---- 1 grid asmadmin 19, 6 Jul 20 21:35 /dev/rhdisk11
crw-rw---- 1 grid asmadmin 19, 40 Jul 20 20:11 /dev/rhdisk110
--- 检查PVID
lspv | grep hdisk100
jiekeXur1:/dev#lspv | grep hdisk100
hdisk100 none None
jiekeXur1:/dev#
jiekeXur1:/dev#lspv | grep hdisk123
hdisk123 none None
jiekeXur1:/dev#lspv | grep hdisk111
hdisk111 none None
jiekeXur1:/dev#
--- 检查保留策略
lsattr -E -l hdisk111 | grep reserve_policy
jiekeXur1:/dev#lsattr -E -l hdisk111 | grep reserve_policy
reserve_policy no_reserve Reserve Policy True
jiekeXur1:/dev#lsattr -E -l hdisk100 | grep reserve_policy
reserve_policy no_reserve Reserve Policy True
jiekeXur1:/dev#lsattr -E -l hdisk103 | grep reserve_policy
reserve_policy no_reserve Reserve Policy True
jiekeXur1:/dev#
--- 查看磁盘是否为共享磁盘
lsattr -El hdisk100
比对两个主机对应的磁盘号是否一致:unique_id
--- 查看磁盘是否可用
lspv
看 PVID 是否为 none,若为 none 则数据库可用,
再查看数据库当前有没有使用,若没有则可用来扩容 ASM 磁盘组
jiekeXur1:/dev#lspv
hdisk0 00cef2e7a8e8d6b2 rootvg active
…………………………………省略部分输出…………………………………………………
hdisk121 none None
hdisk122 none None
hdisk123 none None
hdisk124 00cef2e76c2e3e1d nxdumpvg active
hdisk125 00cef2e76c2e4837 nxdumpvg active
hdisk126 00cef2e76c2e50e3 nxdumpvg active
hdisk127 00cef2e76c2e5a4c nxdumpvg active
hdisk128 00cef2e76c2e6343 nxdumpvg active
hdisk129 00cef2e76c2e6c77 nxdumpvg active
hdisk31 00cef2e76c35109c rootvg active
二、数据库检查
---储备知识点
---创建磁盘组语法,添加磁盘组示例,查看均衡时间
CREATE DISKGROUP &diskgroup_name EXTERNAL REDUNDANCY DISK '/dev/rhdiskxx';
create diskgroup ARCH EXTERNAL REDUNDANCY disk '/dev/rhdisk13';
alter diskgroup data add disk '/dev/rhdisk19','/dev/rhdisk20','/dev/rhdisk21';
---调整 ASM 磁盘均衡级别
ALTER DISKGROUP DATA REBALANCE POWER 11;
---查看ASM磁盘均衡时间:
select * from v$asm_operation;
---查看 ASM 磁盘使用情况
su - oracle
sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Jul 20 21:39:51 2020
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> set linesize 600;
col NAME for a20;
col PCT_FREE for a30;
select GROUP_NUMBER,NAME,TYPE,STATE,total_mb/1024 total_gb,free_mb/1024 free_gb,round((free_mb/total_mb)*100,2)||'%' pct_free from v$asm_diskgroup;
SQL> SQL> SQL>
GROUP_NUMBER NAME TYPE STATE TOTAL_GB FREE_GB PCT_FREE
------------ -------------------- ------ ----------- ---------- ---------- ------------------------------
1 ARCH EXTERN CONNECTED 5100 4260.47559 83.54%
2 DATA EXTERN CONNECTED 5000 95.5458984 1.91%
3 OCR NORMAL MOUNTED 3 2.09570313 69.86%
---查看数据量总大小 1.4 T
SQL> select sum(bytes)/1024/1024/1024 Total_GB from dba_segments;
TOTAL_GB
----------
1475.66351
---查看 ASM 磁盘组和 操作系统对应的磁盘名称
set pagesize 100
col PATH for a33
col NAME for a15
col FAILGROUP for a15
select GROUP_NUMBER,free_mb,total_mb,FAILGROUP,disk_number,MOUNT_STATUS,mode_status,STATE,HEADER_STATUS,name,PATH from v$asm_disk order by 4,5;
GROUP_NUMBER FREE_MB TOTAL_MB FAILGROUP DISK_NUMBER MOUNT_S MODE_ST STATE HEADER_STATU NAME PATH
------------ ---------- ---------- --------------- ----------- ------- ------- -------- ------------ --------------- ----------------