异地备份——windows 与 linux

1.pscp 命令介绍 ,只需要把此文件拷到系统目录对应的system32中,就可以查相看应的说明,如下所示
PuTTY Secure Copy client
Release 0.67
Usage: pscp [options] [user@]host:source target
       pscp [options] source [source...] [user@]host:target
       pscp [options] -ls [user@]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:dbbak21

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

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

@title 正在备份请勿关闭

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

@copy Z:data.dump d:dbbak

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

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

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

取之与网,用之与网,奉献之道,虽微必签
原文地址:https://www.cnblogs.com/dayoff/p/5869622.html