从ASM中拷贝归档日志到文件系统:
命令:
rman target /
RMAN> copy archivelog '+ARCH/fhdbca/archivelog/2018_05_09/thread_1_seq_37.384.975668203' to '/oracle/thread_1_seq_37.384.975668203';
从文件系统中拷贝归档日志到ASM:
命令:
RMAN> catalog archivelog '/oracle/thread_1_seq_37.384.975668203';
RMAN> copy archivelog '/oracle/thread_1_seq_37.384.975668203' to '+ARCH/fhdbca/archivelog/2018_05_09/thread_1_seq_37.384.975668203';
RMAN> catalog archivelog '+ARCH/fhdbca/archivelog/2018_05_09/thread_1_seq_37.384.975668203';
ASMCMD中的cp命令(11g)
cp命令是11g新增的命令,使用它可以轻松的把文件从ASM中复制到文件系统中或者反过来。还可以把ASM中的文件复制到网络上的其他服务器的文件系统中。
#从ASM复制到文件系统
[grid@rac1 ~]$ asmcmd -p --显示路径
ASMCMD [+] > cd data
ASMCMD [+data] > cd orcl
ASMCMD [+data/orcl] > cd datafile
ASMCMD [+data/orcl/datafile] > ls
SYSAUX.257.925306091
SYSTEM.256.925306089
UNDOTBS1.258.925306091
UNDOTBS2.264.925306377
USERS.259.925306091
ASMCMD [+data/orcl/datafile] > ls -l
Type Redund Striped Time Sys Name
DATAFILE UNPROT COARSE MAY 21 11:00:00 Y SYSAUX.257.925306091
DATAFILE UNPROT COARSE MAY 21 11:00:00 Y SYSTEM.256.925306089
DATAFILE UNPROT COARSE MAY 21 11:00:00 Y UNDOTBS1.258.925306091
DATAFILE UNPROT COARSE MAY 21 11:00:00 Y UNDOTBS2.264.925306377
DATAFILE UNPROT COARSE MAY 21 11:00:00 Y USERS.259.925306091
ASMCMD [+data/orcl/datafile] > cp USERS.259.925306091 /home/grid/users.dbf
copying +data/orcl/datafile/USERS.259.925306091 -> /home/grid/users.dbf
ASMCMD [+data/orcl/datafile] >
#查看复制结果
[grid@rac1 ~]$ ll /home/grid/users.dbf
-rw-r-----. 1 grid oinstall 5251072 May 21 15:20 /home/grid/users.dbf
#从文件系统复制到ASM
ASMCMD [+data/orcl/datafile] > cp /home/grid/users.dbf +data/orcl
copying /home/grid/users.dbf -> +data/orcl/users.dbf
#查看复制结果
ASMCMD [+data/orcl/datafile] > cd +data/orcl
ASMCMD [+data/orcl] > ls -l
Type Redund Striped Time Sys Name
Y ARCHIVELOG/
Y CONTROLFILE/
Y DATAFILE/
Y ONLINELOG/
Y PARAMETERFILE/
Y TEMPFILE/
N spfileorcl.ora => +DATA/ORCL/PARAMETERFILE/spfile.268.925423909
N users.dbf => +DATA/ASM/DATAFILE/users.dbf.271.944580085
cp的详细使用情况可以使用help cp命令获得。