您好,登录后才能下订单哦!
EXPDP如何运用PARALLEL 和FILESIZE参数提高备份效率,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
EXPDP命令的PARALLEL和FILESIZE参数联合使用在“某些情况下”可以提高备份的效率。
这种方法可以完成并行的逻辑备份。
1.环境准备
1)创建directory对象
sys@secooler> create or replace directory expdp_dir as '/expdp';
Directory created.
2)读写权限授权给sec用户
sys@secooler> grant read,write on directory expdp_dir to sec;
Grant succeeded.
3)确认EXPDP_DIR目录指向
sys@secooler> select DIRECTORY_PATH from dba_directories where DIRECTORY_NAME='EXPDP_DIR';
DIRECTORY_PATH
-------------------------------------
/expdp
2.并行备份高效的场景
备份生成的文件大概在1.3G
1)备份测试脚本如下
secooler@secDB /expdp$ vi test.sh
date
exp sec/sec file=sec_exp.dmp log=sec_exp.log
date
expdp sec/sec directory=expdp_dir dumpfile=sec_expdp_%U.dmp logfile=sec_expdp.log filesize=500m parallel=4
date
~
2)运行测试脚本
sec@secDB /expdp$ sh test.sh
Mon Mar 29 13:36:38 GMT 2010
Export: Release 10.2.0.3.0 - Production on Mon Mar 29 13:36:38 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Export done in AL32UTF8 character set and UTF8 NCHAR character set
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SEC
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SEC
About to export SEC's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SEC's tables via Conventional Path ...
. . exporting table SEC_ATTACH_VPDS_TEMP 37 rows exported
. . exporting table SEC_CHANGE_DEGDSE_TEMP 67915 rows exported
……省略……
. . exporting table T_SEC_SDE_RESES 0 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
Mon Mar 29 13:45:12 GMT 2010
Export: Release 10.2.0.3.0 - 64bit Production on Monday, 29 March, 2010 13:45:12
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": SEC/******** directory=expdp_dir dumpfile=SEC_expdp_%U.dmp logfile=SEC_expdp.log filesize=500m parallel=4
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 1.110 GB
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/SEQUENCE/SEQUENCE
. . exported "SEC"."T_SEC_DAC_LOG" 94.67 MB 1984475 rows
. . exported "SEC"."T_SEC_AGRTT_APPLY" 93.57 MB 572489 rows
……省略……
. . exported "SEC"."T_VSE_CLD_PDESOD" 19.25 KB 282 rows
. . exported "SEC"."T_VSE_SEC_RLELE_DAY_TYPE" 9.296 KB 18 rows
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/COMMENT
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/expdp/SEC_expdp_01.dmp
/expdp/SEC_expdp_02.dmp
/expdp/SEC_expdp_03.dmp
/expdp/SEC_expdp_04.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 13:45:59
Mon Mar 29 13:46:00 GMT 2010
3)列选三个时间点进行比较
Mon Mar 29 13:36:38 GMT 2010
Mon Mar 29 13:45:12 GMT 2010
Mon Mar 29 13:46:00 GMT 2010
exp逻辑备份方法共用时8分34秒,而expdp的并行备份仅仅用时48秒。expdp并行备份的效率可见一斑。
3.并行备份某些场景低效表现
此时备份文件大概在100M左右。
1)测试脚本如下
secooler@secDB /expdp$ vi test.sh
date
exp sec/sec file=sec_exp.dmp log=sec_exp.log
date
expdp sec/sec directory=expdp_dir dumpfile=sec_expdp_%U.dmp logfile=sec_expdp.log filesize=10m parallel=4
date
~
注意,此时是按照10m大小一个文件进行并行导出的。这样100M多的备份文件会生成10多个小的备份文件。因此会加重系统的负担。
2)脚本运行过程
secooler@secDB /expdp$ sh test.sh
Mon Mar 29 21:16:48 CST 2010
Export: Release 11.2.0.1.0 - Production on Mon Mar 29 21:16:48 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing option
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user SEC
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user SEC
About to export SEC's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export SEC's tables via Conventional Path ...
. . exporting table T 1155520 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
Mon Mar 29 21:17:25 CST 2010
Export: Release 11.2.0.1.0 - Production on Mon Mar 29 21:17:25 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": sec/******** directory=expdp_dir dumpfile=sec_expdp_%U.dmp logfile=sec_expdp.log filesize=10m parallel=4
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 136 MB
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
. . exported "SEC"."T" 111.7 MB 1155520 rows
Processing object type SCHEMA_EXPORT/TABLE/TABLE
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/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/expdp/sec_expdp_01.dmp
/expdp/sec_expdp_02.dmp
/expdp/sec_expdp_03.dmp
/expdp/sec_expdp_04.dmp
/expdp/sec_expdp_05.dmp
/expdp/sec_expdp_06.dmp
/expdp/sec_expdp_07.dmp
/expdp/sec_expdp_08.dmp
/expdp/sec_expdp_09.dmp
/expdp/sec_expdp_10.dmp
/expdp/sec_expdp_11.dmp
/expdp/sec_expdp_12.dmp
/expdp/sec_expdp_13.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 21:19:08
Mon Mar 29 21:19:13 CST 2010
3)整理一下三个时间点
整理一下三个时间:
Mon Mar 29 21:16:48 CST 2010
Mon Mar 29 21:17:25 CST 2010
Mon Mar 29 21:19:13 CST 2010
第一次备份使用了37秒,第二次备份使用了1分48秒,说明启用并行备份不一定会比普通备份性能高,因为需要很多的额外开销。
4.关于脚本中“%U”参数的说明
“dumpfile=sec_expdp_%U.dmp”出现的“%U”表示自动生成递增的序列号。
更多关于%U参数的使用说明请参考如下Oracle官方文档描述:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_overview.htm#sthref44
5.小结
EXPDP备份工具在数据量较大并且配置合理的情况下,可以极大地提高我们的备份效率。
在使用前做好充分的测试。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。