在SQLPLUS中對(duì)ASM實(shí)例進(jìn)行操作
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、小程序定制開(kāi)發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了王屋免費(fèi)建站歡迎大家使用!
1、查看ASM磁盤組狀況
SELECT GROUP_NUMBER, NAME, TYPE, STATE, TOTAL_MB, FREE_MB, OFFLINE_DISKS FROM V$ASM_DISKGROUP;
GROUP_NUMBER NAME TYPE STATE TOTAL_MB FREE_MB OFFLINE_DISKS
------------ ---------- ------ ----------- ---------- ---------- -------------
1 DG1 NORMAL MOUNTED 102365 102208
2、查看ASM磁盤信息
SELECT GROUP_NUMBER, DISK_NUMBER, LABEL, STATE, FAILGROUP, NAME, PATH, TOTAL_MB, FREE_MB FROM V$ASM_DISK;
GROUP_NUMBER DISK_NUMBER LABEL STATE FAILGROUP NAME
------------ ----------- ----- -------- ---------- ----------
PATH TOTAL_MB FREE_MB
------------------------- ---------- ----------
1 4 NORMAL DG1_0004 DG1_0004
/dev/oracleasm/disks/D5 20473 20443
1 3 NORMAL DG1_0003 DG1_0003
/dev/oracleasm/disks/D4 20473 20443
1 2 NORMAL DG1_0002 DG1_0002
/dev/oracleasm/disks/D3 20473 20442
GROUP_NUMBER DISK_NUMBER LABEL STATE FAILGROUP NAME
------------ ----------- ----- -------- ---------- ----------
PATH TOTAL_MB FREE_MB
------------------------- ---------- ----------
1 1 NORMAL DG1_0001 DG1_0001
/dev/oracleasm/disks/D2 20473 20439
1 0 NORMAL DG1_0000 DG1_0000
/dev/oracleasm/disks/D1 20473 20441
3、增加磁盤組:
CREATE DISKGROUP dgd NORMAL REDUNDANCY
FAILGROUP failgroup1 DISK
'/dev/raw/raw1' NAME diskA1 SIZE 120G FORCE,
'/dev/raw/raw2',
'/dev/raw/raw3'
FAILGROUP failgroup2 DISK
'/dev/raw/raw4',
'/dev/raw/raw5',
'/dev/raw/raw6';
4、增加fail組:
ALTER DISKGROUP dg1 ADD FAILGROUP fail3 DISK '/dev/raw/raw22' name disk5 REBALANCE POWER 11;
5、添加ASM磁盤:
ALTER DISKGROUP dg1 add failgroup fail1 DISK '/dev/raw/raw19' name disk3;
6、刪除ASM磁盤:
ALTER DISKGROUP dg1 DROP DISK disk4;
7、卸載磁盤組,要先關(guān)閉安裝在ASM上的rdbms數(shù)據(jù)庫(kù)實(shí)例
ALTER DISKGROUP dg2 DISMOUNT;
8、檢測(cè)磁盤組或磁盤:
ALTER DISKGROUP dg1 CHECK ALL;
ALTER DISKGROUP DG1 CHECK DISK VOL1;
7、控制均衡容錯(cuò)組數(shù)據(jù)的速度:
ALTER DISKGROUP dg2 REBALANCE POWER 11;
平衡速度控制參數(shù):
asm_power_limit = 1~11
8、檢查數(shù)據(jù)庫(kù)平衡速度:
SELECT GROUP_NUMBER, OPERATION, STATE, EST_WORK, SOFAR, EST_RATE, EST_MINUTES FROM V$ASM_OPERATION;
9、刪除磁盤組:
DROP DISKGROUP GROUP1 INCLUDING CONTENTS;
10、取消刪除:
ALTER DISKGROUP group1 UNDROP DISKS;
11、添加目錄:
ALTER DISKGROUP DG1 ADD DIRECTORY '+DG1/ad';
CREATE TABLESPACE T1 DATAFILE '+DG1/ad/t1.dbf' SIZE 100M AUOEXTEND ON;
12、重命名目錄:表空間不受任何影響
ALTER DISKGROUP DG1 RENAME DIRECTORY '+DG1/ad' to '+DG1/add';
13、刪除目錄:
ALTER DISKGROUP DG1 DROP DIRECTORY '+DG1/ad/demo' FORCE;
14、創(chuàng)建別名:
ALTER DISKGROUP DG1 ADD ALIAS '+DG1/ad/spfilead.ora' FOR '+DG1/ad/parameterfile/spfile.269.777212438';
15、重命名別名:
alter diskgroup dg1 rename alias '+DG1/ASMDB/spfile.ora' to '+DG1/ASMDB/spfileasmdb.ora';
16、刪除別名:刪除別名文件不會(huì)被刪除
DROP DISKGROUP DG1 DROP ALIAS '+DG1/ASMDB/spfileasmdb.ora';