4 Expanded the clarification & explanation of how the script works
source | link

ByFor example, on linux:Linux (BASH shell) <-- is this correct? or other Unix- jcolebrandtype systems):

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

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 it grabs everything from asmcmd as a list object of:

  • 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 filenamessame way (do an ordinary $(asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04) or find for the loop command, and then iterates over them to copy them toexchange the second target but suppliespaths in the pathname againcopy), or even ASM to theASM asmcmd, this time(both paths can be ASM paths for asmcmd cp).

By example, on linux: (BASH shell) <-- is this correct? - jcolebrand

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

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 it grabs everything from asmcmd as a list object of the filenames $(asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04) and then iterates over them to copy them to the second target but supplies the pathname again to the asmcmd, this time for cp.

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
done

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

3 added 414 characters in body
source | link

By example, on linux:

$for i in $  (asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04BASH shell); do asmcmd cp +DG_AL/EMREP/ARCHIVELOG/2012_12_04/$i <-- is this correct? /u01; done- jcolebrand

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

JR wwwThis technique would be useful if you were copying from the ASM to the filesystem locally.miracletechla Just as a refresher, the way this script works is it grabs everything from asmcmd as a list object of the filenames $(asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04) and then iterates over them to copy them to the second target but supplies the pathname again to the asmcmd, this time for cp.com

By example, on linux:

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

JR www.miracletechla.com

By example, on linux:  (BASH shell) <-- is this correct? - jcolebrand

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

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 it grabs everything from asmcmd as a list object of the filenames $(asmcmd ls +DG_AL/EMREP/ARCHIVELOG/2012_12_04) and then iterates over them to copy them to the second target but supplies the pathname again to the asmcmd, this time for cp.

2 added 13 characters in body
source | link

By example, on linux:

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

JR www.miracletechla.com

By example:

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

JR www.miracletechla.com

By example, on linux:

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

JR www.miracletechla.com

1
source | link