• ASM外部冗余是否可以替换磁盘


    RDBMS:11.2.0.4 
    当ASM的磁盘冗余为external的时候,是否可以换掉一块盘。
    经过测试,是可以的。前提条件是,磁盘要有较大的空余空间,因为要把换掉的磁盘上的extent ,reblance到其他的盘上。
    如果空间不够,可能会失败,这次进行的测试,所占用空间比较小,剩余空间比较大。测试成功。

    参考文档:
    https://docs.oracle.com/cd/E11882_01/server.112/e18951/asmdiskgrps.htm#OSTMG10071

    To drop disks from a disk group, use the DROP DISK clause of the ALTER DISKGROUP statement. You can also drop all of the disks in specified failure groups using the DROP DISKS IN FAILGROUP clause.

    When a disk is dropped, the disk group is rebalanced by moving all of the file extents from the dropped disk to other disks in the disk group. A drop disk operation might fail if not enough space is available on the other disks. The best approach is to perform both the add and drop operation with the same ALTER DISKGROUP statement. This has the benefit of rebalancing data extents only one time and ensuring that there is enough space for the rebalance operation to succeed.

    -- 创建测试用的表空间test, 放在磁盘组+test上 ,创建用户test,默认的表空间是test 。创建表,数据存放在表空间test上。

    1. SYS@test2>create tablespace test datafile '+test' size 100M autoextend on;
    2. Tablespace created.
    3. SYS@test2>create user test identified by oracle;
    4. User created.
    5. SYS@test2>alter user test default tablespace test;
    6. User altered.
    7. SYS@test2>grant dba to test;
    8. Grant succeeded.
    9. SYS@test2>
    10. SYS@test2>conn test/oracle
    11. Connected.
    12. TEST@test2>create table test as select * from dba_tables;
    13. Table created.
    14. TEST@test2>

    -- 通过dbms_rowid来查看表test中的数据,发现对应的file_id是7,查看file_id为7的数据文件,发现是存放在磁盘组+test上的 

    1. select rowid,
    2. dbms_rowid.rowid_object(rowid) object_id,
    3. dbms_rowid.rowid_relative_fno(rowid) file_id,
    4. dbms_rowid.rowid_block_number(rowid) block_id,
    5. dbms_rowid.rowid_row_number(rowid) num
    6. from test;
    7. ROWID OBJECT_ID FILE_ID BLOCK_ID NUM
    8. ------------------ ---------- ---------- ---------- ----------
    9. AAAVt3AAHAAAADtAAC 88951 7 237 2
    10. AAAVt3AAHAAAADtAAD 88951 7 237 3
    11. AAAVt3AAHAAAADtAAE 88951 7 237 4
    12. AAAVt3AAHAAAADtAAF 88951 7 237 5
    13. AAAVt3AAHAAAADtAAG 88951 7 237 6
    14. AAAVt3AAHAAAADtAAH 88951 7 237 7
    15. AAAVt3AAHAAAADtAAI 88951 7 237 8
    16. AAAVt3AAHAAAADtAAJ 88951 7 237 9
    17. 2879 rows selected.
    18. TEST@test2>
    19. SYS@test2>select file_name from dba_data_files where file_id = 7;
    20. FILE_NAME
    21. --------------------------------------------------------------------------------
    22. +TEST/test/datafile/test.256.1111411155
    23. SYS@test2>

    -- 查看磁盘组信息,test磁盘组是external冗余 ,两块盘,asm-test1和asm-test2 ,drop掉其中一块盘后,还剩余一块盘。数据正常,2879条。

    1. SYS@+ASM2>select group_number,name from v$asm_diskgroup;
    2. GROUP_NUMBER NAME
    3. ------------ ------------------------------
    4. 1 DATA
    5. 2 OCR
    6. 3 TEST
    7. SYS@+ASM2>select group_number,name,type from v$asm_diskgroup;
    8. GROUP_NUMBER NAME TYPE
    9. ------------ ------------------------------ ------
    10. 1 DATA EXTERN
    11. 2 OCR NORMAL
    12. 3 TEST EXTERN
    13. SYS@+ASM2>
    14. SYS@+ASM2>select path from v$asm_disk where GROUP_NUMBER = 3;
    15. PATH
    16. --------------------------------------------------------------------------------
    17. /dev/asm-test1
    18. /dev/asm-test2
    19. SYS@+ASM2>
    20. SYS@+ASM2>select name,path from v$asm_disk where GROUP_NUMBER = 3;
    21. NAME PATH
    22. -------------------- ----------------------------------------
    23. TEST_0000 /dev/asm-test1
    24. TEST_0001 /dev/asm-test2
    25. SYS@+ASM2>
    26. alter diskgroup TEST drop disk 'TEST_0000';
    27. SYS@+ASM2>alter diskgroup TEST drop disk 'TEST_0000';
    28. Diskgroup altered.
    29. SYS@+ASM2>select name,path from v$asm_disk where GROUP_NUMBER = 3;
    30. NAME PATH
    31. -------------------- ----------------------------------------
    32. TEST_0001 /dev/asm-test2
    33. SYS@+ASM2>
    34. SYS@test2>select count(*) from test.test;
    35. COUNT(*)
    36. ----------
    37. 2879
    38. SYS@test2>
    39. SYS@+ASM2>select name,path from v$asm_disk where GROUP_NUMBER = 3;
    40. NAME PATH
    41. -------------------- ----------------------------------------
    42. TEST_0001 /dev/asm-test2
    43. SYS@+ASM2>

    -- 再次将drop掉的磁盘添加上。

    1. SYS@+ASM2>ALTER DISKGROUP TEST ADD DISK '/dev/asm-test1' NAME TEST_0000;
    2. Diskgroup altered.
    3. SYS@+ASM2>select * from V$ASM_OPERATION;
    4. no rows selected
    5. SYS@+ASM2>select name,path from v$asm_disk where GROUP_NUMBER = 3;
    6. NAME PATH
    7. -------------------- ----------------------------------------
    8. TEST_0000 /dev/asm-test1
    9. TEST_0001 /dev/asm-test2
    10. SYS@+ASM2>

    -- alrt log 中,可以看到reblance 。

    1. SQL> alter diskgroup TEST drop disk 'TEST_0000'
    2. NOTE: GroupBlock outside rolling migration privileged region
    3. NOTE: requesting all-instance membership refresh for group=3
    4. Sat Jul 30 14:47:47 2022
    5. NOTE: membership refresh pending for group 3/0xfab86ef8 (TEST)
    6. Sat Jul 30 14:47:50 2022
    7. GMON querying group 3 at 16 for pid 18, osid 3765
    8. SUCCESS: refreshed membership for 3/0xfab86ef8 (TEST)
    9. SUCCESS: alter diskgroup TEST drop disk 'TEST_0000'
    10. NOTE: starting rebalance of group 3/0xfab86ef8 (TEST) at power 1
    11. Starting background process ARB0
    12. Sat Jul 30 14:47:51 2022
    13. ARB0 started with pid=34, OS id=15309
    14. NOTE: assigning ARB0 to group 3/0xfab86ef8 (TEST) with 1 parallel I/O
    15. cellip.ora not found.
    16. NOTE: F1X0 copy 1 relocating from 0:2 to 1:80 for diskgroup 3 (TEST)
    17. NOTE: Attempting voting file refresh on diskgroup TEST
    18. NOTE: Refresh completed on diskgroup TEST. No voting file found.
    19. NOTE: stopping process ARB0
    20. SUCCESS: rebalance completed for group 3/0xfab86ef8 (TEST)
    21. Sat Jul 30 14:47:57 2022
    22. NOTE: GroupBlock outside rolling migration privileged region
    23. NOTE: requesting all-instance membership refresh for group=3
    24. GMON updating for reconfiguration, group 3 at 17 for pid 34, osid 15335
    25. NOTE: group 3 PST updated.
    26. SUCCESS: grp 3 disk TEST_0000 emptied
    1. SUCCESS: ALTER DISKGROUP TEST ADD DISK '/dev/asm-test1' NAME TEST_0000
    2. NOTE: starting rebalance of group 3/0xfab86ef8 (TEST) at power 1
    3. Starting background process ARB0
    4. Sat Jul 30 14:55:10 2022
    5. ARB0 started with pid=35, OS id=16572
    6. NOTE: assigning ARB0 to group 3/0xfab86ef8 (TEST) with 1 parallel I/O
    7. cellip.ora not found.
    8. NOTE: Attempting voting file refresh on diskgroup TEST
    9. NOTE: Refresh completed on diskgroup TEST. No voting file found.
    10. NOTE: stopping process ARB0
    11. SUCCESS: rebalance completed for group 3/0xfab86ef8 (TEST)
    12. Sat Jul 30 14:55:16 2022
    13. NOTE: GroupBlock outside rolling migration privileged region
    14. NOTE: requesting all-instance membership refresh for group=3
    15. Sat Jul 30 14:55:19 2022
    16. NOTE: membership refresh pending for group 3/0xfab86ef8 (TEST)
    17. Sat Jul 30 14:55:22 2022
    18. GMON querying group 3 at 37 for pid 18, osid 3765
    19. SUCCESS: refreshed membership for 3/0xfab86ef8 (TEST)
    20. NOTE: Attempting voting file refresh on diskgroup TEST
    21. NOTE: Refresh completed on diskgroup TEST. No voting file found.
    22. END

    END

  • 相关阅读:
    synchronized
    vs code 离线安装 CodeLLDB 包[Acquiring CodeLLDB platform package]
    开启数据库审计 db,extended级别或os级别)并将审计文件存放到/opt/oracle/audit/下
    Apache Doris (四十三): Doris数据更新与删除 - Update数据更新
    【微信小程序-初级实战】用户登录
    对比分析:GBDT、XGBoost、CatBoost和LightGBM
    振弦采集仪和传感器形成完整链条的岩土工程解决方案
    Java集合框架【二容器(Collection)[ArrayList]】
    @EqualsAndHashCode注解!!!
    arm linux使用 usbmon 抓取usb总线数据包
  • 原文地址:https://blog.csdn.net/xxzhaobb/article/details/126083255