【ASM】ASMCMD cp 命令

dawn009發表於2014-03-25

在10g的時候 如果要將資料檔案從os 遷移到asm 或者反之,必須使用rman或者dbms_file_transfer實現。在oracle 11g的asmcmd提供了cp命令來實現asm 磁碟組和os 之間,asm 磁碟之間的資料檔案的遷移。
共如下三種方式:
1 .ASM Diskgroup to OS file system
2..OS file system to ASM Diskgroup
3 .ASM Diskgroup to another diskgroup


-- ASM Diskgroup to OS File system
ASMCMD [+data] > cp +DATA/rac/datafile/users.950.732883617  /tmp/user.dbf
copying +DATA/rac/datafile/users.950.732883617 -> /tmp/user.dbf
--OS File system to ASM Diskgroup

ASMCMD [+data] > cp /tmp/user.dbf +DATA/rac/datafile/users.950.732883617 
copying /tmp/user.dbf ->  +DATA/rac/datafile/users.950.732883617

--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

ASMCMD> cp +DGEXT/orcl/datafile/tbsext.256.628847401 +DGEXTBK/prod/datafile/tbsext
+DGEXT/orcl/datafile/tbsext.256.628847401  -> +DGEXTBK/prod/datafile/tbsext  

foldertbsext是建立在+DGEXTBK/prod/datafile資料夾下資料檔案的別名,真正的檔案建立在資料夾ASMTESTING下

ASMCMD> ls -ltr 
Type Redund Striped Time Sys Name 
N tbsext => +DGEXTBK/ASMTESTING/DATAFILE/TESTING.256.628848885

參考 metalink [ID 451900.1]

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

相關文章