尝试使用ASMCMD拷贝数据文件时出现这个错误。
使用ASM将磁盘组文件拷贝到文件系统没有问题:
bash-3.00$ export ORACLE_SID=+ASM2
bash-3.00$ asmcmd
ASMCMD> ls
DATA/
ASMCMD> cd DATA
ASMCMD> cd RACTEST
ASMCMD> cd DATAFILE
ASMCMD> ls
SYSAUX.260.664395357
SYSTEM.259.664395355
SYSTEM.268.664468131
UNDOTBS1.261.664395359
UNDOTBS2.263.664395371
USERS.264.664395373
ASMCMD> cp USERS.264.664395373 /data/USERS.264.664395373
source +DATA/RACTEST/DATAFILE/USERS.264.664395373
target /data/USERS.264.664395373
copying file(s)...
file, /data/USERS.264.664395373, copy committed.
下面尝试将操作系统上的这个文件拷贝回ASM的不同目录下:
ASMCMD> cp /data/USERS.264.664395373 +DATA/RACTEST/backup/USERS.264.664395373
source /data/USERS.264.664395373
target +DATA/RACTEST/backup/USERS.264.664395373
ASMCMD-08015: can not create file->'+DATA/RACTEST/backup/USERS.264.664395373'
ORA-15056: additional error message
ORA-17502: ksfdcre:4 Failed to create file +DATA/ractest/backup/users.264.664395373
ORA-15046: ASM file name '+DATA/ractest/backup/users.264.664395373' is not in single-file creation form
ORA-06512: at "SYS.X$DBMS_DISKGROUP", line 142
ORA-06512: at line 3 (DBD ERROR: OCIStmtExecute)
ASMCMD-08016: copy source->'/data/USERS.264.664395373' and target->'+DATA/RACTEST/backup/USERS.264.664395373' failed
这个问题其实也很简单,用户在拷贝到ASM上的时候不要指定文件后面的数值,这是Oracle的ASM用来进行标识的信息。
Oracle在文档Doc ID: Note:452158.1中进行详细的描述:
ASMCMD> cp /data/USERS.264.664395373 +DATA/RACTEST/backup/USERS
source /data/USERS.264.664395373
target +DATA/RACTEST/backup/USERS
copying file(s)...
file, +DATA/ractest/backup/users, copy committed.
注意一点,虽然这样拷贝成功了,但是ASM其实并没有完全根据命令将数据文件拷贝到指定的目录:
ASMCMD> cd +DATA/RACTEST/backup/
ASMCMD> ls
02jplh5q_1_1
users
ASMCMD> ls -l
Type Redund Striped Time Sys Name
N 02jplh5q_1_1 => +DATA/ASMTESTING/BACKUPSET/TESTING.269.664454477
N users => +DATA/ASMTESTING/DATAFILE/TESTING.268.664645347
ASMCMD> cd +DATA/ASMTESTING/DATAFILE/
ASMCMD> ls
TESTING.268.664645347
ASM只是在目标目录下存储了一个alias,真正的文件被ASM放到了其他的位置。