linux 异地拷贝文件,异地备份——windows 与 linux(示例代码)

1.pscp 命令介绍 ,只需要把此文件拷到系统目录对应的system32中,就可以查相看应的说明,如下所示

PuTTY Secure Copy client

Release 0.67

Usage: pscp [options] [[email protected]]host:source target

pscp [options] source [source...] [[email protected]]host:target

pscp [options] -ls [[email protected]]host:filespec

Options:

-V        print version information and exit

-pgpfp    print PGP key fingerprints and exit

-p        preserve file attributes

-q        quiet, don‘t show statistics

-r        copy directories recursively

-v        show verbose messages

-load sessname  Load settings from saved session

-P port   connect to specified port

-l user   connect with specified username

-pw passw login with specified password

-1 -2     force use of particular SSH protocol version

-4 -6     force use of IPv4 or IPv6

-C        enable compression

-i key    private key file for user authentication

-noagent  disable use of Pageant

-agent    enable use of Pageant

-hostkey aa:bb:cc:...

manually specify a host key (may be repeated)

-batch    disable all interactive prompts

-unsafe   allow server-side wildcards (DANGEROUS)

-sftp     force use of SFTP protocol

-scp      force use of SCP protocol

-sshlog file

-sshrawlog file

log protocol details to a file

2.事例

---做了四个cmd文件,三个放到c盘目录下,只需要双击一下task.cmd,由于服务本身有备份作业,

--为了备份最新的一份数据,单独做的备份作业,备份文件名相同

---task.cmd

schtasks /delete /tn "autosave1" /F

schtasks /delete /tn "autosave2" /F

schtasks /delete /tn "autosave3" /F

schtasks /create /sc MONTHLY /d 13 /st 01:05:00 /tn "autosave1" /tr c:\auto_save11.cmd

schtasks /create /sc MONTHLY /d 13 /st 02:05:00 /tn "autosave2" /tr c:\auto_save12.cmd

schtasks /create /sc MONTHLY /d 13 /st 02:50:00 /tn "autosave3" /tr c:\auto_save13.cmd

--auto_save11.cmd 认证服务器的数据,由于是双机,只能备两份数据,拷linux中已备份数据到应急服务器 --现用,可以改成漂移地址的,由于现用,也就没有再改

pscp  -v -q -batch -l root -pw pwdroot 192.6.1.21:/home/oralcedata/backup.tgz e:\dbbak\21

pscp  -v -q -batch -l root -pw pwdroot 192.6.1.22:/home/oracle/data/backup.tgz e:\dbbak\22

--auto_save12.cmd 拷贝另一服务器映射的数据到应急服务器

@title 正在备份请勿关闭

@echo. 文件比较大,时间比较长,请谨慎操作

@copy Z:\data.dump d:\dbbak

--auto_save13.cmd 拷贝应急服务器的备份到移动硬盘上,应急服务器,移动硬盘两份数据加服务器本身数据库共三份数据

@title 正在备份请勿关闭 @echo. 文件比较大,时间比较长,请谨慎操作

@xcopy /Y /S e:\dbbak\* F:\最新备份

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值