Welcome 微信登录

首页 / 数据库 / MySQL / Oracle Data Dump 实验小结

------------------------- ------------Data dump 测试------------------------------------- 1><?XML:NAMESPACE PREFIX = O />--原来数据库SQL> select name from v$database;NAME---------OFS2
--创建测试表SQL> conn hr/ank88ank Connected.SQL> create table test (id number,name varchar(10) );Table created.SQL>  insert into test values(2,"k"); 1 row created.SQL>  insert into test values(3,"n"); 1 row created.SQL> commit;Commit complete.
--创建目录对象SQL> create directory  dumptest as "/u02/test" ;Directory created.SQL> grant read,write on directory dumptest to hr;Grant succeeded.
--导出表SQL> !            [Oracle@node2 bdump]$ expdp hr/hellojin directory=dumptest dumpfile=tab.dmp tables=test logfile=exp.log;Export: Release 10.2.0.1.0 - Production on Wednesday, 08 December, 2010 3:25:10Copyright (c) 2003, 2005, Oracle.  All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsStarting "HR"."SYS_EXPORT_TABLE_01":  hr/******** directory=dumptest dumpfile=tab.dmp tables=test logfile=exp.log Estimate in progress using BLOCKS method...Processing object type TABLE_EXPORT/TABLE/TABLE_DATATotal estimation using BLOCKS method: 64 KBProcessing object type TABLE_EXPORT/TABLE/TABLE. . exported "HR"."TEST"                                 5.226 KB       2 rowsMaster table "HR"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded******************************************************************************Dump file set for HR.SYS_EXPORT_TABLE_01 is:  /u02/test/tab.dmpJob "HR"."SYS_EXPORT_TABLE_01" successfully completed at 03:26:06[oracle@node2 bdump]$ cd /u02[oracle@node2 test]$ pwd/u02/test[oracle@node2 test]$ ls  exp.log  tab.dmp[oracle@node2 ~]$ [oracle@node2 ~]$ export ORACLE_SID=OFS2[oracle@node2 ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 8 03:37:26 2010Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options
--删除OFS2数据库,hr用户的test表的内容,SQL> conn hr/ank88ankConnected.SQL> select * from test;        ID NAME---------- ----------         2 k         3 nSQL> delete test ; 2 rows deleted.SQL> commit;Commit complete.SQL> select count(*) from test;  COUNT(*)----------         0
--做导入部分--数据来源,OFS2数据库,hr用户test-->OFS2数据库,hr用户test[oracle@node2 test]$ export ORACLE_SID=OFS2[oracle@node2 test]$ impdp hr/hellojin directory=dumptest dumpfile=tab.dmp tables=test;Import: Release 10.2.0.1.0 - Production on Wednesday, 08 December, 2010 3:41:15Copyright (c) 2003, 2005, Oracle.  All rights reserved.Conected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsMaster table "HR"."SYS_IMPORT_TABLE_01" successfully loaded/unloadedStarting "HR"."SYS_IMPORT_TABLE_01":  hr/******** directory=dumptest dumpfile=tab.dmp tables=test Processing object type TABLE_EXPORT/TABLE/TABLEORA-39151: Table "HR"."TEST" exists. All dependent metadata and data will be skipped due to table_exists_action of skipProcessing object type TABLE_EXPORT/TABLE/TABLE_DATAJob "HR"."SYS_IMPORT_TABLE_01" completed with 1 error(s) at 03:41:25--将要导入的数据库已经存在表,未设置特别导入参数,因此保错,做如下处理--删除OFS2数据库的hr用户的test
SQL> delete test ; 2 rows deleted.SQL> commit;Commit complete.SQL> SQL> select count(*) from test;  COUNT(*)----------         0
--重新执行导入操作[oracle@node2 test]$ impdp hr/hellojin directory=dumptest dumpfile=tab.dmp tables=test;Import: Release 10.2.0.1.0 - Production on Wednesday, 08 December, 2010 3:41:53Copyright (c) 2003, 2005, Oracle.  All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsMaster table "HR"."SYS_IMPORT_TABLE_01" successfully loaded/unloadedStarting "HR"."SYS_IMPORT_TABLE_01":  hr/******** directory=dumptest dumpfile=tab.dmp tables=test Processing object type TABLE_EXPORT/TABLE/TABLEProcessing object type TABLE_EXPORT/TABLE/TABLE_DATA. . imported "HR"."TEST"                                 5.226 KB       2 rowsJob "HR"."SYS_IMPORT_TABLE_01" successfully completed at 03:43:20[oracle@node2 test]$ --检查SQL> select * from test;        ID NAME---------- ----------         2 k         3 nSQL> 
--数据来源,OFS2数据库,hr.test-->OFS2数据库,scott.test--数据来源,OFS2数据库,hr.test-->OASM数据库,scott.test表,同理--不同的方案导入,加入参数REMAP_SCHEM[oracle@node2 ~]$ export ORACLE_SID=OASM[oracle@node2 ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 8 03:46:38 2010Copyright (c) 1982, 2005, Oracle.  All rights reserved.Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options
--目录对象SQL> grant read,write on directory dumptest to scott;Grant succeeded.
--用户相关操作SQL> alter user scott account unlock;User altered.SQL> alter user scott identified by hellojin;User altered.SQL> !
--执行导入[oracle@node2 ~]$ impdp scott/hellojin DIRECTORY=dumptest DUMPFILE=tab.dmp tables=hr.test REMAP_SCHEMA=hr:scott logfile=exp2.log; --不同方案需要加入remap_schema参数Import: Release 10.2.0.1.0 - Production on Wednesday, 08 December, 2010 4:17:53Copyright (c) 2003, 2005, Oracle.  All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsMaster table "SCOTT"."SYS_IMPORT_TABLE_01" successfully loaded/unloadedStarting "SCOTT"."SYS_IMPORT_TABLE_01":  scott/******** DIRECTORY=dumptest DUMPFILE=tab.dmp tables=hr.test REMAP_SCHEMA=hr:scott logfile=exp2.log Processing object type TABLE_EXPORT/TABLE/TABLEProcessing object type TABLE_EXPORT/TABLE/TABLE_DATA. . imported "SCOTT"."TEST"                              5.226 KB       2 rowsJob "SCOTT"."SYS_IMPORT_TABLE_01" successfully completed at 04:18:01[oracle@node2 ~]$ exitexit--检查SQL> conn scott/hellojinConnected.SQL> select * from test;        ID NAME---------- ----------         2 k         3 nSQL> 
  • 1
  • 2
  • 3
  • 下一页
Oracle 临时表空间问题小结关于Linux下MySQL修改root密码时遇到的问题相关资讯      oracle 
  • [INS-32052] Oracle基目录和Oracle  (07/22/2014 07:41:41)
  • Oracle 4个大对象(lobs)数据类型  (02/03/2013 12:33:05)
  • Oracle按时间段分组统计  (07/26/2012 10:36:48)
  • [Oracle] dbms_metadata.get_ddl的  (07/12/2013 07:37:30)
  • Liferay Portal 配置使用Oracle和  (07/31/2012 20:07:18)
  • Concurrent Request:Inactive   (07/20/2012 07:44:05)
本文评论 查看全部评论 (0)
表情: 姓名: 字数