Oracle Data Dump 实验小结(一)

2014-11-24 17:55:49 · 作者: · 浏览: 2

------------------------- ------------Data dump 测试-------------------------------------


1>


--原来数据库


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> !


Export: Release 10.2.0.1.0 - Production on Wednesday, 08 December, 2010 3:25:10


Copyright (c) 2003, 2005, Oracle. All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production


With the Partitioning, OLAP and Data Mining options


Starting "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_DATA


Total estimation using BLOCKS method: 64 KB


Processing object type TABLE_EXPORT/TABLE/TABLE


. . exported "HR"."TEST" 5.226 KB 2 rows


Master table "HR"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded


******************************************************************************


Dump file set for HR.SYS_EXPORT_TABLE_01 is:


/u02/test/tab.dmp


Job "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 sysdba


SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 8 03:37:26 2010


Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:


Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production


With the Partitioning, OLAP and Data Mining options





--删除OFS2数据库hr用户的test表的内容,


SQL> conn hr/ank88ank


Connected.


SQL> select * from test;


ID NAME


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


2 k


3 n


SQL> 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:15


Copyright (c) 2003, 2005, Oracle. All rights reserved.


Conected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production


With the Partitioning, OLAP and Data Mining options


Master table "HR"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded


Starting "HR"."SYS_IMPORT_TABLE_01": hr/******** directory=dumptest dumpfile=tab.dmp tables=test


Processing object type TABLE_EXPORT/TABLE/TABLE


ORA-39151: Table "HR"."TEST" exists. All dependent metadata and da