Subscribe to Posts by Email

Subscriber Count

    696

Disclaimer

All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use. This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove. Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only. This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only. If you see any issues with Content and copy write issues, I am happy to remove if you notify me. Contact Geek DBA Team, via geeksinsights@gmail.com

Pages

ASM: Copy files To and from – ASM

Hello,

In this post, we will look different ways of copying Files between OS and ASM.

Before to that we see what are the tools available for the same.

  • XML DB - enables file transfer since Oracle 10gR1

XML DB creates a virtual folder /sys/asm and makes it accessible via ftp or http. You will see how to use XML DB features for transferring files between file system and ASM using the virtual /sys/asm folder. In order to use this feature for file transfer XML DB needs to be installed and configured

Full details available here: http://docs.oracle.com/cd/B28359_01/server.111/b31107/asmfiles.htm#BABJCCEI

  • ASMCMD cp command since Oracle 11g

Starting with 11G asmcmd is further enhanced and one of the benefits is cp. ASMCMD cp command can be used to copy both locally and remotely in the following directions:

  • ASM->FS
  • FS->ASM
  • ASM-ASM

ASMCMD [+] > cp +data/orcl/datafile/TEST.267.78569634 /mybackups/example.bak

copying +data/orcl/datafile/TEST.267.78569634 -> /mybackups/example.bak

ASMCMD [+] > cp /mybackups/test.txt +data/orcl/datafile/test.txt

copying /mybackups/examples.bak -> +data/orcl/datafile/myexamples.bak

ASMCMD [+] > cp +data/orcl/datafile/TEST.267.78569634 sys@server.asminstance:/home/oracle

ASMCMD [+] > cp +data/orcl/datafile/TEST.267.78569634 sys/passwd@server.asminstance:/home/oracle

ASMCMD [+] > cp sys@server.asminstance:/home/oracle +data/orcl/datafile/file

  • DBMS_FILE_TRANSFER package - allowed transfer between ASM/FS since 10gR2

DBMS_FILE_TRANSFER package is available since Oracle 10gR1 and since 10gR2 supports transferring files as follows:

  • ASM->ASM
  • FS->ASM
  • FS->FS
  • FS->ASM

Let's create a directory pointing to a file system

CREATE OR REPLACE DIRECTORY fs_dir AS '/home/oracle/stage_file';

Let's create a directory pointing to ASM

CREATE OR REPLACE DIRECTORY ASM_dir AS '+DATA/tst';

to copy example.txt file from ASM to a /home/oracle/stage_file directory.

SQL> exec dbms_file_transfer.COPY_FILE('asm_dir','example.txt','fs_dir','example.txt');

PL/SQL procedure successfully completed.

-Thanks

Geek DBA

2 comments to ASM: Copy files To and from – ASM