In order to import a transportable tablespace into an Oracle 11 database with ASM, we use the cp command of the asmcmd tool.

How can we copy more than one file at a time?

Wildcards are not supported, copying directories either, and I can't find any hint if asmcmd has a scripting mechanism.

2 Answers 2


Since no platform or version is mentioned, I assume Unix/Linux and 11gR2.

First of all, check Running ASMCMD in Noninteractive Mode. This explains that we can use ASMCMD in a script so whatever we can dream of, we can script. In this case in order to copy files we can use

asmcmd command options

A simple example is shown here Running ASMCMD commands in a script Change this example slightly to get it to copy all files in a local directory, also using this Using the ASMCMD cp command as input:

ls | while read FILE
   asmcmd cp $FILE +data/orcl/datafile/$FILE

I am not sure how smart it is to run multiple copies in parallel. It all depends on what your hardware can handle. If you want to run in parallel, run the copies in the background but be a little careful, when running too much in parallel, it will definately cause a slower throughput than running in a sequential way.

For windows it will be slightly different, the loop construct will be different.

I hope this helps.

  • Might you need to use asmcmd ls? Commented Jul 1, 2011 at 11:37
  • not if you copy from fs to ASM, but the other way around: yes.
    – user953
    Commented Jul 1, 2011 at 11:43

For example, on Linux (or other Unix-type systems):

for i in $(asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04); do
  asmcmd cp +DG_AL/EMREP/ARCHIVELOG/2012_12_04/$i /u01

This technique would be useful if you were copying from the ASM to the filesystem locally.

Just as a refresher, the way this script works is:

  • asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04: list files inside that ASM directory. The list contains filenames only, not the paths.
  • for i in $(command) ; do ... ; done: iterate over the output of command, using $i as the loop variable. $i will contain the name of one file (without path) inside the loop
  • asmcmd cp [asm_path]/$i [external_path]: copies one file from ASM to an external path.

You could do external to ASM the same way (do an ordinary ls or find for the loop command, and exchange the paths in the copy), or even ASM to ASM (both paths can be ASM paths for asmcmd cp).

  • A valiant effort, and this is exactly how we like people to contribute and keep question/answer sets as canonical resources for those looking to understand later, but first: blog-credits, taglines, signatures - we ask that you not use taglines (see the faq) for your own property, but if you refer to a very specific post on your blog, and the answer here is sufficient to answer the question, then we welcome a link to a much more indepth explanation; and as for this answer, maybe you noticed the other comments that mention this is if you copy INTO the ASM? Can you elaborate?
    – jcolebrand
    Commented Dec 11, 2012 at 15:18
  • 1
    I gave something of a trivial explanation, so that those who are not familiar with the problem can understand the breakdown, and I applied code formatting (there is a very lovely toolbar above the editor textbox or you can just indent four spaces at the start of a line, or paste in with a tab at the leading edge) but you may want to rewrite this to be better explained. Don't forget the folks reading this could be veterans, or absolute noobs.
    – jcolebrand
    Commented Dec 11, 2012 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.