Hi!请登陆

oracle导入导出

2020-10-27 79 10/27

数据导出:

1 将数据库SampleDB完全导出,用户名system 密码manager 导出到E:/SampleDB.dmp中

exp system/manager@TestDB file=E:/sampleDB.dmp full=y

2 将数据库中system用户与sys用户的表导出

exp system/manager@TestDB file=E:/sampleDB.dmp  owner=(system,sys)

3 将数据库中的表 TableA,TableB 导出

exp system/manager@TestDB  file=E:/sampleDB.dmp  tables=(TableA,TableB)

4 将数据库中的表tableA中的字段filed1 值为 "王五" 的数据导出

exp system/manager@TestDB  file=E:/sampleDB.dmp  tables=(tableA)  query=' where filed1='王五'

如果想对dmp文件进行压缩,可以在上面命令后面 加上 compress=y 来实现。

数据的导入:

1 将备份数据库文件中的数据导入指定的数据库SampleDB 中,如果 SampleDB 已存在该表,则不再导入;

imp system/manager@TEST  file=E:/sampleDB.dmp  full=y  ignore=y

2 将d:/daochu.dmp中的表table1 导入

imp system/manager@TEST  file=E:/sampleDB.dmp  tables=(table1)

3 导入一个完整数据库

imp system/manager file=bible_db log=dible_db full=y ignore=y

4 导入一个或一组指定用户所属的全部表、索引和其他对象

imp system/manager file=seapark log=seapark fromuser=seapark imp
system/manager file=seapark log=seapark fromuser=(seapark,amy,amyc,harold)

5 将一个用户所属的数据导入另一个用户

imp system/manager file=tank log=tank fromuser=seapark touser=seapark_copy imp system/manager file=tank log=tank fromuser=(seapark,amy) touser=(seapark1, amy1)

6 导入一个表

imp system/manager file=tank log=tank fromuser=seapark TABLES=(a,b)

7 从多个文件导入

imp system/manager file=(paycheck_1,paycheck_2,paycheck_3,paycheck_4)
log=paycheck, filesize=1G full=y

8 使用参数文件

imp system/manager parfile=bible_tables.par bible_tables.par

9 增量导入

imp system./manager inctype= RECTORE FULL=Y  FILE=A

不少情况下要先将表彻底删除,然后导入。

expdp导入导出:

1 导出模式

expdp system/system1@orcl directory=dmp_dir dumpfile=fulldb.dmp full=y

2 导入模式

impdp system/system1@orcl directory=dmp_dir dumpfile=fulldb.dmp full=y

3 查询dmp_dir路径

select * from dba_directories
Tag:

相关推荐