合 Oracle ASM磁盘和磁盘组的常用SQL语句
创建ASM磁盘
请参考:https://www.dbaup.com/zaioraclezhongchuangjianasmcipandenzhongfangfa.html
ASM磁盘
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | export ORACLE_HOME=/u01/app/12.2.0/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH /u01/app/12.2.0/grid/bin/kfod.bin asm_diskstring='/dev/asm-' $ORACLE_HOME/bin/kfod disk=asm s=true ds=true c=true asm_diskstring='/dev/raw/raw','/dev/asm-','ORCL:' /grid/stage/ext/bin/kfod disk=asm s=true ds=true c=true asm_diskstring='/dev/raw/raw','/dev/asm-','ORCL:' 18c kfod disks=asm ds=true cluster=true create diskgroup DATA external redundancy disk '/dev/raw/raw*'; create diskgroup FRA external redundancy disk '/dev/rhdisk3'; --创建磁盘组FRA CREATE DISKGROUP ACFSDG external redundancy DISK '/dev/oracleasm/disks/VOL1' ATTRIBUTE 'compatible.asm' = '11.2','compatible.rdbms' = '11.2','compatible.advm'='11.2'; create diskgroup OCR external redundancy disk 'ORCL:OVDISK' attribute 'compatible.asm'='11.2','compatible.rdbms'='11.2'; CREATE DISKGROUP dgroup1 NORMAL REDUNDANCY disk '/dev/raw/raw6', '/dev/raw/raw7'; CREATE DISKGROUP dgroup1 HIGH REDUNDANCY disk '/dev/raw/raw6', '/dev/raw/raw7', '/dev/raw/raw8'; create diskgroup DG1 external redundancy failgroup FG1 disk '/dev/raw/raw6' name DG2_FG1_VOL1 failgroup FG2 disk '/dev/raw/raw7' name DG2_FG2_VOL2; create diskgroup DG2 normal redundancy failgroup FG1 disk '/dev/raw/raw6' name DG2_FG1_VOL1 failgroup FG2 disk '/dev/raw/raw7' name DG2_FG2_VOL2; create diskgroup DG2 normal redundancy failgroup FG1 disk '/dev/raw/raw6','/dev/raw/raw7' name DG2_FG1_VOL1 failgroup FG2 disk '/dev/raw/raw8','/dev/raw/raw9' name DG2_FG2_VOL2; ---修改磁盘组的兼容属性 ALTER DISKGROUP asm_dg SET ATTRIBUTE 'compatible.asm' = '11.1'; ALTER DISKGROUP asm_dg SET ATTRIBUTE 'compatible.rdbms' = '11.1'; COLUMN name FORMAT A10 COLUMN compatibility FORMAT A20 COLUMN database_compatibility FORMAT A20 SELECT group_number, name, compatibility, database_compatibility FROM v$asm_diskgroup; set line 9999 set pagesize 9999 col path format a60 SELECT a.group_number, disk_number,mount_status, a.name, path FROM v$asm_disk a order by a.disk_number; select instance_name,status from v$instance; set line 999 select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number, disk_number,mount_status, path from v$asm_diskgroup a; select a.group_number,name,TYPE,state,TOTAL_MB,free_mb from v$asm_diskgroup a; select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number from v$asm_diskgroup a; alter diskgroup DG1 mount; ---nomount状态下强制删除磁盘组 drop diskgroup oradg force including contents; alter diskgroup DG1 drop disk DG1_VOL5; --删除磁盘组DG1中的磁盘VOL5 alter system set asm_diskstring='','ORCL:','/dev/raw/raw','/dev/oracleasm/disks/VOL'; alter system set asm_diskstring='/dev/asm-disk','/dev/raw/raw*'; alter diskgroup DATA add disk '/dev/raw/raw1'; -- 修改数值显示长度,不显示科学计数法 set numwidth 16 export GRID_HOME=$ORACLE_HOME |