ASMCMD - cp

yewushang發表於2014-05-16

ASMCMD> help cp
        cp


        Enables you to copy files between Oracle ASM disk
                 groups on local instances to and from remote instances.


        cp [--service ] [--port
                [connect_str:]src_file [connect_str:]tgt_file


        The options for the cp command are described below.


        --service       - name of the ASM instance name if not default +ASM.
        --port          - Listener port number, default is 1521.
        connect_str     - The connection string for use with a remote instance 
                          copy.
        src_file        - Name of the source file to copy.
        tgt_file        - A user alias for the created target file name or 
                          alias directory name.


        cp cannot copy files between two remote instances. The local Oracle 
        ASM instance must be either the source or the target of the operation.


        You can use the cp command to:
                Copy files from a disk group to the operating system
                Copy files from a disk group to a disk group
                Copy files from the an OS File system to a disk group


        Some file types cannot be the source or destination of the cp command.
        These file types include OCR, OCR backup and SPFILE file types.


        To back up, copy, or move an ASM SPFILE, use the spbackup, spcopy,
        or spmove commands.


        connect_str is not required for a local instance copy, which is the 
        default case. In the case of a remote instance copy, you must specify 
        the connect string and Oracle ASM prompts for a password in a 
        non-echoing prompt. The connect_str is in the form of:
                user@host.SID
        user, host, and SID are required in the connect_str parameter. The 
        default port number is 1521.


        src_file must be either the fully qualified file name, the 
        system-generated name, or the Oracle ASM alias.


        The cp command performs a binary copy without any data transformation.


        The following are examples of the cp command. 
        The first example shows a copy of a file in the data disk group to a 
        file on the operating system. 
        The second example shows a copy of a file on the operating system to 
        the DATA disk group.
        The third and fourth example shows how to copy files from ASM to 
        remote server (OS file).
        The fifth example shows how to copy a remote OS File to DATA diskgroup.
        The sixth example shows how to copy a remote OS File to DATA diskgroup
        when listener port is not default. 
          sys           is the user name on the remote server
          server        is the remote server name
          asminstance   ASM Instance name
          /scratch/file OS file.


        If password is not provided in the command line, it will be asked.


ASMCMD [+] > cp +data/orcl/datafile/EXAMPLE.265.691577295 /mybackups/example.bak 
copying +data/orcl/datafile/EXAMPLE.265.691577295 -> /mybackups/example.bak
ASMCMD [+] > cp /mybackups/examples.bak +data/orcl/datafile/myexamples.bak 
copying /mybackups/examples.bak -> +data/orcl/datafile/myexamples.bak


ASMCMD [+] > cp +data/orcl/datafile/EXAMPLE.265.691577295 sys@server.asminstance:/scratch/file
ASMCMD [+] > cp +data/orcl/datafile/EXAMPLE.265.691577295 sys/passwd@server.asminstance:/scratch/file
ASMCMD [+] > cp sys@server.asminstance:/scratch/file +data/orcl/datafile/file
ASMCMD [+] > cp --port 2500 sys@server.SID:/scratch/file 
                                    +data/orcl/datafile/file
        copying /scratch/file -> +data/orcl/datafile/file

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29477587/viewspace-1162426/,如需轉載,請註明出處,否則將追究法律責任。

相關文章