公司的数据库存储老化,需要新的存储进行替换,为了减少对业务的影响,采用添加、删除磁盘的方式进行替换,这个方式可以参考我的另一篇uuid方式替换数据库存储;
本文是在存储替换的时候,发现很久之前使用afd安装的磁盘组有些问题,就想将afd格式的挂载方式改成普通的裸磁盘方式,才有了本文测试步骤:
GROUP_NUMBER NAME MODE_ST STATE HEADER_STATU PATH DISK_NUMBER TOTAL_SIZE FREE_SIZE
1 ARCH ONLINE NORMAL MEMBER AFD:ARCH 0 300G 299.65G
select GROUP_NUMBER,name,state,type,ALLOCATION_UNIT_SIZE,round(total_mb/1024,2) || ‘G’ as total_size , round(free_mb/1024,2) || ‘G’ as free_size,
USABLE_FILE_MB/1024 usableG from v$asm_diskgroup;
GROUP_NUMBER NAME STATE TYPE ALLOCATION_UNIT_SIZE TOTAL_SIZE FREE_SIZE USABLEG
1 OCR MOUNTED EXTERN 4194304 300G 299.65G 299.648438
Diskgroup altered.
查看rebalance进度,测试环境还挺快的,一下子就rebalance完了
SQL> select * from v$asm_operation;
no rows selected
FAILGROUP GROUP_NUMBER NAME MODE_ST STATE HEADER_STATU PATH DISK_NUMBER TOTAL_SIZE FREE_SIZE
ARCH 1 ARCH ONLINE NORMAL MEMBER AFD:ARCH 0 300G 299.8G
CRS 1 CRS ONLINE NORMAL MEMBER /dev/raw/raw12 1 300G 299.84G
Diskgroup altered.
FAILGROUP GROUP_NUMBER NAME MODE_ST STATE HEADER_STATU PATH DISK_NUMBER TOTAL_SIZE FREE_SIZE
CRS 1 CRS ONLINE NORMAL MEMBER /dev/raw/raw12 1 300G 299.65G
查看afd加载的路径,如果没有afd_dsset添加路径
[root@d2-dbrac21 ~]# asmcmd afd_dsget
ASMCMD-00003: ORACLE_BASE environment variable not set
[root@d2-dbrac21 ~]# export ORACLE_BASE=/u01/app/grid/
[root@d2-dbrac21 ~]# asmcmd dsget
parameter:AFD:*
profile:AFD:*
添加普通磁盘的路径
[root@d2-dbrac21 ~]# asmcmd dsset ‘/dev/raw/raw*’,'AFD:’
[root@d2-dbrac21 ~]# asmcmd dsget
parameter:/dev/raw/raw, AFD:*
profile:/dev/raw/raw*,AFD:*
查看afd现在的状态
[root@d2-dbrac21 ~]# asmcmd afd_stte
ASMCMD-00003: ORACLE_BASE environment variable not set
[root@d2-dbrac21 ~]# asmcmd afd_state
ASMCMD-00003: ORACLE_BASE environment variable not set
[root@d2-dbrac21 ~]# export ORACLE_BASE=/u01/app/grid/
[root@d2-dbrac21 ~]# asmcmd afd_state
ASMCMD-9526: The AFD state is ‘LOADED’ and filtering is ‘ENABLED’ on host ‘d2-dbrac21’
将afd filter禁用掉,要不然会随着crs启动而启动
[root@d2-dbrac21 ~]# asmcmd afd_filter -d
[root@d2-dbrac21 ~]# asmcmd afd_state
ASMCMD-9526: The AFD state is ‘LOADED’ and filtering is ‘DISABLED’ on host ‘d2-dbrac21’
查看磁盘自启动状态
[root@d2-dbrac21 ~]# asmcmd afd_lsdsk
Label Filtering Path
ARCH DISABLED /dev/raw/raw11
CRS DISABLED /dev/raw/raw12
[root@d2-dbrac21 ~]# /u01/app/19.0.0/grid/bin/acfsload stop
[root@d2-dbrac21 ~]# /u01/app/19.0.0/grid/bin/asmcmd afd_deconfigure
ASMCMD-9523: command cannot be used when Oracle Clusterware stack is up
[root@d2-dbrac21 ~]# /u01/app/19.0.0/grid/bin/crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.crsd’ on ‘d2-dbrac21’
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on server ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.LISTENER.lsnr’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.cvu’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.qosmserver’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.LISTENER_SCAN1.lsnr’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.chad’ on ‘d2-dbrac21’
CRS-33673: Attempting to stop resource group ‘ora.asmgroup’ on server ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.OCR.dg’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.OCR.dg’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.asm’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.LISTENER.lsnr’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.d2-dbrac21.vip’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.cvu’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.LISTENER_SCAN1.lsnr’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.scan1.vip’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.asm’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.ASMNET1LSNR_ASM.lsnr’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.d2-dbrac21.vip’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.scan1.vip’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.chad’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.ASMNET1LSNR_ASM.lsnr’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.asmnet1.asmnetwork’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.asmnet1.asmnetwork’ on ‘d2-dbrac21’ succeeded
CRS-33677: Stop of resource group ‘ora.asmgroup’ on server ‘d2-dbrac21’ succeeded.
CRS-2677: Stop of ‘ora.qosmserver’ on ‘d2-dbrac21’ succeeded
CRS-2672: Attempting to start ‘ora.qosmserver’ on ‘d2-dbrac22’
CRS-2672: Attempting to start ‘ora.scan1.vip’ on ‘d2-dbrac22’
CRS-2672: Attempting to start ‘ora.cvu’ on ‘d2-dbrac22’
CRS-2672: Attempting to start ‘ora.d2-dbrac21.vip’ on ‘d2-dbrac22’
CRS-2676: Start of ‘ora.cvu’ on ‘d2-dbrac22’ succeeded
CRS-2676: Start of ‘ora.d2-dbrac21.vip’ on ‘d2-dbrac22’ succeeded
CRS-2676: Start of ‘ora.scan1.vip’ on ‘d2-dbrac22’ succeeded
CRS-2672: Attempting to start ‘ora.LISTENER_SCAN1.lsnr’ on ‘d2-dbrac22’
CRS-2676: Start of ‘ora.LISTENER_SCAN1.lsnr’ on ‘d2-dbrac22’ succeeded
CRS-2676: Start of ‘ora.qosmserver’ on ‘d2-dbrac22’ succeeded
CRS-2673: Attempting to stop ‘ora.ons’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.ons’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.net1.network’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.net1.network’ on ‘d2-dbrac21’ succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on ‘d2-dbrac21’ has completed
CRS-2677: Stop of ‘ora.crsd’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.asm’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.crf’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.drivers.acfs’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.mdnsd’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.drivers.acfs’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.crf’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.mdnsd’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.asm’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.cluster_interconnect.haip’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.cluster_interconnect.haip’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.ctssd’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.evmd’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.ctssd’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.evmd’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.cssd’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.cssd’ on ‘d2-dbrac21’ succeeded
CRS-2673: Attempting to stop ‘ora.driver.afd’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.gipcd’ on ‘d2-dbrac21’
CRS-2673: Attempting to stop ‘ora.gpnpd’ on ‘d2-dbrac21’
CRS-2677: Stop of ‘ora.driver.afd’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.gipcd’ on ‘d2-dbrac21’ succeeded
CRS-2677: Stop of ‘ora.gpnpd’ on ‘d2-dbrac21’ succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on ‘d2-dbrac21’ has completed
CRS-4133: Oracle High Availability Services has been stopped.
[root@d2-dbrac21 ~]# /u01/app/19.0.0/grid/bin/asmcmd afd_deconfigure
ASMCMD-9525: AFD deconfiguration failed ‘ERROR: acfs driver is loaded’
[root@d2-dbrac21 ~]# /u01/app/19.0.0/grid/bin/acfsload stop
[root@d2-dbrac21 ~]# /u01/app/19.0.0/grid/bin/asmcmd afd_deconfigure
AFD-632: Existing AFD installation detected.
AFD-634: Removing previous AFD installation.
AFD-635: Previous AFD components successfully removed.
Modifying resource dependencies - this may take some time.
以上都是在测试、生产实施过的步骤,有任何建议、疑问可以留言、私信,希望与大家 共同进步!
同时感谢云和恩墨大佬的文章,给与启发与参考: https://cdn.modb.pro/db/49585