一、前言: 有的用户DBA水平不是太高,不会使用RMAN进行备份恢复,如果对现场的工程师或用户进行RMAN的培训这样将会导致额外的开销以及导致一些不必要的麻烦。如果在用户对数据恢复要求不是特别高的情况下,或者做异机恢复的时候expdp/impdp 则是一个比较不错的选择。 如果在RAC环境下,用户需要多份备份的情况下,那么我们可以通过expdp 的多路径备份来实现在ASM上备份一份,同时在本地备份一份,或者还可以在NAS共享盘上备一份,这样就可以完美的解决任意一台服务器或存储损坏都能实现数据恢复。 如下是我的测试过程,根据实际情况修改目录即可: 我这是测试环境,生产环境也类似,只需修改目录即可,(ASM路径写法: +DISKGROUP_NAME/DIRPATH)二、创建相关目录并赋予权限
[root@source DBData]# cd /
[root@source /]# cd DBBackup/
[root@source DBBackup]# ls
[root@source DBBackup]# mkdir expdp1
[root@source DBBackup]# mkdir expdp2
[root@source DBBackup]# chown -R oracle:oinstall expdp1
[root@source DBBackup]# chown -R oracle:oinstall expdp2
[root@source DBBackup]# ll
total 8
drwxr-xr-x 2 oracle oinstall 4096 Sep 5 13:33 expdp1
drwxr-xr-x 2 oracle oinstall 4096 Sep 5 13:33 expdp2
三、进入数据库做directory及赋予权限
[root@source DBBackup]# su - oracle
[oracle@source ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 5 13:34:12 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
SQL> create directory expdp1 as '/DBBackup/expdp1';
Directory created.
SQL> create directory expdp2 as '/DBBackup/expdp2';
Directory created.
SQL> grant read,write on directory expdp1 to ggs;
Grant succeeded.
SQL> grant read,write on directory expdp2 to ggs;
Grant succeeded.
SQL>
四、开始执行导出
[oracle@source expdp1]$ expdp ggs/ggs dumpfile=expdp1:ggs001.dmp,expdp2:ggs001.dmp parallel=2
Export: Release 11.2.0.4.0 - Production on Fri Sep 5 13:43:14 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
FLASHBACK automatically enabled to preserve database integrity.
Starting "GGS"."SYS_EXPORT_SCHEMA_01": ggs/******** dumpfile=expdp1:ggs001.dmp,expdp2:ggs001.dmp parallel=2
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
. . exported "GGS"."TCUSTMER" 6.335 KB 4 rows
. . exported "GGS"."TCUSTORD" 7.585 KB 2 rows
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Master table "GGS"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for GGS.SYS_EXPORT_SCHEMA_01 is:
/DBBackup/expdp1/ggs001.dmp<span style="white-space:pre"> </span>-----我们在这里可以看到生成出来了两个文件。
/DBBackup/expdp2/ggs001.dmp
Job "GGS"."SYS_EXPORT_SCHEMA_01" successfully completed at Fri Sep 5 13:43:50 2014 elapsed 0 00:00:35