linux自动拷贝文件,并恢复ORACLE数据库
2014-07-09 19:49
218 查看
为了在脚本里使用scp命令不输入密码,需要在各主机间建立安全信息关系 1创建证书 [oracle@eastestdb2 ~]$ ssh-keygen -b 1024 -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_rsa): Created directory '/home/oracle/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_rsa. Your public key has been saved in /home/oracle/.ssh/id_rsa.pub. The key fingerprint is: 46:fa:16:6e:6f:1b:9a:eb:e9:c0:25:e5:dc:52:83:47 oracle@eastestdb2 The key's randomart image is: +--[ RSA 1024]----+ | E | | o | | + + | | * + . | | o S . | | . * o | | o = . | | + =.. | | oBoo. | +-----------------+
2、将公钥证书复制到Server 的.ssh目录中
[oracle@eastestdb2 .ssh]$ scp -p id_rsa.pub
oracle@192.168.100.36:/home/oracle/.ssh/authorized_keys
3、修改原有计划任务脚本,直接复制文件到备份服务器
[oracle@NEWEASDB ~]$ cat eascron_expdp_EAS_DAY.sh
expdp system/kingdee schemas=ORUSER directory=orabak dumpfile=zy_$(date "+%Y%m%d%H%M").dmp logfile=zy_$(date "+%Y%m%d%H%M").log
find /orabak -mtime +5 -name '*.dmp' | xargs rm
find /orabak -mtime +5 -name '*.log' | xargs rm
scp /orabak/zy_$(date "+%Y%m%d")0400.dmp
oracle@192.168.100.36:/orabak
#[oracle@NEWEASDB orabak]$ scp /orabak/zy_$(date "+%Y%m%d")0400.dmp
oracle@192.168.100.36:/orabak
4、在备份服务器上创建计划任务
crontab -e 创建任务
0 6 * * * source /home/oracle/.bash_profile; /bin/sh /home/oracle/eascron_impdp_EAS_DAY.sh
5、创建计划任务执行的脚本文件,导入数据到备份服务器
vi /home/oracle/eascron_impdp_EAS_DAY.sh
impdp system/redhat schemas=ORUSER dumpfile=zy_$(date "+%Y%m%d")0400.dmp logfile=zy_$(date "+%Y%m%d")0400.log directory=orabak table_exists_action=replace
find /orabak -mtime +0 -name '*.*' | xargs rm -rf
相关文章推荐
- 如何恢复 Linux 上删除的文件,第 3 部分:自动恢复工具 e2undel 和特殊情况的恢复
- Linux通过Shell对文件自动进行远程拷贝备份
- Linux自动远程拷贝文件脚本
- Linux自动压缩备份目录文件与恢复
- Linux系统裁减之,制作一个极度精简的Linux-2-用脚本实现自动拷贝命令和依赖库文件
- OSX向Linux自动拷贝文件
- 在Linux下远程使用scp拷贝文件
- 教你自动恢复MySQL数据库的日志文件(binlog)
- 如何恢复误删除的Linux文件
- 如何恢复 Linux 上删除的文件,第 2 部分(特殊文件的恢复)
- 如何恢复 Linux 上删除的文件,第 1 部分
- 解决方案看起来是受源代码管理,但无法找到它的帮定信息.保存解决方案的源代码管理设置的MSSCCPRJ.SCC文件或其他项可能己被删除.由于无法自动恢复这些缺少的信息,缺少帮定的项目将被视为不受源代码管理.
- 从自动备份中恢复spfile和控制文件
- linux 删除文件恢复
- 傻瓜式Linux之四:拷贝文件 推荐
- 如何恢复 Linux 上删除的文件,第 1 部分
- 对某网站LINUX FSCK后丢失大量文件的数据恢复过程摘录
- SAN,LINUX EXT3 LUN,存储ORACLE数据库,FSCK后出错,数据恢复手记
- 如何恢复误删除的Linux文件
- 成功数据恢复一例LINUX EXT3 下误删除ORACLE数据库