oracle omf管理 and asm omf

Don't argue / for other people's weaknesses./ Don't argue / for your own.
/ When you make a mistake,/ admit it,/ correct it,/ and learn from it / immediately.



文件系统OMF
文件系统默认不使用OMF,默认是DB_CREATE_FILE_DEST参数值为NULL,也就是禁用OMF;
(1)
SQL> show parameter db_create_file_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest                  string
(2)
创建一个表空间,必须要指定数据文件名,也就是必须要加上datafile子句才可以,否则会报错。
(3)删除表空间时,磁盘文件不会自动删除,必须使用including contents and datafiles才能同时删除,或者
os的rm命令手工删除。
SQL>drop tablespace test including contents and datafiles;

(4)文件系统使用OMF时
SQL>alter system set db_create_file_dest='/backup' scope=both;
启用OMF后,创建表空间就不用指定文件名称。
SQL>create tablespace test;
ASM上的OMF
ASM FILE在ASM磁盘组上也是以OMF方式进行存放的,因此ASM的存放路径和文件命是遵循格式:
+diskgroup_name/database_name/database file type/tag_name.file_number.incarnation.


添加ASM alias
SQL>create tablespace omf datafile '+data' size 2m;
SQL>select name from v$datafile;
添加ASM ALIAS
EXPORT ORACLE_SID=+ASM1
SQL>alter diskgroup data add alias '+data/omf.dbf' for '+DATA/WXXRZXM/datafile/omf.273.660074819';
查看ASM ALIAS别名
select *
  from (select file_number,
               file_incarnation,
               '+' || gname || sys_connect_by_path(aname, '/') as full_alias_path
          from (select a.file_number      file_number,
                       a.file_incarnation file_incarnation,
                       g.name             gname,
                       a.parent_index     pindex,
                       a.name             aname,
                       a.reference_index  rindex
                  from v$asm_alias a, v$asm_diskgroup g
                 where a.group_number = g.group_number)
         start with (mod(pindex, power(2, 24))) = 0
        connect by prior rindex = pindex
         order by 1, 2) a
 where file_incarnation = &fi;


posted @ 2011-09-26 19:54  痞子过  阅读(754)  评论(0编辑  收藏  举报