3 Replies Latest reply: Oct 15, 2013 1:34 PM by Levi Pereira RSS

    How to copy the ASM files on host filesystem.

    dbarohit

      Hello All,

       

      There is a question come up in my mind that can we perform the copy/delete/move of ASM files to the host filesystem while the ASM instance is down.

       

      For instance... To copy the file ASM file through AMCMD utility when the ASM instance is running.

      ASMCMD> cp spfilenode.ora /u01

      copying +DATA/NODE/spfilenode.ora -> /u01/spfilenode.ora

       

      Now my question is, Can I copy/delete/move that file on OS filesystems when the ASM instance is down.

       

      regards,

      rohit

        • 1. Re: How to copy the ASM files on host filesystem.
          Svetoslav Gyurov

          Hi,

           

          Your files are within the ASM diskgroup. ASM diskgroup is mounted once the ASM instance starts so no, you can't copy files when the ASM instance is down.

           

          Sve

          • 2. Re: How to copy the ASM files on host filesystem.
            Anar Godjaev

            Hi,

             

            1- Copy from ASM to FileSystem using cp command.

            2- Copy from ASM to FileSystem using DBMS_FILE_TRANSFER.

             

            1) In the first method, when I copy one file, I took more than 1 minute, so the following script would take me more than 1 days (I guess so).

             

            #!/bin/ksh

            #

            # This script copies files from FRA on ASM to local disk

            #

            ORACLE_SID=+ASM2

            ASMLS=/vasgatedb/app/vsgbkp/asm_ls.txt ##{ASM files list}

            BKP=+data/vsgdb/vsgbkp/`date +%Y_%m_%d` ##{source location of files}

            LOCALBACKUPDIR=/vasgatedb/app/vsgbkp  ##{destination filesystem}

            LOG=/vasgatedb/app/vsgbkp/asm_log.txt ##{log file}

            #

            # Get the list of files

            #

            $ORACLE_HOME/bin/asmcmd > $ASMLS <<EOF

            ls $BKP

            exit

            EOF

            #

            # Clean the list by removing "ASMCMD>"

            #

            sed -i 's/ASMCMD> //g' $ASMLS

            ##cat $ASMLS

            echo `date` > $LOG

            #

            # Copy files one by one

            #

            for FILENAME in `cat $ASMLS`

            do

            if [[ ! -f $LOCALBACKUPDIR/${FILENAME} ]]

            then

            $ORACLE_HOME/bin/asmcmd >> $LOG <<EOF

            cp $BKP/$FILENAME $LOCALBACKUPDIR

            EOF

            fi

            done

            echo `date` >> $LOG

             

            2) The second method, DBMS_FILE_TRANSFER took me less than 1 second to copy one file completely.

             

            sys@VSGDB> set timing on

            sys@VSGDB> exec dbms_file_transfer.COPY_FILE('asm_dir','level_0_vsgdb_9998_813844797.bkp','fs_dir','level_0_vsgdb_9998_813844797.bkp');

            PL/SQL procedure successfully completed.

             

             

            Elapsed: 00:00:00.38

            • 3. Re: How to copy the ASM files on host filesystem.
              Levi Pereira

              Now my question is, Can I copy/delete/move that file on OS filesystems when the ASM instance is down.


              Is the same as try copy a file from OS filesystem with Host Machine Shutdown.