Oracle数据库教程oracle RAC.docx
《Oracle数据库教程oracle RAC.docx》由会员分享,可在线阅读,更多相关《Oracle数据库教程oracle RAC.docx(18页珍藏版)》请在冰豆网上搜索。
![Oracle数据库教程oracle RAC.docx](https://file1.bdocx.com/fileroot1/2022-12/11/bcd27d0f-a0c4-41f1-80f0-bb6a756b489f/bcd27d0f-a0c4-41f1-80f0-bb6a756b489f1.gif)
Oracle数据库教程oracleRAC
Oracle数据库教程
——oracleRAC更换存储迁移数据
oracleRAC更换存储迁移数据
我们利用ASMrebalance特性实现更换存储迁移数据的需求
基本零宕机时间(操作步骤总结
1保证新存储和RAC当前节点间的可用性;
2新存储划分LUN,可以重新规划存储方案;
3迁移OCR和表决盘
4给现有ASM磁盘组添加ASM磁盘(新存储分配的,充分利用ASMREBALANCE技术
5删除原存储的ASM磁盘
6观察期
1当前存储信息
以下ASM磁盘组、OCR、VOTE信息:
ASM磁盘组:
ASMCMD>lsdg
StateTypeRebalSectorBlockAUTotal_MBFree_MBReq_mir_free_MBUsable_file_MBOffline_disksVoting_filesName
MOUNTEDNORMALN51240961048576307198230710912981535396
0NBACK/
MOUNTEDNORMALN5124096104857640959761561759633568464095
0NDATA/
MOUNTEDNORMALN51240961048576102396
10147032650572
0NOCR/
当前ASM有BACK,DATA,OCR三个磁盘组,总大小7TB,磁盘组主要存放数据文件和归档日志文件,COR文件,以下是各磁盘组磁盘信息:
SQL>selectNAME,PATH,total_mb,free_mbfromv$asm_disk;
NAMEPATH
TOTAL_MBFREE_MB
------------------------------------------------------------
--------------------
BACK_VOL1ORCL:
BACK_VOL1
1023994390436
DATA_VOL1ORCL:
DATA_VOL1
1023994390450
DATA_VOL2ORCL:
DATA_VOL2
1023994390447
DATA_VOL3ORCL:
DATA_VOL3
1023994390426
DATA_VOL4ORCL:
DATA_VOL4
10239941023697
DATA_VOL5ORCL:
DATA_VOL5
10239941023698
DATA_VOL6ORCL:
DATA_VOL6
10239941023696
OCR_VOL1ORCL:
OCR_VOL1
3137631075
OCR_VOL2ORCL:
OCR_VOL2
3137631077
OCR_VOL3ORCL:
OCR_VOL3
3964439318
10rowsselected.
OCR&VOTE信息:
[grid@oracle1bin]$./ocrcheck
StatusofOracleClusterRegistryisasfollows:
Version:
3Totalspace(kbytes:
262120
Usedspace(kbytes:
2720
Availablespace(kbytes:
259400
ID:
2006438789
Device/FileName:
+OCR
Device/Fileintegritychecksucceeded
Device/Filenotconfigured
Device/Filenotconfigured
Device/Filenotconfigured
Device/Filenotconfigured
Clusterregistryintegritychecksucceeded
Logicalcorruptioncheckbypassedduetonon-privileged
user
由于OCR和VOTEDISK都和ASM放在同一个存储上,所以OCR和VOTEDISK也需要迁移到新的存储上。
2新存储磁盘分区
要求:
(由存储工程师操作
2.1.共享存储,两台服务器都可以看到新存储分配的磁盘空间。
2.2.如之前ASM磁盘组所有存储分区大小,个数保持一致。
3划分后磁盘分区
[root@oracle1sbin]#fdisk-l
Disk/dev/cciss/c0d0:
1000.1GB,1000171331584bytes
255heads,63sectors/track,121597cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/cciss/c0d0p1*11310439183Linux
/dev/cciss/c0d0p2141215979766234808eLinuxLVM
Disk/dev/sda:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sda11130541104857055183Linux
Disk/dev/sdb:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdb11130541104857055183Linux
Disk/dev/sdc:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdc11130541104857055183Linux
Disk/dev/sdd:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdd11130541104857055183Linux
Disk/dev/sde:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sde11130541104857055183Linux
Disk/dev/sdf:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdf11130541104857055183Linux
Disk/dev/sdg:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdg11130541104857055183Linux
Disk/dev/sdh:
107.3GB,107374182400bytes
255heads,63sectors/track,13054cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdh11400032129968+83Linux
/dev/sdh2400180003213000083Linux
/dev/sdh38001130544059625583Linux
WARNING:
Thesizeofthisdiskis2.9TB(2919504019456bytes.
DOSpartitiontableformatcannotbeusedondrivesforvolumeslargerthan2.2TB(2199023255040bytes.Useparted(1andGUIDpartitiontableformat(GPT.
Disk/dev/sdi:
2919.5GB,2919504019456bytes
255heads,63sectors/track,354942cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdi111300001044224968+83Linux
/dev/sdi21300012673491103255842+83Linux
Disk/dev/sdj:
1073.7GB,1073741824000
bytes--------------------------------新加盘
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Disk/dev/sdjdoesn'tcontainavalidpartitiontable
Disk/dev/sdk:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Disk/dev/sdkdoesn'tcontainavalidpartitiontable
Disk/dev/sdl:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytes
Disk/dev/sdldoesn'tcontainavalidpartitiontable
Disk/dev/sdm:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytesDisk/dev/sdmdoesn'tcontainavalidpartitiontable
Disk/dev/sdn:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytesDisk/dev/sdndoesn'tcontainavalidpartitiontable
Disk/dev/sdo:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytesDisk/dev/sdodoesn'tconainavalidpartitiontable
Disk/dev/sdp:
1073.7GB,1073741824000bytes
255heads,63sectors/track,130541cylinders
Units=cylindersof16065*512=8225280bytesDisk/dev/sdpdoesn'tcontainavalidpartitiontable
Disk/dev/sdq:
107.3GB,107374182400bytes
255heads,63sectors/track,13054cylinders
Units=cylindersof16065*512=8225280bytesDisk/dev/sdqdoesn'tcontainavalidpartitiontable
Disk/dev/sdr:
2919.5GB,2919504019456bytes
255heads,63sectors/track,354942cylinders
Units=cylindersof16065*512=8225280bytesDisk/dev/sdrdoesn'tcontainavalidpartitiontable
Disk/dev/sds:
322.1GB,322122547200bytes
255heads,63sectors/track,39162cylinders
Units=cylindersof16065*512=8225280bytesDevice
BootStartEndBlocksIdSystem/dev/sds1139162314568733+8eLinuxLVM
Disk/dev/sdt:
322.1GB,322122547200bytes
255heads,63sectors/track,39162cylinders
Units=cylindersof16065*512=8225280bytes
Device
BootStartEndBlocksIdSystem/dev/sdt1139162314568733+8eLinuxLVM
4配置ASM新磁盘
/etc/init.d/oracleasmcreatediskDATA_VOL01/dev/sdj1
/etc/init.d/oracleasmcreatediskDATA_VOL02/dev/sdk1
/etc/init.d/oracleasmcreatediskDATA_VOL03/dev/sdl1
/etc/init.d/oracleasmcreatediskDATA_VOL04/dev/sdm1
/etc/init.d/oracleasmcreatediskDATA_VOL05/dev/sdn1
/etc/init.d/oracleasmcreatediskDATA_VOL06/dev/sdo1
/etc/init.d/oracleasmcreatediskBACK_VOL01/dev/sdp1
/etc/init.d/oracleasmcreatediskOCR_VOL4/dev/sdq1
/etc/init.d/oracleasmcreatediskOCR_VOL5/dev/sdq2
/etc/init.d/oracleasmcreatediskOCR_VOL6/dev/sdq3
5创建新的OCRNEW磁盘组
su–grid
sqlplus/assysasm
CREATEDISKGROUPOCRNEWNORMALREDUNDANCY
DISK'ORCL:
OCR_VOL4'NAMEVOL4
DISK'ORCL:
OCR_VOL5'NAMEVOL5
DISK'ORCL:
OCR_VOL6'NAMEVOL6ATTRIBUTE'compatible.asm'='11.2';
6添加OCR信息到OCRNEW
[root@oracle1bin]#./ocrconfig-add+OCRNEW
[root@oracle1bin]#./ocrcheck-config
OracleClusterRegistryconfigurationis:
Device/FileName:
+OCR
Device/FileName:
+OCRNEW
[root@oracle1bin]#more/etc/oracle/ocr.loc
#Device/filegettingreplacedbydevice+OCRNEW
ocrconfig_loc=+OCR
ocrmirrorconfig_loc=+OCRNEW
local_only=false
[root@oracle1bin]#
可以看到OCRNEW磁盘组已经成功添加到OCR磁盘信息中
迁移vote文件
当前votedisk信息
[grid@oracle1~]$crsctlquerycssvotedisk
##STATEFileUniversalIdFileNameDiskgroup
------------------------------------------
1.ONLINE14f694d9d4414f9ebf85d3ce6b9aef0b(ORCL:
OCR_VOL1[OCR]
2.ONLINE9f9ee7281c954f8abfcc6e88c33257ac(ORCL:
OCR_VOL2[OCR]
3.ONLINE38114fd602194fa9bf4d05655b3d89b7(ORCL:
OCR_VOL3[OCR]Located3votingdisk(s.
[grid@oracle1~]$crsctlreplacevotedisk+OCRNEW
Successfuladditionofvotingdisk00634ef593ee4f92bf48e8c089cb5565.Successfuladditionofvotingdisk232159722de04f67bf03a78b757e3bec.Successfuladditionofvotingdiska340d5b23aac4f6fbf9f7b1d59088fa5.Successfuldeletionofvotingdisk14f694d9d4414f9ebf85d3ce6b9aef0b.Successfuldeletionofvotingdisk9f9ee7281c954f8abfcc6e88c33257ac.Successfuldeletionofvotingdisk38114fd602194fa9bf4d05655b3d89b7.Successfullyreplacedvotingdiskgroupwith+OCRNEW.
CRS-4266:
Votingfile(ssuccessfullyreplaced
7创建ASM实例spfile到OCR_NEW
创建ASM实例spfile到新创建的OCR_NEWASM磁盘组上(在一个节点grid用户登录ASM实例执行
SQL>createpfile='/home/grid/asmpfile.ora'fromspfile;
Filecreated.
SQL>createspfile='+OCRNEW'frompfile='/home/grid/asmpfile.ora';Filecreated.
8删除ASM磁盘组OCR
[root@oracle1bin]#./ocrconfig-delete+OCR
查看OCR和VOTE新状态与位置
[root@oracle1bin]#./ocrcheck&&./crsctlquerycssvotedisk
StatusofOracleClusterRegistryisasfollows:
Version:
3Totalspace(kbytes:
262120
Usedspace(kbytes:
2768
Availablespace(kbytes:
259352
ID:
2006438789
Device/FileName:
+OCRNEW
Device/Fileintegritychecksucceeded
Device/Filenotconfigured
Device/Filenotconfigured
Device/Filenotconfigured
Device/Filenotconfigured
Clusterregistryintegritychecksucceeded
Logicalcorruptionchecksucceeded