DBAs need to move files from one host to the other
in Linux environment. In this article, I would explain how to use scp (secure
copy) command to copy files or directories from one host to the other.
Currently I am on 192.168.20.20 (MYDBSERVER is the
hostname in this case) and I have a file /u01/oracle.tar on second host
192.168.20.30 that I want to transfer to /u01 on my current host,
192.168.20.20. On current host I am connected as user “salman” and “oracle” is the user on remote host 192.168.20.30 that I will use to connect to remote host for this copy operation.
192.168.20.20. On current host I am connected as user “salman” and “oracle” is the user on remote host 192.168.20.30 that I will use to connect to remote host for this copy operation.
[salman@MYDBSERVER
/] cd /u01
[salman@MYDBSERVER u01]$ scp oracle@192.168.20.30:/u01/oracle.tar
/u01/
The
authenticity of host '192.168.20.30 (192.168.20.30)' can't be established.
RSA
key fingerprint is ce:dd:13:2d:ac:96:a1:cd:52:9e:f3:b4:03:ea:2d:25.
Are
you sure you want to continue connecting (yes/no)? yes
Warning:
Permanently added '192.168.20.30 ‘(RSA) to the list of k//nown hosts.
oracle@192.168.20.30's
password:
oracle.tar
100% 3268MB 26.4MB/s 02:04
|
To
copy whole directory, use –r option. In the following example, I will copy wole
directory /u01/backup from 192.168.20.30 to the current directory (/u01) on
current host 192.168.20.20. to specify current directory on current server, use
“.”.
[salman@MYDBSERVER u01]$ scp -r oracle@192.168.20.30:/u01/backup .
|
No comments:
Post a Comment