很多情况下,本地空间不够用,还想备份怎么办,有人说在生产系统挂载一块盘,其实大可不必,expdp+dblink帮你搞定!
一、测试环境描述
服务器端:Oracle 11g rac
客户端:Oracle 11g 单实例
二、操作步骤
1. 客户端配置
$ cd $ORACLE_HOME/network/admin
$ vi tnsnames.ora
ysdb1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.31)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ysdb)
)
)
2. 客户端创建dblink(sys用户创建)
CREATE PUBLIC DATABASE LINK "ysdb1"
CONNECT TO system
IDENTIFIED BY "oracle"
USING ‘ysdb1‘;
3. 客户端验证
SQL> select * from dual@ysdb1;
D
-
X
4. 创建目录
$sudo mkdir /backup
$sudo chown -R oracle:oinstall /backup
set lines 120
col owner for a15
col directory_name for a30
col DIRECTORY_PATH for a60
select * from dba_directories;
create directory dump_dir as ‘/backup‘;
grant read,write on directory dump_dir to system;
5. 备份
vi expdp.sh
nohup expdp system/oracle directory=dump_dir dumpfile=roidba_%U.dmp logfile=roidba_expdp.log network_link=‘ysdb1‘ schemas=roidba parallel=4 cluster=n COMPRESSION=all reuse_dumpfiles=y encryption=data_only encryption_password=roidba_passwd filesize=30G &
sh expdp.sh
小结:Oracle 数据库的数据泵备份还是相当的好用,参数比较多,但是每个参数都值得我们去仔细的去测试,对于数据库备份加密,从安全的角度来说,我们应该这么做,但是实际环境下,大家确很少用。生产环境700多G得数据量还在跑着备份脚本,我只好写点东西,不能浪费时间不是。
本文出自 “roidba” 博客,请务必保留此出处http://roidba.blog.51cto.com/12318731/1952471
原文地址:http://roidba.blog.51cto.com/12318731/1952471