文章详情

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

请输入下面的图形验证码

提交验证

短信预约提醒成功

expdp如何导出表空间

2024-04-02 19:55

关注

这篇文章给大家分享的是有关expdp如何导出表空间的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。



下面我们来测试一下:

创建一个表空间,此处省略。  我创建几张表,并且创建一个分区表
,语句如下:  分区使用了两个表空间,TEST 和USERS


点击(此处)折叠或打开

  1. CREATE TABLE scott.obj_part

  2. PARTITION BY RANGE (created)

  3. (

  4.  PARTITION p20101231 VALUES LESS THAN (to_date('20101231','yyyymmdd')) tablespace test,

  5.  PARTITION p20111231 VALUES LESS THAN (to_date('20111231','yyyymmdd')) tablespace test,

  6.  PARTITION p20121231 VALUES LESS THAN (to_date('20121231','yyyymmdd')) tablespace users,

  7.  PARTITION p20131231 VALUES LESS THAN (to_date('20131231','yyyymmdd')) tablespace users,

  8.  PARTITION p20141231 VALUES LESS THAN (to_date('20141231','yyyymmdd')) tablespace users,

  9.  PARTITION p20151231 VALUES LESS THAN (to_date('20151231','yyyymmdd')) tablespace users,

  10.  PARTITION p20161231 VALUES LESS THAN (to_date('20161231','yyyymmdd')) tablespace users,

  11.  PARTITION p20171231 VALUES LESS THAN (to_date('20171231','yyyymmdd')) tablespace users

  12. )

  13. as select * from dba_objects where 1=0


插入数据:

点击(此处)折叠或打开

  1. SQL> insert into scott.obj_part select * from dba_objects;


  2. 86383 rows created.


  3. SQL> commit;


  4. Commit complete.


  5. SQL> conn test/test

  6. Connected.

  7. SQL> insert into scott.obj_part select OWNER,OBJECT_NAME,SUBOBJECT_NAME,OBJECT_ID,DATA_OBJECT_ID,OBJECT_TYPE,to_date('2017-5-12','yyyy-mm-dd'),LAST_DDL_TIME,TIMESTAMP,STATUS,TEMPORARY,GENERATED,SECONDARY,NAMESPACE,EDITION_NAME from dba_objects;


  8. 86383 rows created.


  9. SQL> commit;


  10. Commit complete.


  11. SQL> create index scott.objpart_id on scott.obj_part(object_id) tablespace test;


  12. Index created.


  13. SQL> commit;


  14. Commit complete.


执行导出

点击(此处)折叠或打开

  1. [oracle@mystandby dump]$ expdp \' / as sysdba\' directory=sh_dmp dumpfile=exp_tablespace01.dmp logfile=exptablesp01.log tablespaces=test


  2. Export: Release 11.2.0.4.0 - Production on Thu Aug 10 20:40:29 2017


  3. Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.


  4. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

  5. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  6. Starting "SYS"."SYS_EXPORT_TABLESPACE_01": "/******** AS SYSDBA" directory=sh_dmp dumpfile=exp_tablespace01.dmp logfile=exptablesp01.log tablespaces=test

  7. Estimate in progress using BLOCKS method...

  8. Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

  9. Total estimation using BLOCKS method: 36.12 MB

  10. Processing object type TABLE_EXPORT/TABLE/TABLE

  11. Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX

  12. Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

  13. Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS

  14. Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

  15. Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS

  16. . . exported "SCOTT"."OBJ_PART":"P20131231" 8.358 MB   86200 rows

  17. . . exported "SCOTT"."OBJ_PART":"P20171231" 8.394 MB   86566 rows   --注意此表表空间为USERS表空间

  18. . . exported "TEST"."TEST" 8.435 MB   87003 rows

  19. . . exported "TEST"."T_C" 3.035 MB   84748 rows

  20. . . exported "TEST"."T_ADV" 873.0 KB  100000 rows

  21. . . exported "TEST"."T_P" 83.70 KB    2870 rows

  22. . . exported "SCOTT"."OBJ_PART":"P20101231" 0 KB       0 rows

  23. . . exported "SCOTT"."OBJ_PART":"P20111231" 0 KB       0 rows

  24. . . exported "SCOTT"."OBJ_PART":"P20121231" 0 KB       0 rows

  25. . . exported "SCOTT"."OBJ_PART":"P20141231" 0 KB       0 rows

  26. . . exported "SCOTT"."OBJ_PART":"P20151231" 0 KB       0 rows

  27. . . exported "SCOTT"."OBJ_PART":"P20161231" 0 KB       0 rows

  28. Master table "SYS"."SYS_EXPORT_TABLESPACE_01" successfully loaded/unloaded

  29. ******************************************************************************

  30. Dump file set for SYS.SYS_EXPORT_TABLESPACE_01 is:

  31.   /backup/dump/exp_tablespace01.dmp

  32. Job "SYS"."SYS_EXPORT_TABLESPACE_01" successfully completed at Thu Aug 10 20:40:42 2017 elapsed 0 00:00:12


也就是使用expdp导出表空间时,并不是只导出该表空间所有数据,也会将相关联的相关对象数据导出。

下面贴出官方解释:

点击(此处)折叠或打开

  1. TABLESPACES

  2. Default: There is no default


  3. Purpose


  4. Specifies a list of tablespace names to be exported in tablespace mode.


  5. Syntax and Description


  6. TABLESPACES=tablespace_name [, ...]

  7. In tablespace mode, only the tables contained in a specified set of tablespaces are unloaded. If a table is unloaded, then its dependent objects are also unloaded. Both object metadata and data are unloaded. If any part of a table resides in the specified set, then that table and all of its dependent objects are exported. Privileged users get all tables. Unprivileged users get only the tables in their own schemas



---大体意思
在表空间模式中, 只导出指定表空间中所包含的表。如果导出了表, 则它的从属对象也将被导出。对象元数据和数据都将被导出。如果表的任何部分保存在在指定的表空间中, 则导出该表及其所有从属对象。特权用户获取所有表,没有特权的用户只能在自己的权限内获取表。


  1. Filtering can restrict what is exported using this mode (see "Filtering During Export Operations").


  2. Restrictions


  3. The length of the tablespace name list specified for the TABLESPACES parameter is limited to a maximum of 4 MB, unless you are using the NETWORK_LINK to an Oracle Database release 10.2.0.3 or earlier or to a read-only database. In such cases, the limit is 4 KB.


  4. Example


  5. The following is an example of using the TABLESPACES parameter. The example assumes that tablespaces tbs_4, tbs_5, and tbs_6 already exist.


  6. > expdp hr DIRECTORY=dpump_dir1 DUMPFILE=tbs.dmp

  7. TABLESPACES=tbs_4, tbs_5, tbs_6

  8. This results in a tablespace export in which tables (and their dependent objects) from the specified tablespaces (tbs_4, tbs_5, and tbs_6) will be unloaded.

感谢各位的阅读!关于“expdp如何导出表空间”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

阅读原文内容投诉

免责声明:

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

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

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-数据库
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯