[20161002]impdp导入空表.txt

简介: [20161002]impdp导入空表.txt --业务需求要求建立新的测试库,由于磁盘空间有限,要求几个大表导入空表,11g支持段延迟提交,即使表init很大也不会出现空间问题.
[20161002]impdp导入空表.txt

--业务需求要求建立新的测试库,由于磁盘空间有限,要求几个大表导入空表,11g支持段延迟提交,即使表init很大也不会出现空间问题.
--全表的数据已经通过expdp导出.自己测试一下如何实现:

1.环境:

SCOTT@test01p> @ ver1
PORT_STRING          VERSION    BANNER                                                                       CON_ID
-------------------- ---------- ---------------------------------------------------------------------------- ------
IBMPC/WIN_NT64-9.1.0 12.1.0.1.0 Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production      0

create table tx as select rownum id,'test' name  from dual connect by level<=1e4;
create table ty as select rownum id,'TEST' name  from dual connect by level<=1e4;

D:\>expdp scott/btbtms@test01p directory=TMP_EXPDP  dumpfile=t_all.dp logfile=t_all.log tables=(tx,ty)
expdp scott/btbtms@test01p directory=TMP_EXPDP  dumpfile=t_all.dp logfile=t_all.log tables=(tx,ty)
Export: Release 12.1.0.1.0 - Production on Sun Oct 2 21:41:44 2016
Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Starting "SCOTT"."SYS_EXPORT_TABLE_01":  scott/a**@test01p directory=TMP_EXPDP dumpfile=t_all.dp logfile=t_all.log tables=(tx,ty)
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 384 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
. . exported "SCOTT"."TX"                                132.2 KB   10000 rows
. . exported "SCOTT"."TY"                                132.2 KB   10000 rows
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
  D:\TMP\EXPDP\T_ALL.DP
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at Sun Oct 2 21:42:31 2016 elapsed 0 00:00:45

2.导入:
--建立导入参数文件impdo.txt
directory=TMP_EXPDP
dumpfile=t_all.dp
logfile=t_all_imp.log
QUERY=SCOTT.TX:"where 1=0"
#QUERY=SCOTT.TY:"where 1=0"

--两个表没有索引,我直接改名看看,这样导入不会报错。

SCOTT@test01p> alter table tx rename to tx1;
Table altered.

SCOTT@test01p> alter table ty rename to ty1;
Table altered.

impdp scott/btbtms@test01p PARFILE=impdo.txt

D:\tools\rlwrap>impdp scott/btbtms@test01p PARFILE=impdo.txt
impdp scott/btbtms@test01p PARFILE=impdo.txt
Import: Release 12.1.0.1.0 - Production on Sun Oct 2 21:51:28 2016
Copyright (c) 1982, 2013, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Master table "SCOTT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SCOTT"."SYS_IMPORT_FULL_01":  scott/a*@test01p PARFILE=impdo.txt
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."TX"                                132.2 KB       0 out of 10000 rows
. . imported "SCOTT"."TY"                                132.2 KB   10000 rows
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type TABLE_EXPORT/TABLE/STATISTICS/MARKER
Job "SCOTT"."SYS_IMPORT_FULL_01" successfully completed at Sun Oct 2 21:52:03 2016 elapsed 0 00:00:33

SCOTT@test01p> select count(*) from tx;
  COUNT(*)
----------
         0

SCOTT@test01p> select count(*) from ty;
  COUNT(*)
----------
     10000

--可以发现表tx没有导入,提示0 out of 10000 rows,不过我的测试段还是分配的。

SCOTT@test01p> column PARTITION_NAME noprint
SCOTT@test01p> select * from dba_extents where segment_name in ('TX','TY');
OWNER  SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NAME  EXTENT_ID    FILE_ID   BLOCK_ID      BYTES     BLOCKS RELATIVE_FNO
------ ------------ ------------ --------------- ---------- ---------- ---------- ---------- ---------- ------------
SCOTT  TX           TABLE        USERS                    0          9      19744      65536          8            9
SCOTT  TY           TABLE        USERS                    0          9      19752      65536          8            9
SCOTT  TY           TABLE        USERS                    1          9      19760      65536          8            9
SCOTT  TY           TABLE        USERS                    2          9      19768      65536          8            9


3.另外11g impdp支持TRANSFORM参数,参考

http://blog.itpub.net/267265/viewspace-1846944/

Usage: TRANSFORM = transform_name:value[:object_type]
These are the applicable transform_names

    SEGMENT_ATTRIBUTES: by default value is y which will copy the objects as it is in the export dump with all segment
    attributes. If you specify the value as n the import job will omit the segment_attributes in the dump file and it
    will use the tablespace/user default values.

    STORAGE: by default the value for this parameter is y which will include all storage clauses during the import job.
    If you specify the parameter value as n then it will omit the storage clause in the dump file and it will follow the
    default values in the tablespace.

    PCTSPACE: it is the percent multiplier for the extent allocations and size of the datafiles during the import.

    OID: object id (OID) mainly used for the TYPE objects. Each and every type is identified by OID which will be
    unique. If you create a type without specifying the OID the RDBMS itself will create and assign unique OID to the
    new TYPE object. See below examples for more details.


目录
相关文章
|
12月前
|
消息中间件 存储 运维
如果让你消息队列,该如何设计?说一下你的思路
在分布式系统中,消息队列是不可或缺的组件,用于系统解耦、流量削峰和异步处理。设计一个高效的消息队列需考虑以下关键点:实现内存队列以支持快速入队和出队操作;内存数据持久化确保高可靠性;支持多种消息传递模式如点对点、广播和发布订阅;引入ACK机制保证消息正确处理;实现事件机制确保事务一致性;采用可靠的网络通信协议;以及通过集群部署实现高可用性和横向扩展能力。
228 0
|
存储 安全 BI
【PACS源码】认识PACS的架构和工作流程
【PACS源码】认识PACS的架构和工作流程
824 0
|
存储 编解码 API
Vb-视频总结
视频内容主要是针对Vb进行一个详细的介绍和告知大家如何去操作中调用代码以及如何正确的运行和书写,每个视频都是有详细的介绍和讲解,里面的主要内容: 常用系统函数、窗体事件、窗体之间的相互传递、以及什么是全局对象、定义的相关内容、分类、API函数的使用等等,下面就列举几项。
198 0
|
vr&ar 图形学 Android开发
使用Unity构建增强现实应用程序:从理论到实践
大家好!在今天的博客文章中,我将与大家分享如何使用Unity构建增强现实(AR)应用程序。AR是一项令人兴奋的技术,它将虚拟元素与现实世界相结合,为用户创造出令人难以置信的交互体验。Unity作为一种强大的游戏开发引擎,也可以用于构建AR应用程序,并且提供了丰富的工具和功能来简化开发过程。 在本文中,我们将从理论到实践逐步介绍AR应用程序的构建过程。让我们开始吧!
328 0
|
机器学习/深度学习 移动开发 算法
区间DP入门
区间DP入门
202 0
区间DP入门
lodash替换字符串
lodash替换字符串
308 0
写出continue和break的区别
写出continue和break的区别
180 0
|
存储 Python
Python笔记:将字典存储为csv格式文件
Python笔记:将字典存储为csv格式文件
2027 0
|
Java 容器
java8新特性(三)_Optional类的使用
说实话,我第一次知道这个东西是从阿里规约中,因为公司前一段时间一直在搞代码审核,我的代码写的就感觉很烂,就像规范下。让别人看起来没那么烂。于是就开始看阿里规约,在看到NPE处理的时候,上面提到用Optional类进行处理。
1178 0