
11gR1版本 asmcmd的新命令--cp、md_backup、md_restore 參考原文: ASMCMD - New commands in 11gR1 (Doc ID 451900.1) 適用于: Oracle Database - Enterprise Edition - Version 11.1.0.6 to 11.1.0.7 [Release 11.1] Information in this document applie
11gR1版本 asmcmd的新命令--cp、md_backup、md_restore
參考原文:
ASMCMD - New commands in 11gR1 (Doc ID 451900.1)
適用于:
Oracle Database - Enterprise Edition - Version 11.1.0.6 to 11.1.0.7 [Release 11.1]
Information in this document applies to any platform.
***Checked for relevance on 02-Jan-2013***
目的:
oracle 已經(jīng)為asmcmd命令引入了3個新功能:以提高 crash和 修復(fù)壞塊時的節(jié)點可恢復(fù)性;拷貝文件;在asm磁盤組中l(wèi)ist asm磁盤
asmcmd 也能用于 asm磁盤組元數(shù)據(jù)的backup 和restore。
這提供了創(chuàng)建 一個 與 預(yù)先已經(jīng)存在的磁盤組使用 相同的磁盤路徑,磁盤名稱,故障組,屬性,模板和別名目錄結(jié)構(gòu) 的 磁盤組的方法。
范圍:
asmcmd中引入的新功能。
細節(jié):
第一個:ASMCMD cp command
asmcmd cp命令允許你在文件系統(tǒng)和 asm磁盤組之間拷貝文件,cp也能用于2個asm 磁盤組之間拷貝。
- ASM Diskgroup to OS file system
- OS file system to ASM Diskgroup
- ASM Diskgroup to another diskgroup
ASM Diskgroup to OS File system
ASMCMD> cp +DGEXT/orcl/datafile/tbsext.256.628847401 /home/oracle/tbsext.dbf
source +DGEXT/orcl/datafile/tbsext.256.628847401
target /home/oracle/tbsext.dbf
copying file(s)...
file, /home/oracle/tbsext.dbf, copy committed.
OS File system to ASM Diskgroup
ASMCMD> cp /home/oracle/tbsext.dbf +DGEXTBK/prod/datafile/tbsext.dbf
source /home/oracle/tbsext.dbf
target +DGEXTBK/prod/datafile/tbsext.dbf
copying file(s)...
file, +DGEXTBK/prod/datafile/tbsext.dbf, copy committed.
ASM Diskgroup to another diskgroup
SQL> create diskgroup dgext external redundancy disk '/dev/raw/raw1','/dev
/raw/raw2';
Diskgroup created.
SQL> create diskgroup DGEXTBK external redundancy disk '/dev/raw/raw3','/dev/raw /raw4';
Diskgroup created.
ASMCMD> cd DGEXTBK
ASMCMD> mkdir prod
ASMCMD> cd prod
ASMCMD> mkdir datafile
ASMCMD> cd datafile
ASMCMD> pwd
+DGEXTBK/prod/datafile
SQL> create tablespace TBSEXT datafile '+DGEXT' size 10m;
Tablespace created.
SQL> select name from v$datafile;
NAME
-------------------------------------------------------------
+DGEXT/orcl/datafile/tbsext.256.628847401
cp +DGEXT/orcl/datafile/tbsext.256.628847401 +DGEXTBK/prod/datafile/tbsext
ASMCMD> cp +DGEXT/orcl/datafile/tbsext.256.628847401 +DGEXTBK/prod/datafile/tbsext
source +DGEXT/orcl/datafile/tbsext.256.628847401
target +DGEXTBK/prod/datafile/tbsext
copying file(s)...file, +DGEXTBK/prod/datafile/tbsext, copy committed.
The tbsext is alias name created in the folder +DGEXTBK/prod/datafile.
Refer Note 452158.1 ASMCMD cp command fails with ORA-15046
第二個: ASMCMD md_backup and md_restore
用于備份和恢復(fù)asm磁盤組的元數(shù)據(jù),這提供了一個能力---重建一個與 已經(jīng)存在的asm磁盤組有著相同磁盤路徑,磁盤名稱,故障組,屬性,模板和別名目錄結(jié)構(gòu)的磁盤組
在oracle10g中,如果磁盤組丟失,那么唯一的可能是使用rman 來restore 都是的file,在這之前,需要手動重建asm磁盤組和相關(guān)的目錄、模板
在oracle11g中,我們可以對asm磁盤組的元數(shù)據(jù)做備份。
md_backup命令建立了包括一個或者多個磁盤組元數(shù)據(jù)的備份文件。
默認情況下,所有的mounted磁盤組都會被包括在該備份文件中,該備份文件放在當(dāng)前的工作目錄下。
如果備份文件的名字不指定,那么asm 會將此文件命名為AMBR_BACKUP_INTERMEDIATE_FILE.
--->如下是備份dgext磁盤組元數(shù)據(jù)的命令
ASMCMD> md_backup -b dgbk -g dgext
Disk group to be backed up: DGEXT
在restore模式下,oracle讀取之前生成的file,來重建磁盤組和元數(shù)據(jù)。
有不同的restore模式:full,nodg,newdg
full mode restore 磁盤組到它備份的時候
ASMCMD> md_restore -b dgbk -t full -g dgext
Current Diskgroup being restored: DGEXT
ASMCMD-09352: CREATE DISKGROUP failed
ORA-15018: diskgroup cannot be created
ORA-15030: diskgroup name "DGEXT" is in use by another diskgroup (DBD ERROR: OCIStmtExecute) --->可以看到,已經(jīng)使用的磁盤組不能restore
SQL> drop diskgroup dgext;
Diskgroup dropped.
ASMCMD> md_restore -b dgbk -t full -g dgext
Current Diskgroup being restored: DGEXT
Diskgroup DGEXT created!
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template DATAGUARDCONFIG modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
SQL> select group_number,name,type from v$asm_diskgroup;
GROUP_NUMBER NAME TYPE
------------ -------------------- ------
1 DGEXT EXTERN
nodg模式 restore 備份文件中的 屬性,模板 和別名目錄結(jié)構(gòu) 到一個存在的磁盤組中。
ASMCMD> md_restore -b dgbk -t nodg -g dgext
Current Diskgroup being restored: DGEXT
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template DATAGUARDCONFIG modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
newdg 模式 允許 用戶覆蓋 磁盤組名字,磁盤,故障組設(shè)置,但是會保留屬性,模板和 別名目錄結(jié)構(gòu)。
ASMCMD> md_restore -b dgbk -t newdg -o 'DGEXT:DG'
Current Diskgroup being restored: DGEXT
Current Diskgroup name replace by: DG
Diskgroup DG created!
System template XTRANSPORT modified!
System template ONLINELOG modified!
System template DATAGUARDCONFIG modified!
System template AUTOBACKUP modified!
System template TEMPFILE modified!
System template ARCHIVELOG modified!
System template ASM_STALE modified!
System template BACKUPSET modified!
System template DUMPSET modified!
System template FLASHBACK modified!
System template PARAMETERFILE modified!
System template CONTROLFILE modified!
System template DATAFILE modified!
System template CHANGETRACKING modified!
SQL> select group_number,name,type from v$asm_diskgroup
GROUP_NUMBER NAME TYPE
------------ -------------------- ------
1 DG EXTERN
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com