Home  >  Article  >  Database  >  Oracle简单数据迁移脚本

Oracle简单数据迁移脚本

WBOY
WBOYOriginal
2016-06-07 17:18:261053browse

将所有节点的ip地址设置为有规律的静态地址,然后修改每个节点的/etc/hosts文件,如下172.16.255.100 node0这样可以保证节点间以

#!/bin/bash
#    function:
# backup user_data
#    history:
# copyright @ 2011 zhaohaihua
export extfile=`date '+%Y%m%d%H%M'`
export bak_dir=/home/Oracle/data_bak
su - oracle -c "exp user01/user01 file=$bak_dir/user01.$extfile.dmp compress=y full=y log=n"
cd $bak_dir
tar -zcvf user01.$extfile.dmp.tar.gz user01.$extfile.dmp
scp $bak_dir/user01.$extfile.dmp.*  root@192.168.0.23:/home/oracle/bak/
rm -rf /home/oracle/data_bak/user01.*
 
 
#  00 00 * * * /bin/bash /home/bak.sh
 
ssh无密码访问
1.首先产生密钥
#cd /root/.ssh/
#ssh-keygen -t dsa
然后一直按回车,,于是便在.ssh目录下得到了
id_sda? id_sda.pub两个文件
2. #cp id_sda.pub authorized_keys
3.然后将.ssh文件夹拷贝覆盖各个节点间.ssh目录
#scp -r /root/.ssh node1
4.preacquisition
将所有节点的ip地址设置为有规律的静态地址,然后修改每个节点的/etc/hosts文件,如下
172.16.255.100 node0
这样可以保证节点间以简称node0来进行访问,而不是通过冗长的ip地址。

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn