1、Oracle数据库教程 oracle RAC Oracle 数据库教程 oracle RAC 更换存储迁移数据oracle RAC 更换存储迁移数据我们利用 ASM rebalance特性实现更换存储迁移数据的需求基本 零宕机时间(操作步骤总结1保证新存储和 RAC 当前节点间的可用性;2新存储划分 LUN ,可以重新规划存储方案;3迁移 OCR 和表决盘4给现有 ASM 磁盘组添加 ASM 磁盘 (新存储分配的 ,充分利用 ASM REBALANCE技术5删除原存储的 ASM 磁盘6观察期1 当前存储信息以下 ASM 磁盘组、 OCR 、 VOTE 信息:ASM 磁盘组:ASMCMD lsd
2、gState Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_f iles NameMOUNTED NORMAL N 512 4096 1048576 3071982 3 071091 298 15353960 N BACK/MOUNTED NORMAL N 512 4096 1048576 4095976 1 561759 633568 4640950 N DATA/MOUNTED NORMAL N 512 4096 1048576 10239610
3、1470 326 505720 N OCR/当前 ASM 有 BACK , DATA , OCR 三个磁盘组,总大小 7TB ,磁盘组主要存放数据文 件和归档日志文件, COR 文件,以下是各磁盘组磁盘信息:SQL select NAME,PATH,total_mb,free_mb from v$asm_disk;NAME PATHTOTAL_MB FREE_MB- - - BACK_VOL1 ORCL:BACK_VOL11023994 390436DATA_VOL1 ORCL:DATA_VOL11023994 390450DATA_VOL2 ORCL:DATA_VOL21023994 390
4、447DATA_VOL3 ORCL:DATA_VOL31023994 390426DATA_VOL4 ORCL:DATA_VOL41023994 1023697DATA_VOL5 ORCL:DATA_VOL51023994 1023698DATA_VOL6 ORCL:DATA_VOL61023994 1023696OCR_VOL1 ORCL:OCR_VOL131376 31075OCR_VOL2 ORCL:OCR_VOL231376 31077OCR_VOL3 ORCL:OCR_VOL339644 3931810 rows selected.OCR&VOTE信息:gridoracle1 bin
5、$ ./ocrcheckStatus of Oracle Cluster Registry is as follows :Version : 3 Total space (kbytes : 262120Used space (kbytes : 2720Available space (kbytes : 259400ID : 2006438789Device/File Name : +OCRDevice/File integrity check succeededDevice/File not configuredDevice/File not configuredDevice/File not
6、 configuredDevice/File not configuredCluster registry integrity check succeededLogical corruption check bypassed due to non-privileged user由于 OCR 和 VOTEDISK 都和 ASM 放在同一个存储上,所以 OCR 和 VOTEDISK 也需要迁移到新的存储上。2 新存储磁盘分区要求:(由存储工程师操作2.1. 共享存储,两台服务器都可以看到新存储分配的磁盘空间。2.2. 如之前 ASM 磁盘组所有存储分区大小,个数保持一致。3 划分后磁盘分区root
7、oracle1 sbin# fdisk -lDisk /dev/cciss/c0d0: 1000.1 GB, 1000171331584 bytes255 heads, 63 sectors/track, 121597 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/cciss/c0d0p1 * 1 13 1043 91 83 Linux/dev/cciss/c0d0p2 14 121597 976623480 8e Linux LVMDisk
8、 /dev/sda: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sda1 1 130541 1048570551 83 LinuxDisk /dev/sdb: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylinders
9、Units = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sdb1 1 130541 1048570551 83 LinuxDisk /dev/sdc: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylinders Units = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System
10、 /dev/sdc1 1 130541 1048570551 83 LinuxDisk /dev/sdd: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sdd1 1 130541 1048570551 83 LinuxDisk /dev/sde: 1073.7 GB, 1073741824000 bytes25
11、5 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sde1 1 130541 1048570551 83 LinuxDisk /dev/sdf: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280
12、bytesDeviceBoot Start End Blocks Id System /dev/sdf1 1 130541 1048570551 83 LinuxDisk /dev/sdg: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sdg1 1 130541 1048570551 83 LinuxDisk
13、/dev/sdh: 107.3 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sdh1 1 4000 32129968+ 83 Linux/dev/sdh2 4001 8000 32130000 83 Linux/dev/sdh3 8001 13054 40596255 83 LinuxWARNING: The size of
14、this disk is2.9 TB (2919504019456 bytes.DOS partition table format can not be used on drives for volumes larger than 2.2 TB (2199023255040 bytes. Use parted(1 and GUID partition table format (GPT.Disk /dev/sdi: 2919.5 GB, 2919504019456 bytes255 heads, 63 sectors/track, 354942 cylindersUnits = cylind
15、ers of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sdi1 1 130000 1044224968+ 83 Linux/dev/sdi2 130001 267349 1103255842+ 83 Li nuxDisk /dev/sdj: 1073.7 GB, 1073741824000bytes -新加盘255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDi
16、sk /dev/sdj doesnt contain a valid partition tableDisk /dev/sdk: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdk doesnt contain a valid partition tableDisk /dev/sdl: 1073.7 GB, 1073741824000 bytes255 heads, 63 s
17、ectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdl doesnt contain a valid partition tableDisk /dev/sdm: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdm doesnt contain a
18、 valid partition tableDisk /dev/sdn: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdn doesnt contain a validpartition tableDisk /dev/sdo: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylinde
19、rsUnits = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdo doesnt conain a valid partition tableDisk /dev/sdp: 1073.7 GB, 1073741824000 bytes255 heads, 63 sectors/track, 130541 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdp doesnt contain a valid partition tableDisk /d
20、ev/sdq: 107.3 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdq doesnt contain a valid partition tableDisk /dev/sdr: 2919.5 GB, 2919504019456 bytes255 heads, 63 sectors/track, 354942 cylindersUnits = cylinders of 16065 *
21、512 = 8225280 bytes Disk /dev/sdr doesnt contain a valid partition tableDisk /dev/sds: 322.1 GB, 322122547200 bytes255 heads, 63 sectors/track, 39162 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sds1 1 39162 314568733+ 8e Linux LVMDisk /dev/sd
22、t: 322.1 GB, 322122547200 bytes255 heads, 63 sectors/track, 39162 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDeviceBoot Start End Blocks Id System /dev/sdt1 1 39162 314568733+ 8e Linux LVM4 配置 ASM 新磁盘/etc/init.d/oracleasm createdisk DATA_VOL01 /dev/sdj1/etc/init.d/oracleasm createdisk
23、DATA_VOL02 /dev/sdk1/etc/init.d/oracleasm createdisk DATA_VOL03 /dev/sdl1/etc/init.d/oracleasm createdisk DATA_VOL04 /dev/sdm1/etc/init.d/oracleasm createdisk DATA_VOL05 /dev/sdn1/etc/init.d/oracleasm createdisk DATA_VOL06 /dev/sdo1/etc/init.d/oracleasm createdisk BACK_VOL01 /dev/sdp1/etc/init.d/ora
24、cleasm createdisk OCR_VOL4 /dev/sdq1/etc/init.d/oracleasm createdisk OCR_VOL5 /dev/sdq2/etc/init.d/oracleasm createdisk OCR_VOL6 /dev/sdq35 创建新的 OCRNEW 磁盘组su gridsqlplus / as sysasmCREATE DISKGROUP OCRNEW NORMAL REDUNDANCYDISK ORCL:OCR_VOL4 NAME VOL4DISK ORCL:OCR_VOL5 NAME VOL5DISK ORCL:OCR_VOL6 NAM
25、E VOL6 ATTRIBUTE compatible.asm=11.2;6 添加 OCR 信息到 OCRNEWrootoracle1 bin# ./ocrconfig -add +OCRNEWrootoracle1 bin# ./ocrcheck -configOracle Cluster Registry configuration is :Device/File Name : +OCRDevice/File Name : +OCRNEWrootoracle1 bin# more /etc/oracle/ocr.loc#Device/file getting replaced by dev
26、ice +OCRNEWocrconfig_loc=+OCRocrmirrorconfig_loc=+OCRNEW local_only=falserootoracle1 bin#可以看到 OCRNEW 磁盘组已经成功添加到 OCR 磁盘信息中迁移 vote 文件当前 votedisk 信息gridoracle1 $ crsctl query css votedisk# STATE File Universal Id File Name Disk group- - - - -1. ONLINE 14f694d9d4414f9ebf85d3ce6b9aef0b (ORCL:OCR_VOL1 OCR
27、2. ONLINE 9f9ee7281c954f8abfcc6e88c33257ac (ORCL:OCR_VOL2 OCR3. ONLINE 38114fd602194fa9bf4d05655b3d89b7 (ORCL:OCR_VOL3 OCR Located 3 voting disk(s.gridoracle1 $ crsctl replace votedisk +OCRNEWSuccessful addition of voting disk 00634ef593ee4f92bf48e8c089cb5565. Successful addition of voting disk 2321
28、59722de04f67bf03a78b757e3bec. Successful addition of voting disk a340d5b23aac4f6fbf9f7b1d59088fa5. Successful deletion of voting disk 14f694d9d4414f9ebf85d3ce6b9aef0b. Successful deletion of voting disk 9f9ee7281c954f8abfcc6e88c33257ac. Successful deletion of voting disk 38114fd602194fa9bf4d05655b3d
29、89b7. Successfully replaced voting disk group with +OCRNEW.CRS-4266: Voting file(s successfully replaced7 创建 ASM 实例 spfile 到 OCR_NEW创建 ASM 实例 spfile 到新创建的 OCR_NEW ASM 磁盘组上 (在一个节点 grid 用户 登录 ASM 实例执行SQL create pfile=/home/grid/asmpfile.ora from spfile;File created.SQL create spfile=+OCRNEW from pfile
30、=/home/grid/asmpfile.ora; File created.8 删除 ASM 磁盘组 OCRrootoracle1 bin# ./ocrconfig -delete +OCR查看 OCR 和 VOTE 新状态与位置rootoracle1 bin# ./ocrcheck & ./crsctl query css votediskStatus of Oracle Cluster Registry is as follows :Version : 3 Total space (kbytes : 262120Used space (kbytes : 2768 Available space (kbytes : 259352ID : 2006438789Device/File Name : +OCRNEWDevice/File integrity check succeededDevice/File not configuredDevice/File not configuredDevice/File not configuredDevice/File not configuredCluster registry integrity check succeededLogical corruption check succeeded
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1