HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Multiple copies (cp) with Oracle ASM asmcmd tool?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
copieswithasmmultipleoracleasmcmdtool

Problem

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.

Solution

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
do
   asmcmd cp $FILE +data/orcl/datafile/$FILE
done


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.

Code Snippets

asmcmd command options
ls | while read FILE
do
   asmcmd cp $FILE +data/orcl/datafile/$FILE
done

Context

StackExchange Database Administrators Q#3535, answer score: 8

Revisions (0)

No revisions yet.