导入到另一个数据库
$ impdp system/Oracle DIRECTORY=dmpdir DUMPFILE=scott.dmp
Import: Release 10.2.0.1.0 - 64bit Production on Friday, 31 March, 2006 12:00:59Copyright (c) 2003, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Master table "SYSTEM"."SYS_IMPORT_FULL_02" successfully loaded/unloadedStarting "SYSTEM"."SYS_IMPORT_FULL_02": system/******** DIRECTORY=dmpdir DUMPFILE=scott.dmp
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMAProcessing object type SCHEMA_EXPORT/TYPE/TYPE_SPECProcessing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."BIGEMP" 145.2 MB 3670016 rows. . imported "SCOTT"."DEPT" 5.656 KB 4 rows. . imported "SCOTT"."EMP" 7.820 KB 14 rows. . imported "SCOTT"."ORD_CHARGE_TAB" 5.296 KB 2 rows. . imported "SCOTT"."SALGRADE" 5.585 KB 5 rows. . imported "SCOTT"."BONUS" 0 KB 0 rows. . imported "SCOTT"."NEWOBJECT1_T" 0 KB 0 rows. . imported "SCOTT"."T1" 0 KB 0 rowsProcessing 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/PACKAGE/PACKAGE_SPECProcessing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPECProcessing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODYProcessing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Processing object type SCHEMA_EXPORT/JOBJob "SYSTEM"."SYS_IMPORT_FULL_02" successfully completed at 12:02:22备注:
- expdp 和 impdp 命令都是操作系统下执行;
- 而创建导出目录,并为其授权,都是 SQL PLUS 下执行。
- 以上例子对于刚开始的你已经足够。更多信息,请参看 Oracle 工具指南。输入下面命令可以列出该命令的所有参数。
$ expdp help=yes$ impdp help=yes
网络导入
通过网络模式导入,不需要任何中间的 dump 文件。数据,通过一个数据库链路(database link)导出,直接导入到目标数据库。例如:
SQL> create user new_scott identified by tiger;
User created.SQL> grant connect, resource to new_scott;
Grant succeeded.SQL> grant read, write on directory dmpdir to new_scott;
Grant succeeded.SQL> grant create database link to new_scott;
Grant succeeded.
SQL> conn new_Scott/tigerConnected.
SQL> create database link old_scott connect to scott identified by tiger using 'orcl.oracle.com';
Database link created.
$ impdp new_scott/tiger DIRECTORY=dmpdir NETWORK_LINK=old_scott remap_schema=scott:new_scott
所有的工作在目标操作系统上完成。唯一一个到源操作系统的引用是通过数据库链路(database link)。
