三:同一个数据库中不同用户之间迁移数据
环境接着上面,这里把HTZ的数据库迁移到同一个数据库的SCOTT用户下面
1,删除SCOTT用户
[Oracle11g@rhel4 admin]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Mar 26 20:30:28 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> drop user scott cascade;
User dropped.
SQL> Drop public database link "orcl11g";
Database link dropped.
SQL>
SQL> create public database link "orcl11g"
2 connect to htz
3 identified by "oracle"
4 using 'ORCL11G';
Database link created.
SQL> grant exp_full_database TO htz;
Grant succeeded.
2,导数据
[oracle11g@rhel4 admin]$ impdp system/oracle directory=dump logfile=scott_impdp.log remap_schema=htz:scott network_link=orcl11g
Import: Release 11.2.0.3.0 - Production on Tue Mar 26 20:34:25 2013
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, OLAP, Data Mining and Real Application Testing options
Starting "SYSTEM"."SYS_IMPORT_SCHEMA_01": system/******** directory=dump logfile=scott_impdp.log remap_schema=htz:scott network_link=orcl11g
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 2.115 GB
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
. . imported "SCOTT"."TEST" 19096576 rows
. . imported "SCOTT"."DEPT" 4 rows
. . imported "SCOTT"."EMP" 14 rows
. . imported "SCOTT"."SALGRADE" 5 rows
. . imported "SCOTT"."BONUS" 0 rows
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
ORA-39082: Object type ALTER_PROCEDURE:"SCOTT"."BBW_INSERT" created with compilation warnings
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/CONSTRAINT/REF_CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" completed with 1 error(s) at 20:35:49
三种常用的方式已经测试成功。
更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12
