Oracle 11g数据泵详解(二)

2015-07-16 12:07:39 · 作者: · 浏览: 11
时,如下:


[oracle@rac1 ~]$ impdp system/manager123 network_link=dblink_to_myself remap_tablespace=users:users remap_schema=liuwenhe:liuhe schemas=liuwenhe;


如果liuhe这用户存在,那么该操作完成之后,liuhe这个用户权限,密码什么的不会变化。


如果liuhe这个用户不存在,那么该操作完成之后,就会创建一个liuhe的用户,并且没有任何权限,值得注意的是密码和liuwenhe的密码相同。


七:当导入schemas的时候,会把属于这个用户的所有对象,包括SEQUENCE,FUNCTION,PROCEDURE,主键,索引,都一并过去。


[oracle@rac1 ~]$ impdp system/manager123? network_link=dblink_to_myself remap_tablespace=users:users remap_schema=liuwenhe:liuhe? tables=liuwenhe.liuwenhe table_exists_action=replace;?


liuwenhe.liuwenhe这个表的主键和索引,也会过去。并且名字和liuwenhe.liuwenhe的对应名字一样。


八:该选项用于指定当表已经存在时导入作业要执行的操作,默认为SKIP
TABBLE_EXISTS_ACTION={SKIP | APPEND |TRUNCATE | FRPLACE }


当设置该选项为SKIP时,导入作业会跳过已存在表处理下一个对象;当设置为APPEND时,会追加数据,为TRUNCATE时,导入作业会截断表,然后为其追加新数据;当设置为REPLACE时,导入作业会删除已存在表,重建表并追加数据,注意,TRUNCATE选项不适用与簇表和NETWORK_LINK选项
?
九:注意:普通用户做全库导出,需要有这个权限:
SQL> grant exp_full_database to scott;


十:REMAP_TABLE参数?


?将源表数据映射到不同的目标表中
?eg:impdp orcldev/oracle DIRECTORY=backup_path dumpfile=oracldev.dmp remap_table=TAB_TEST:TEST_TB
? 数据导入到TEST_TB表中,但是该表的索引等信息并没有相应的创建,需要手工初始化
?
十一:REMAP_DATAFILE参数


  语法:REMAP_DATAFILE=source_datafile:target_datafile
   Oracle_Online:
  Remapping datafiles is useful when you move databases between platforms that have different file naming conventions. The source_datafile and target_datafile names should be exactly as you want them to appear in the SQL statements where they are referenced. Oracle recommends that you enclose datafile names in quotation marks to eliminate ambiguity on platforms for which a colon is a valid file specification character


十三:下面看一个试验 ,验证的是只导出数据后,可以恢复,就算是表结构已经变化了,他也能把相应的列恢复,


1)SQL> desc liuwenhe.liuwenhe;


?Name? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Null?? ? Type


?----------------------------------------- -------- ----------------------------


?X? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NOT NULL NUMBER(38)


?Y? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NUMBER(38)


2)SQL> select * from liuwenhe.liuwenhe;


? ? ? ? X? ? ? ? ? Y


---------- ----------


? ? ? ? 1? ? ? ? ? 3


? ? ? ? 3? ? ? ? ? 3


? ? ? ? 2? ? ? ? ? 4


? ? ? ? 4? ? ? ? ? 5


? ? ? ? 5? ? ? ? ? 8


? ? ? ? 6? ? ? ? ? 9


6 rows selected.


3)[oracle@rac1 expdp]$ expdp system/manager123 directory=bak dumpfile=hhhf.dmp tables=liuwenhe.liuwenhe;


?Export: Release 11.2.0.3.0 - Production on Mon Jul 6 11:52:56 2015


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


?Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
?With the Partitioning, Real Application Clusters, OLAP, Data Mining
?and Real Application Testing options
?Starting "SYSTEM"."SYS_EXPORT_TABLE_03":? system/******** directory=bak dumpfile=hhhf.dmp tables=liuwenhe.liuwenhe
?Estimate in progress using BLOCKS method...
?Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
?Total estimation using BLOCKS method: 64 KB
?Processing object type TABLE_EXPORT/TABLE/TABLE
?Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
?Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
?Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
?Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
?. . exported "LIUWENHE"."LIUWENHE"? ? ? ? ? ? ? ? ? ? ? 5.492 KB? ? ? 6 rows
?Master table "SYSTEM"."SYS_EXPORT_TABLE_03" successfully loaded/unloaded
?*************************************************************