在ASM中的別名,是爲了方便管理。數據庫
在ASM中建立別名,一種是在RDBMS中建立,另一種是在ASM中建立,區別就是在ASM中建立的別名,在RDBMS中是不可見的。spa
在RDBMS中建立別名:code
SQL> create tablespace kel datafile '+kel/ipap/datafile/kel.dbf' size 10M; Tablespace created.
ASMCMD> ls -l Type Redund Striped Time Sys Name DATAFILE UNPROT COARSE JUN 29 23:00:00 Y KEL.299.851556787 DATAFILE UNPROT COARSE JUN 29 19:00:00 Y SYSAUX.258.850693003 DATAFILE UNPROT COARSE JUN 29 19:00:00 Y SYSTEM.259.850692939 DATAFILE UNPROT COARSE JUN 29 19:00:00 Y UNDOTBS1.257.850693039 DATAFILE UNPROT COARSE JUN 29 19:00:00 Y USERS.256.850693045 N kel.dbf => +KEL/IPAP/DATAFILE/KEL.299.851556787
能夠在ASM的實例視圖V$ASM_ALIAS中查詢到相關信息:blog
SQL> select file_incarnation from v$asm_alias where name like '%kel%'; FILE_INCARNATION ---------------- 850960191 SQL> select name from v$asm_alias where file_incarnation=850960191; NAME -------------------- KEL.286.850960191 kel.dbf
在ASM中建立別名:ip
先在數據庫中建立表空間:it
SQL> create tablespace omf datafile '+kel' size 5M; Tablespace created. SQL> select name from v$datafile; NAME -------------------------------------------------- +KEL/ipap/datafile/system.259.850692939 +KEL/ipap/datafile/undotbs1.257.850693039 +KEL/ipap/datafile/sysaux.258.850693003 +KEL/ipap/datafile/users.256.850693045 +KEL/ipap/datafile/omf.305.851558685
SQL> alter diskgroup kel add alias '+kel/ipap/datafile/omf.dbf' for '+kel/ipap/datafile/omf.305.851558685'; Diskgroup altered.查看別名:
SQL> select name,file_incarnation from v$asm_alias where name like '%omf%'; NAME FILE_INCARNATION ---------- ---------------- omf.dbf 851558685
SQL> alter diskgroup kel drop alias '+kel/ipap/datafile/omf.dbf'; Diskgroup altered. SQL> select name,file_incarnation from v$asm_alias where name like '%omf%'; no rows selected
V$ASM_ALIAS
displays one row for every alias present in every disk group mounted by the Automatic Storage Management instance. In a database instance, V$ASM_ALIAS
displays no rows.