十大靠谱网赌软件驻场运维团队收到服务申请,在尽量短的时间内完成停机迁移,将数据库数据迁移至新存储,调优性能以满足业务需求。工程师进行了详细分析,实施了如下迁移方案:
一、准备工作
1、涉及主机
a.收集信息
数据库版本 :Oracle 11.2.0.1.0
环境 :RAC双节点
操作系统版本:Linuxversion2.6.18-128.7AXS3
b.主机wwn
数据库服务器1: **.**.**.**
view@tvcdb1[tvcdbs1]/home/view$ cat /proc/scsi/qla2xxx/* | grep adapter-port
scsi-qla0-adapter-port=*************;
scsi-qla1-adapter-port=****************;
数据库服务器2: **.**.**.**
view@tvcdb2[tvcdbs2]/home/view$ cat /proc/scsi/qla2xxx/* | grep adapter-port
scsi-qla0-adapter-port=*************;
scsi-qla1-adapter-port=*************;
scsi-qla2-adapter-port=************;
工程师根据主机wwn划zone。
二、磁盘规划
1、原有存储阵列磁盘使用情况
主机名 | IP | vgname | pvname | 单盘大小 |
tvcdbs1 | **.**.**.** | vg00 vg01 | /dev/cciss/c0d0p2 /dev/sdiski | 136.50G 60.00G |
tvcdbs2 | **.**.**.** | vg00 | /dev/cciss/c0d0p2 | 136.50G |
主机 | 功能 | 设备 | 大小 |
数据库服务器1 | DGDATA | /dev/sdiskg(DGDATA_0000) | 70G |
/dev/sdiskh(DGDATA_0001) | 70G |
OCR_VOTE | /dev/sdiska(OCR_VOTE_0000) | 1G |
/dev/sdiskb(OCR_VOTE_0001) | 1G |
/dev/sdiskc(OCR_VOTE_0002) | 1G |
/dev/sdiskd(OCR_VOTE_0003) | 1G |
/dev/sdiske(OCR_VOTE_0004) | 1G |
/dev/sdiskf(OCR_VOTE_0005) | 1G |
2、新存储阵列磁盘规划表
主机 | 功能 | 设备 | 大小 |
数据库服务器1 | DGDATA | /dev/sdiskp(DGDATA_0000) | 70G |
/dev/sdiskq(DGDATA_0001) | 70G |
OCR_VOTE | /dev/sdiskj(OCR_VOTE_0000) | 1G |
/dev/sdiskk(OCR_VOTE_0001) | 1G |
/dev/sdiskl(OCR_VOTE_0002) | 1G |
/dev/sdiskm(OCR_VOTE_0003) | 1G |
/dev/sdiskn(OCR_VOTE_0004) | 1G |
/dev/sdisko(OCR_VOTE_0005) | 1G |
文件系统
主机名 | IP | 标签 | 大小 | VG | 备注 |
tvcdbs1 | **.**.**.** | /dev/mapper/vg01-lv_dbbak | 50G | vg_dbbak-lv_dbbak 总大小50G | 单节点 |
三、Map磁盘
存储工程师划盘,并记录新划Lun盘的wwid。
需求: 共享:70G*2块 1G*6块
非共享: 60G*1块(节点1)
四、备份系统信息
1、基本信息
#view用户执行:
mkdir -p /home/view/20200725
/sbin/netstat -rn > /home/view/20200725/route.20200725
/sbin/ifconfig > /home/view/20200725/if.20200725
df -h > /home/view/20200725/df.20200725
cp /etc/udev/rules.d/20-names.rules /etc/udev/rules.d/20-names.rules.20200725
2、系统原有盘的wwid
sfdisk -s|grep -v dm-|awk -F ':' '{print $1}'|awk -F '/dev/' '{print$2}'>/home/view/20200725/sfdisk_before.txt
while read wwid; do scsi_id -g -u -s /block/$wwid >>/home/view/20200725/wwid_before.txt; done
cat wwid_before.txt
sort -u wwid_before.txt >wwid_before.txt.bak
cat wwid_before.txt.bak
五、连接新存储
1、停库(Oracle用户两节点)
sqlplus / as sysdba
SQL> shutdown immediate;
2、停集群并disable crs(Root用户两节点)
. ~grid/.bash_profile
crsctl disable crs
crsctl stop crs
3、重启服务器,找出新认到的盘wwid
sfdisk -s|grep -v dm-|awk -F ':' '{print $1}'|awk -F '/dev/' '{print$2}'>/home/view/20200725/sfdisk_after.txt
while read wwid; do scsi_id -g -u -s /block/$wwid >>/home/view/20200725/wwid_after.txt; done
cat wwid_after.txt
sort -u wwid_before.txt >wwid_after.txt.bak
cat wwid_after.txt.bak
根据wwid号区分出新认到的9块盘。
4、绑盘
修改 /etc/udev/rules.d/20-names.rules 配置文件,新增如下内容:
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sda%n", SYMLINK="sdiskaj%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdb%n", SYMLINK="sdiskk%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdc%n", SYMLINK="sdiskl%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdd%n", SYMLINK="sdiskm%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sde%n", SYMLINK="sdiskn%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdf%n", SYMLINK="sdisko%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdg%n", SYMLINK="sdiskp%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdh%n", SYMLINK="sdiskq%n"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="*", NAME="sdi%n", SYMLINK="sdiskr%n"
5、重新扫描Lun盘
start_udev
确认新绑盘生效。
6、确认新盘权限
ll /dev/sdisk*
确认属主、属组为grid:asmadmin, 权限为660;
chown grid:asmadmin /dev/sdiskj
chown grid:asmadmin /dev/sdiskk
chown grid:asmadmin /dev/sdiskl
chown grid:asmadmin /dev/sdiskm
chown grid:asmadmin /dev/sdiskn
chown grid:asmadmin /dev/sdisko
chown grid:asmadmin /dev/sdiskp
chown grid:asmadmin /dev/sdiskq
chmod 660 /dev/sdiskj
chmod 660 /dev/sdiskk
chmod 660 /dev/sdiskl
chmod 660 /dev/sdiskm
chmod 660 /dev/sdiskn
chmod 660 /dev/sdisko
chmod 660 /dev/sdiskp
chmod 660 /dev/sdiskq
六、ASM磁盘组迁移
1、启动数据库
a.拉起集群(Root用户两个节点)
. ~grid/.bash_profile
crsctl start crs
crsctl enable crs
b.拉起实例(Oracle用户两个节点)
sqlplus / as sysdba
SQL>select instance_name,status,startup_time from gv$instance;
SQL>select name,open_mode from gv$database;
2、登录
su - grid
sqlplus / as sysasm
3、查询磁盘R
SQL> select group_number, name, state, type, total_mb/1024 total_gb, free_mb/1024 free_gb from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE TOTAL_GB FREE_GB ------------ ---------- ---------- ------------ ---------- -- 1 OCR_VOTE MOUNTED NORMAL 6 5.08984375 2 DGDATA MOUNTED EXTERN 140 57.0966797 |
4、查询磁盘组中的磁盘
set linesize 200
col path format a20
col name format a20
col HEADER_STATUS format a15
select disk_number, path, name, header_status,total_mb/1024, free_mb/1024
from v$asm_disk where group_number = 1;
DISK_NUMBER PATH NAME HEADER_STA TOTAL_MB/1024 FREE_MB/1024 ----------- ------------ ------------- ---------- ------------- ------------ 5 /dev/sdiskf OCR_VOTE_0005 MEMBER 1 .864257813 2 /dev/sdiskc OCR_VOTE_0002 MEMBER 1 .831054688 1 /dev/sdiskb OCR_VOTE_0001 MEMBER 1 .83203125 0 /dev/sdiska OCR_VOTE_0000 MEMBER 1 .833984375 4 /dev/sdiske OCR_VOTE_0004 MEMBER 1 .864257813 3 /dev/sdiskd OCR_VOTE_0003 MEMBER 1 .864257813 |
select disk_number, path, name, header_status,total_mb/1024, free_mb/1024
from v$asm_disk where group_number = 2;
DISK_NUMBER PATH NAME HEADER_STA TOTAL_MB/1024 FREE_MB/1024 ----------- ------------ ------------ ---------- ------------- ------------ 0 /dev/sdiskg DGDATA_0000 MEMBER 70 28.5478516 1 /dev/sdiskh DGDATA_0001 MEMBER 70 28.5488281 |
5、替换DGDATA磁盘组(Oracle用户一节点)
a.#DGDATA旧磁盘的状态
set linesize 200 pages 1000;
col name format a16;
col path format a30;
col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB/1024 from v$asm_disk where path in ('/dev/sdiskg','/dev/sdiskh');
NAME PATH HEADER_STATUS TOTAL_MB/1024 ------------ --------------- ---------------- ------------- DGDATA_0000 /dev/sdiskg MEMBER 70 DGDATA_0001 /dev/sdiskh MEMBER 70 |
#核对盘的HEADER_STATUS是"MEMBER"
#核对盘的大小:70G
b.#DGDATA新磁盘的状态
SQL> set linesize 200 pages 1000;
SQL> col name format a16;
SQL> col path format a30;
SQL> col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB
from v$asm_disk
where path in ('/dev/sdiskp','/dev/sdiskq');
#核对盘的HEADER_STATUS是"FORMER"或"CANDIDATE"
# 核对有2块盘:/dev/sdiskp和/dev/sdiskq
# 核对2块盘的大小: 70G
c.添加并删除DGDATA磁盘组:
alter diskgroup DGDATA add disk '/dev/sdiskp','/dev/sdiskq' drop disk DGDATA_0000,DGDATA_0001 rebalance power 10;
d.监控Rebalance状态:
select * from v$asm_operation;
e.#DGDATA新磁盘的状态
set linesize 200 pages 1000;
col name format a16;
col path format a30;
col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB
from v$asm_disk
where path in ('/dev/sdiskp','/dev/sdiskq');
#核对盘的HEADER_STATUS是"MEMBER"
#核对盘的大小:70G
f.#DGDATA旧磁盘的状态
set linesize 200 pages 1000;
col name format a16;
col path format a30;
col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB
from v$asm_disk
where path in ('/dev/sdiskg','/dev/sdiskh');
#核对盘的HEADER_STATUS是"FORMER"
#核对盘的大小:70G
6、替换OCR_VOTE磁盘组(oracle用户一节点)
a.#OCR_VOTE旧磁盘的状态
set linesize 200 pages 1000;
col name format a16;
col path format a30;
col HEADER_STATUS format a16;
select name,path,HEADER_STATUS,TOTAL_MB/1024 from v$asm_disk where path in ('/dev/sdiska','/dev/sdiskb','/dev/sdiskc','/dev/sdiskd','/dev/sdiske','/dev/sdiskf');
NAME PATH HEADER_STATUS TOTAL_MB/1024 -------------- --------------- ---------------- ------------- OCR_VOTE_0005 /dev/sdiskf MEMBER 1 OCR_VOTE_0002 /dev/sdiskc MEMBER 1 OCR_VOTE_0001 /dev/sdiskb MEMBER 1 OCR_VOTE_0000 /dev/sdiska MEMBER 1 OCR_VOTE_0004 /dev/sdiske MEMBER 1 OCR_VOTE_0003 /dev/sdiskd MEMBER 1 |
#核对盘的HEADER_STATUS是"MEMBER"
#核对盘的大小:1G
b.#OCR_VOTE新磁盘的状态
set linesize 200 pages 1000; col name format a15; col path format a15; col HEADER_STATUS format a16; select name,path,HEADER_STATUS,TOTAL_MB from v$asm_disk where path in ('/dev/sdiskj','/dev/sdiskk','/dev/sdiskl','/dev/sdiskm','/dev/sdiskn','/dev/sdisko'); |
#核对盘的HEADER_STATUS是"FORMER"或"CANDIDATE"
# 核对有6块盘:/dev/sdiskj到/dev/sdisko
# 核对6块盘的大小: 1G
c.添加并删除OCR_VOTE磁盘组:
alter diskgroup OCR_VOTE add disk '/dev/sdiskj','/dev/sdiskk','/dev/sdiskl','/dev/sdiskm','/dev/sdiskn','/dev/sdisko' drop disk OCR_VOTE_0000,OCR_VOTE_0001,OCR_VOTE_0002,OCR_VOTE_0003,OCR_VOTE_0004,OCR_VOTE_0005 rebalance power 10; |
d.监控Rebalance状态:
select * from v$asm_operation; |
e.#OCR_VOTE新磁盘的状态
set linesize 200 pages 1000; col name format a15; col path format a15; col HEADER_STATUS format a16; select name,path,HEADER_STATUS,TOTAL_MB from v$asm_disk where path in ('/dev/sdiskj','/dev/sdiskk','/dev/sdiskl','/dev/sdiskm','/dev/sdiskn','/dev/sdisko' ); |
#核对盘的HEADER_STATUS是"MEMBER"
#核对盘的大小: 1G
f.#OCR_VOTE旧磁盘的状态
set linesize 200 pages 1000; col name format a16; col path format a15; col HEADER_STATUS format a16; select name,path,HEADER_STATUS,TOTAL_MB from v$asm_disk where path in ('/dev/sdiska','/dev/sdiskb','/dev/sdiskc','/dev/sdiskd','/dev/sdiske','/dev/sdiskf'); |
#核对盘的HEADER_STATUS是"FORMER"
#核对盘的大小:1G
七、文件系统迁移
需要迁移的信息
a.文件系统:
/dev/mapper/vg01-lv_dbbak 50G 377M 47G 1% /dbbak
b.组成文件系统的PV信息:
[root@tvcdb1 by-id]# pvs
PV VG Fmt Attr PSize PFree
/dev/cciss/c0d0p2 VG00 lvm2 a- 136.50G 13.50G
/dev/sdiski vg01 lvm2 a- 60.00G 10.00G
c.添加新存储的PV到vg_appdata中:
pvcreate /devsdiskr
vgextend vg01 /devsdiskr
d.将数据从旧PV移动到新PV,两个PV依次操作:
Pvmove /dev/sdiski /dev/sdiskr
e.上述操作后旧pv中无数据,pv会从lv中剔除,将旧pv从vg中手工删除:
vgreduce vg01 /dev/sdiski
f.主机层面删除旧pv信息:
pvremove /dev/sdiski
八、修改配置文件
/etc/rc.local(重启自动更改磁盘权限,确保数据库正常运行。)
/etc/udev/rules.d/20-names.rules
重新start_udev
九、迁移完成
验证数据库、集群状态正常,系统时间、路由、网络、文件系统挂载情况正常。
存储迁移完成,通知应用拉起服务,进行验证,应用确认正常后,本次迁移成功。
十、注意事项
1、应急方案:如磁盘组迁移失败,需将原磁盘组重新加回,同时删除新盘;
2、开始操作前进行完整的数据库全备及归档备份;
3、修改udev配置文件时注意字符的变动,防止磁盘无法识别;
4、注意数据库磁盘权限的修改及确认;
5、对比两节点,保证两边认到的磁盘一致;
6、应用业务停止后,方能进行停机操作。业务操作时推荐在ASM平衡中选择级别10,以保证耗时少,快速恢复业务运转。
如欲了解更多,请登录十大靠谱网赌软件官方网站:oa2z.zzx007.com