asm的一些基本操作

tolilong發表於2013-01-30
建立diskgroup[@more@]
SQL> create diskgroup flash external redundancy disk 'ORCL:FLASH01','ORCL:FLASH02';

Diskgroup created.
新增磁碟
SQL> alter diskgroup flash add disk 'ORCL:FLASH03';

Diskgroup altered.
刪除磁碟
SQL> alter diskgroup flash drop disk flash03;

Diskgroup altered.
刪除磁碟組
SQL> drop diskgroup flash;

Diskgroup dropped.
SQL> create diskgroup flash normal redundancy failgroup fg1 disk 'ORCL:FLASH01' failgroup fg2 disk 'ORCL:FLASH02';

Diskgroup created.
===============================================================
SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;

GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DATA MOUNTED 6134 4605
2 FLASH MOUNTED 6132 5977
SQL> alter diskgroup flash dismount;

Diskgroup altered.

SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;

GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DATA MOUNTED 6134 4605
0 FLASH DISMOUNTED 0 0
SQL> alter diskgroup flash mount;

Diskgroup altered.

SQL> select group_number,name,state,total_mb,free_mb from v$asm_diskgroup;

GROUP_NUMBER NAME STATE TOTAL_MB FREE_MB
------------ ------------------------------ ----------- ---------- ----------
1 DATA MOUNTED 6134 4605
2 FLASH MOUNTED 6132 5977
===============================================================
create directory ,或者可以直接在asmcmd中直接使用mkdir新增目錄
SQL> alter diskgroup flash add directory '+flash/test1';

Diskgroup altered.

SQL> alter diskgroup flash rename directory '+flash/test1' to '+flash/test2';

Diskgroup altered.

SQL> alter diskgroup flash drop directory '+flash/test2';

Diskgroup altered.
==============================================================
管理別名
SQL> alter diskgroup data add alias '+data/asm/current.ctl' for '+data/asm/controlfile/Current.260.801073901';

Diskgroup altered.
SQL> alter diskgroup data rename alias '+data/asm/current.ctl' to '+data/asm/current_control.ctl';

Diskgroup altered.
SQL> alter diskgroup data drop alias '+data/asm/current_control.ctl';

Diskgroup altered.
SQL> select * from v$asm_alias;
..........................................
============================================================
刪除磁碟組中的檔案
SQL> alter diskgroup data drop file '+data/asm/datafile/userssss';

Diskgroup altered.
===========================================================
asm中的檔名
asm中的檔案建立均由系統自動命名
+diskgroupname/dbname/file_type/file_type_tag.file.incarnation
diskgroupname 磁碟組名
dbname 資料庫名
file_type 建立的檔案型別
file_type_tag 檔案型別的標籤
file.incarnation 檔案序號+incarnation
SQL> alter tablespace temp add tempfile '+data/asm/tempfile/temp02.dbf' size 10m;

Tablespace altered.
SQL> alter tablespace temp add tempfile '+data' size 10m;

Tablespace altered.
ASMCMD> pwd
+data/asm/tempfile
ASMCMD> ls -l
Type Redund Striped Time Sys Name
TEMPFILE UNPROT COARSE JAN 29 15:00:00 Y TEMP.264.801073935
TEMPFILE UNPROT COARSE JAN 30 13:00:00 Y TEMP.275.806074409
TEMPFILE UNPROT COARSE JAN 30 13:00:00 Y TEMP.276.806075175
TEMPFILE UNPROT COARSE JAN 30 13:00:00 Y TEMP.277.806075277
N temp02.dbf => +DATA/ASM/TEMPFILE/TEMP.276.806075175

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1060179/,如需轉載,請註明出處,否則將追究法律責任。