【翻譯自mos文章】 11gR1版本 asmcmd的新命令--cp、md_backup、md_restore,11gr1--cp

來源:互聯網
上載者:User

【翻譯自mos文章】 11gR1版本 asmcmd的新命令--cp、md_backup、md_restore,11gr1--cp

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 已經為asmcmd命令引入了3個新功能:以提高 crash和 修複壞塊時的節點可恢複性;拷貝檔案;在asm磁碟組中list asm磁碟

asmcmd 也能用於 asm磁碟組中繼資料的backup 和restore。
這提供了建立 一個 與 預先已經存在的磁碟組使用 相同的磁碟路徑,磁碟名稱,故障組,屬性,模板和別名目錄結構 的 磁碟組的方法。


範圍:
asmcmd中引入的新功能。

細節:
第一個:ASMCMD cp command

asmcmd cp命令允許你在檔案系統和 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
用於備份和恢複asm磁碟組的中繼資料,這提供了一個能力---重建一個與 已經存在的asm磁碟組有著相同磁碟路徑,磁碟名稱,故障組,屬性,模板和別名目錄結構的磁碟組

在oracle10g中,如果磁碟組丟失,那麼唯一的可能是使用rman 來restore 都是的file,在這之前,需要手動重建asm磁碟組和相關的目錄、模板

在oracle11g中,我們可以對asm磁碟組的中繼資料做備份。

md_backup命令建立了包括一個或者多個磁碟組中繼資料的備份檔案。
預設情況下,所有的mounted磁碟組都會被包括在該備份檔案中,該備份檔案放在當前的工作目錄下。
如果備份檔案的名字不指定,那麼asm 會將此檔案命名為AMBR_BACKUP_INTERMEDIATE_FILE.

--->如下是備份dgext磁碟組中繼資料的命令

ASMCMD> md_backup -b dgbk -g dgext
Disk group to be backed up: DGEXT


在restore模式下,oracle讀取之前產生的file,來重建磁碟組和中繼資料。
有不同的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) --->可以看到,已經使用的磁碟組不能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 備份檔案中的 屬性,模板 和別名目錄結構 到一個存在的磁碟組中。

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 模式 允許 使用者覆蓋 磁碟組名字,磁碟,故障組設定,但是會保留屬性,模板和 別名目錄結構。

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










相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.