我的编程空间,编程开发者的网络收藏夹
学习永远不晚

【EXPDP】使用EXPDP备份数据时预估大小——ESTIMATE参数

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

【EXPDP】使用EXPDP备份数据时预估大小——ESTIMATE参数

使用EXPDP在完成数据导出时,可以使用ESTIMATE参数评估待导出数据库对象的大小,简单演示一下,供参考。

1.查看有关ESTIMATE参数的帮助信息
1)查看命令行帮助信息
ora10g@secDB /expdp$ expdp help=y
……
ESTIMATE  Calculate job estimates where the valid keywords are:
          (BLOCKS) and STATISTICS.
……

2)Oracle官方文档中关于ESTIMATE参数的描述
参考链接:http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_export.htm#sthref105
引用内容如下:

ESTIMATE

Default: BLOCKS

Purpose

Specifies the method that Export will use to estimate how much disk space each table in the export job will consume (in bytes). The estimate is printed in the log file and displayed on the client's standard output device. The estimate is for table row data only; it does not include metadata.

Syntax and Description

ESTIMATE={BLOCKS | STATISTICS}

  • BLOCKS - The estimate is calculated by multiplying the number of database blocks used by the source objects, times the appropriate block sizes.

  • STATISTICS - The estimate is calculated using statistics for each table. For this method to be as accurate as possible, all tables should have been analyzed recently.

Restrictions

If the Data Pump export job involves compressed tables, the default size estimation given for the compressed table is inaccurate when ESTIMATE=BLOCKS is used. This is because the size estimate does not reflect that the data was stored in a compressed form. To get a more accurate size estimate for compressed tables, use ESTIMATE=STATISTICS.

Example

The following example shows a use of the ESTIMATE parameter in which the estimate is calculated using statistics for the employees table:

> expdp hr/hr TABLES=employees ESTIMATE=STATISTICS DIRECTORY=dpump_dir1
DUMPFILE=estimate_stat.dmp

2.显式指定ESTIMATE参数为BLOCKS
ora10g@secDB /expdp$ expdp sec/sec directory=expdp_dir dumpfile=sec.dmp ESTIMATE=BLOCKS

Export: Release 10.2.0.3.0 - 64bit Production on Saturday, 10 April, 2010 6:23:26

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.dmp ESTIMATE=BLOCKS
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
.  estimated "SEC"."TEST_SEC"                                2 MB
.  estimated "SEC"."TEST_SEC1"                               2 MB
.  estimated "SEC"."TEST_SEC2"                               2 MB
Total estimation using BLOCKS method: 6 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
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
. . exported "SEC"."TEST_SEC"                            1.018 MB   11716 rows
. . exported "SEC"."TEST_SEC1"                           1.018 MB   11717 rows
. . exported "SEC"."TEST_SEC2"                           1.018 MB   11718 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
  /expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 06:23:37


此时预估单位是按照数据库块进行统计的,相比最终导出的大小来说不是很准确,不过有一定的参考意义。

3.指定ESTIMATE参数为STATISTICS
ora10g@secDB /expdp$ expdp sec/sec directory=expdp_dir dumpfile=sec.dmp ESTIMATE=STATISTICS

Export: Release 10.2.0.3.0 - 64bit Production on Saturday, 10 April, 2010 6:22:02

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.dmp ESTIMATE=STATISTICS
Estimate in progress using STATISTICS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
.  estimated "SEC"."TEST_SEC"                            9.558 KB
.  estimated "SEC"."TEST_SEC1"                           9.558 KB
.  estimated "SEC"."TEST_SEC2"                           9.558 KB
Total estimation using STATISTICS method: 28.67 KB
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/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
. . exported "SEC"."TEST_SEC"                            1.018 MB   11716 rows
. . exported "SEC"."TEST_SEC1"                           1.018 MB   11717 rows
. . exported "SEC"."TEST_SEC2"                           1.018 MB   11718 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
  /expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 06:22:14


此时的统计结果比较离谱,是何原因?
真实的原因是在使用ESTIMATE=STATISTICS参数预估时,数据来源是表的分析数据,如果表未曾分析过或分析数据不准确就会导致此处的数据失真。

4.在数据库中对sec用户做一下分析,然后再完成一次数据导出
1)对sec用户进行分析
sys@ora10g> exec dbms_stats.gather_schema_stats(OWNNAME=>'SEC',ESTIMATE_PERCENT=>10,DEGREE=>4,cascade=>true);

PL/SQL procedure successfully completed.

2)再次导出sec用户下的数据
ora10g@secDB /expdp$ expdp sec/sec directory=expdp_dir dumpfile=sec.dmp ESTIMATE=STATISTICS

Export: Release 10.2.0.3.0 - 64bit Production on Saturday, 10 April, 2010 6:30:20

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.dmp ESTIMATE=STATISTICS
Estimate in progress using STATISTICS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
.  estimated "SEC"."TEST_SEC2"                           993.6 KB
.  estimated "SEC"."TEST_SEC1"                           993.6 KB
.  estimated "SEC"."TEST_SEC"                            993.5 KB
Total estimation using STATISTICS method: 2.910 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
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
. . exported "SEC"."TEST_SEC2"                           1.018 MB   11718 rows
. . exported "SEC"."TEST_SEC1"                           1.018 MB   11717 rows
. . exported "SEC"."TEST_SEC"                            1.018 MB   11716 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
  /expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 06:30:35


OK,此时的预估数据与最后的生成数据大小较为接近。

5.不指定ESTIMATE参数
ora10g@secDB /expdp$ expdp sec/sec directory=expdp_dir dumpfile=sec.dmp

Export: Release 10.2.0.3.0 - 64bit Production on Saturday, 10 April, 2010 7:26:54

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.dmp
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 6 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
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
. . exported "SEC"."TEST_SEC"                            1.018 MB   11716 rows
. . exported "SEC"."TEST_SEC1"                           1.018 MB   11717 rows
. . exported "SEC"."TEST_SEC2"                           1.018 MB   11718 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
  /expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 07:27:05


在不指定ESTIMATE参数时,默认会使用BLOCKS进行估算,不过,具体的数据库对象进估算被省略,仅有以下信息提示:
Total estimation using BLOCKS method: 6 MB

6.小结
虽然ESTIMATE参数提供给我们一种预估大小的功能,不过在使用EXPDP进行数据备份时,还是尽量不要使用,毕竟所有额外的操作都是有代价的。

Good luck.

secooler
10.04.10

-- The End --

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

【EXPDP】使用EXPDP备份数据时预估大小——ESTIMATE参数

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

【EXPDP】使用EXPDP备份数据时预估大小——ESTIMATE参数

使用EXPDP在完成数据导出时,可以使用ESTIMATE参数评估待导出数据库对象的大小,简单演示一下,供参考。1.查看有关ESTIMATE参数的帮助信息1)查看命令行帮助信息ora10g@secDB /expdp$ expdp help=y
2023-06-06

oracle使用expdp定时备份数据库

在测试环境中我们需要每天备份oracle中的数据,以便错误的操作、测试或者覆盖其中有价值的数据,暂时不考虑生产环境的全量增量备份策略,本文只是简单的oracle数据库使用expdp命令设置定时任务备份数据。 目录
oracle使用expdp定时备份数据库
2019-06-30

Oracle 11g数据库使用expdp每周进行数据备份并上传到备份服务器

目录1.看看数据库情况1.1先看了下表空间情况,生产环境表空间大概90G,用了才一半不到2.数据库备份2.1登陆数据库2.2创建逻辑目录2.3给数据库用户文件操作权限#dbuser为数据库用户名,更具实际情况更改2.3创建物理目录1.3备份
2022-06-28

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录