oracle實驗記錄 (OMF)

fufuh2o發表於2009-08-06

OMF = ORACLE MANAGER FILE
SQL> show parameter db_create_file_dest;

NAME                                TYPE       VALUE
-----------------------------------------------------------------------------
db_create_file_dest                 string
所有datafile  都自動建立在改位置
SQL> select tablespace_name ,file_id,file_name,bytes/1024/1024 from dba_data_fil
es;

TABLESPACE    FILE_ID FILE_NAME                                BYTES/1024/1024
---------- ---------- ---------------------------------------- ---------------
TEST4               9 E:\TEST4.DBF                                          10
TEST2               8 E:\TEST3.DBF                                          10
XHTEST              7 E:\TEST2.DBF                                           5
XHTEST              6 E:\TEST.DBF                                           10
EXAMPLE             5 E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\EX             150
                      AMPLE01.DBF

USERS               4 E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\US               5
                      ERS01.DBF

SYSAUX              3 E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SY             260
                      SAUX01.DBF

UNDOTBS1            2 E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\UN              60
                      DOTBS01.DBF

SYSTEM              1 E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\SY            1020
                      STEM01.DBF

TEST               10 D:\TEST.DBF                                          100

TABLESPACE    FILE_ID FILE_NAME                                BYTES/1024/1024
---------- ---------- ---------------------------------------- ---------------
TEST_16K           11 D:\TEST2.DBF                                          10
TEST_16KB          12 D:\TEST_16KB.DBF                                      10

12 rows selected.
SQL> alter system set db_create_file_dest ='D:\OMF';

System altered.
SQL> alter tablespace test2 add datafile ;~~~~不寫大小defalut 100m

Tablespace altered.

SQL> select tablespace_name ,file_id,file_name,bytes/1024/1024 from dba_data_fil
es where tablespace_name='TEST2';

TABLESPACE    FILE_ID FILE_NAME                                BYTES/1024/1024
---------- ---------- ---------------------------------------- ---------------
TEST2               8 E:\TEST3.DBF                                          10
TEST2              13 D:\OMF\XHTEST\DATAFILE\O1_MF_TEST2_57O7T             100
                      R0Z_.DBF
SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      xhtest
XHTEST DB NAME ,TEST2 TABLESPACENAME,57O7TR0Z 是一個八個字元長的字串,可以確保唯一性。


OMF 按如下方式命名:
 控制檔案:ora_%u.ctl
 重做日誌檔案:ora_%g_%u.log
 資料檔案:ora_%t_%u.dbf
 臨時資料檔案:ora_%t_%u.tmp

 %u 是一個八個字元長的字串,可以確保唯一性。
 %t 是表空間名,如有必要,可按照檔名的最大長度要求將其截斷。將表空間
名放在唯一性字串之前,意味著表空間內的所有資料檔案按照字母順序排列
顯示。
 %g 是重做日誌檔案組號。
帶.dbf 副檔名的ora_ 表明該檔案是OMF。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL> show parameter db_create_online

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_online_log_dest_1          string
db_create_online_log_dest_2          string
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string

OMF 管理redofile


SQL> select group#,status from v$log;

    GROUP# STATUS
---------- ----------------
         1 CURRENT
         2 INACTIVE
         3 INACTIVE

SQL> host mkdir d:\omflog

SQL> host mkdir d:\omflog2
SQL> alter system set db_create_online_log_dest_1='d:\omflog'
  2  ;

System altered.

SQL> alter system set db_create_online_log_dest_2='d:\omflog2'
  2  ;

System altered.

SQL> show parameter db_create_online

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_create_online_log_dest_1          string      d:\omflog
db_create_online_log_dest_2          string      d:\omflog2


SQL> alter database add logfile group 4;

Database altered.

SQL> desc v$logfile;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------

 GROUP#                                             NUMBER
 STATUS                                             VARCHAR2(7)
 TYPE                                               VARCHAR2(7)
 MEMBER                                             VARCHAR2(513)
 IS_RECOVERY_DEST_FILE                              VARCHAR2(3)


SQL> select member from v$logfile where group#=4;

MEMBER
--------------------------------------------------------------------------------

D:\OMFLOG\XHTEST\ONLINELOG\O1_MF_4_57O98Y89_.LOG
D:\OMFLOG2\XHTEST\ONLINELOG\O1_MF_4_57O98ZYR_.LOG

db_create_online_log_dest_N 配置幾個 GROUP就有幾個MEMBER

SQL> select bytes/1024/1024,members from v$log where group#=4;

BYTES/1024/1024    MEMBERS
--------------- ----------
            100          2
不寫SIZE default 100m

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

相關文章