dmp文件导入的方法

时间:2024-02-15 15:26:16
1,使用oracle的imp命令导入*.dmp文件

首先要明确知道,使用oracle的imp命令进行导入,要在一个空的数据库下,才是最好的,否则,数据表存在的话,就要先删除数据表中的数据
步骤1:禁用约束 alter table table disable constraint FK_ForeignKey ;
使用sqlplus命令登录到oracle数据库,举例如下:
比如你要用scott这个用户进行导入数据,首先要保证这个用户有dba权限,因此要用oracle的system用户登录数据库,对scott用户授权
sqlplus system/123456
grant dba to scott
退出sqlplus 注:exit命令

sqlplus scott/tiger
删除表数据 truncate table table_name
退出sqlplus

使用这个导入命令将备份导入
imp scott/tiger@testdb full=y file=d:\scott.dmp ignore=y log=d:\log.txt
testdb :数据库名字 log=d:\log.txt为报错的时候日志记录 scott/tiger:登录用户名和密码
导出成功后,再次登录oracle
sqlplus scott/tiger
执行启用约束
alter table table enable constraint FK_ForeignKey ;