客戶遇到個(gè)DG的問(wèn)題,存儲(chǔ)使用的ASM管理,有多個(gè)磁盤盤。 在主庫(kù)創(chuàng)建數(shù)據(jù)文件,備庫(kù)自動(dòng)創(chuàng)建的數(shù)據(jù)文件都在同一磁盤組,并且在主庫(kù)創(chuàng)建數(shù)據(jù)文件是指定的是類似**.DBF的名字,到備庫(kù)也變成了使用ASM的數(shù)字格式**.266.123456 這是因?yàn)槭褂昧薕MF特性。 OMF,全稱
客戶遇到個(gè)DG的問(wèn)題,存儲(chǔ)使用的ASM管理,有多個(gè)磁盤盤。
在主庫(kù)創(chuàng)建數(shù)據(jù)文件,備庫(kù)自動(dòng)創(chuàng)建的數(shù)據(jù)文件都在同一磁盤組,并且在主庫(kù)創(chuàng)建數(shù)據(jù)文件是指定的是類似**.DBF的名字,到備庫(kù)也變成了使用ASM的數(shù)字格式**.266.123456
這是因?yàn)槭褂昧薕MF特性。
OMF,全稱是Oracle_Managed Files,即Oracle文件管理。
使用OMF可以簡(jiǎn)化管理員的管理工作,不用指定文件的名字、大小、路徑,其名字,大小,路徑由oracle 自動(dòng)分配。在刪除不再使用的日志、數(shù)據(jù)、控制文件時(shí),OMF也可以自動(dòng)刪除其對(duì)應(yīng)的OS文件。
Oracle數(shù)據(jù)庫(kù)是否啟用OMF特性可以通過(guò)查看DB_CREATE_FILE_DEST參數(shù)來(lái)獲得。
當(dāng)DB_CREATE_FILE_DEST參數(shù)值為空時(shí)表示未啟用OMF功能,設(shè)置為目錄名則是開啟OMF。
實(shí)驗(yàn)數(shù)據(jù)庫(kù)版本:11.2.0.4.0,
一、啟用OMF時(shí)的數(shù)據(jù)文件創(chuàng)建情況
1.主庫(kù)在指定磁盤組創(chuàng)建數(shù)據(jù)文件,備庫(kù)會(huì)在DB_CREATE_FILE_DEST=+DG1指定的磁盤組創(chuàng)建
備庫(kù)參數(shù)
SQL> show parameter standby_file
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_file_management string AUTO
SQL> show parameter DB_CREATE_FILE_DEST
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string +DG1
SQL> col name for a50
SQL> set linesize 1000
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
1 +DG1/dg2/datafile/system.258.852146097
2 +DG1/dg2/datafile/sysaux.257.852146099
3 +DG1/dg2/datafile/undotbs1.256.852146101
4 +DG1/dg2/datafile/users.259.852146107
5 +DG2/dg/datafile/test1.dbf
主庫(kù)創(chuàng)建在DG2磁盤組創(chuàng)建表空間:
SQL> col name for a50
SQL> set linesize 1000
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
1 +DG1/dg/datafile/system.260.852134271
2 +DG1/dg/datafile/sysaux.261.852134303
3 +DG1/dg/datafile/undotbs1.262.852134329
4 +DG1/dg/datafile/users.264.852134361
5 +DG2/dg/datafile/test1.dbf
SQL> create tablespace test2 datafile '+DG2/dg/datafile/test2.dbf' size 10m;
Tablespace created.
SQL> alter system switch logfile;
System altered.
在備份庫(kù)上查詢表空間及數(shù)據(jù)文件創(chuàng)建情況:在DB_CREATE_FILE_DEST指定的磁盤組+DG1中創(chuàng)建
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
1 +DG1/dg2/datafile/system.258.852146097
2 +DG1/dg2/datafile/sysaux.257.852146099
3 +DG1/dg2/datafile/undotbs1.256.852146101
4 +DG1/dg2/datafile/users.259.852146107
5 +DG2/dg/datafile/test1.dbf
6 +DG1/dg2/datafile/test2.272.852147911
修改備庫(kù)DB_CREATE_FILE_DEST參數(shù)為+DG2:
SQL> SQL> show parameter DB_CREATE_FILE_DEST
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string +DG2
在主庫(kù)創(chuàng)建表空間:
SQL> create tablespace test3 datafile '+DG1/dg/datafile/test3.dbf' size 10m;
Tablespace created.
SQL> alter system switch logfile;
System altered.
在備庫(kù)查詢:
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
1 +DG1/dg2/datafile/system.258.852146097
2 +DG1/dg2/datafile/sysaux.257.852146099
3 +DG1/dg2/datafile/undotbs1.256.852146101
4 +DG1/dg2/datafile/users.259.852146107
5 +DG2/dg/datafile/test1.dbf
6 +DG1/dg2/datafile/test2.272.852147911
7 +DG2/dg2/datafile/test3.260.852148535
二、關(guān)閉OMF特性
修改備庫(kù)DB_CREATE_FILE_DEST參數(shù)為空,關(guān)閉OMF特性。--我這里只關(guān)閉了備庫(kù)的
SQL> show parameter DB_CREATE_FILE_DEST
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string +DG2
SQL> alter system set DB_CREATE_FILE_DEST='';
System altered.
SQL> show parameter DB_CREATE_FILE_DEST
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_create_file_dest string
主庫(kù)做操作:
SQL> create tablespace test4 datafile '+DG1/dg/datafile/test4.dbf' size 10m;
Tablespace created.
SQL> create tablespace test5 datafile '+DG2/dg/datafile/test5.dbf' size 10m;
Tablespace created.
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
1 +DG1/dg/datafile/system.260.852134271
2 +DG1/dg/datafile/sysaux.261.852134303
3 +DG1/dg/datafile/undotbs1.262.852134329
4 +DG1/dg/datafile/users.264.852134361
5 +DG2/dg/datafile/test1.dbf
6 +DG2/dg/datafile/test2.dbf
7 +DG1/dg/datafile/test4.dbf
8 +DG2/dg/datafile/test5.dbf
備庫(kù)做查詢:
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
1 +DG1/dg2/datafile/system.258.852146097
2 +DG1/dg2/datafile/sysaux.257.852146099
3 +DG1/dg2/datafile/undotbs1.256.852146101
4 +DG1/dg2/datafile/users.259.852146107
5 +DG2/dg/datafile/test1.dbf
6 +DG1/dg2/datafile/test2.272.852147911
7 +DG1/dg/datafile/test4.dbf
8 +DG2/dg/datafile/test5.dbf
三、觀察下ASM磁盤組中對(duì)于數(shù)據(jù)文件別名的存儲(chǔ)形式
ASMCMD> ls -al
WARNING:option 'a' is deprecated for 'ls'
please use 'absolutepath'
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y none => SYSAUX.257.852146099
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y none => SYSTEM.258.852146097
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y none => TEST2.272.852147911
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y +DG1/dg/datafile/test4.dbf => TEST4.279.852157365
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y none => UNDOTBS1.256.852146101
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y none => USERS.259.852146107
ASMCMD> ls -al
WARNING:option 'a' is deprecated for 'ls'
please use 'absolutepath'
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y +DG2/dg/datafile/test1.dbf => TEST1.256.852146103
DATAFILE UNPROT COARSE JUL 05 22:00:00 Y +DG2/dg/datafile/test5.dbf => TEST5.260.852157413
四、為ASM中SYSTEM表空間使用別名
比如上面創(chuàng)建的表空間test4其對(duì)應(yīng)的數(shù)據(jù)文件TEST4.DBF是一個(gè)別名,真實(shí)的數(shù)據(jù)文件與別名的對(duì)應(yīng)是:+DG1/dg/datafile/test4.dbf => TEST4.279.852157365
,然而(system,undotbs,sysaux,users)對(duì)應(yīng)的都是真實(shí)的數(shù)據(jù)文件,沒(méi)有別名,這時(shí)如果要對(duì)這些表空間使用別名,就需要重建控制文件。示例如下:
alter diskgroup dg1 add alias '+DG1/dg2/datafile/SYSTEM1.DBF' FOR '+DG1/dg2/datafile/system.258.852146097';
此時(shí)ASMCMD中查看:
ASMCMD> ls -al
WARNING:option 'a' is deprecated for 'ls'
please use 'absolutepath'
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE JUL 05 23:00:00 Y none => SYSAUX.257.852146099
DATAFILE UNPROT COARSE JUL 05 23:00:00 Y +DG1/DG2/DATAFILE/SYSTEM1.DBF => SYSTEM.258.852146097
N SYSTEM1.DBF => +DG1/DG2/DATAFILE/SYSTEM.258.852146097
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 418484224 bytes
Fixed Size 1365040 bytes
Variable Size 255855568 bytes
Database Buffers 155189248 bytes
Redo Buffers 6074368 bytes
SQL> CREATE CONTROLFILE REUSE DATABASE "DG" RESETLOGS FORCE LOGGING ARCHIVELOG …………
重建控制文件完成后數(shù)據(jù)庫(kù)是MOUNT狀態(tài),此時(shí)查詢:
SQL> select * from v$dbfile;
FILE# NAME
---------- --------------------------------------------------
8 +DG2/dg/datafile/test5.dbf
7 +DG1/dg/datafile/test4.dbf
6 +DG1/dg2/datafile/test2.272.852147911
5 +DG2/dg/datafile/test1.dbf
4 +DG1/dg2/datafile/users.259.852146107
3 +DG1/dg2/datafile/undotbs1.256.852146101
2 +DG1/dg2/datafile/sysaux.257.852146099
1 +DG1/dg2/datafile/system1.dbf
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com