Oracle11g导入*.dmp数据文件

时间:2023-03-09 22:45:58
Oracle11g导入*.dmp数据文件
imp命令导入数据:
imp username/password@SID file=XXX.dmp fromuser=XXX touser=XXX tables=(XXX,XXX)  [ignore=y]
其中,
1.SID为数据库名;
2.fromuser指对方数据库用户名;(创建xxx.dmp数据库文件的用户);fromuser若为多个表空间的话,使用()将其括起来:fromuser=(a,b);
3.touser指你的数据库的用户名;(将xxx.dmp数据库文件导入的用户);touser参数仿fromuser参数;
4.若只导入一部分表,使用tables参数,用()括起要导入的表;如果想全部导入,不需要指定tables参数;
5.ignore=y :上面可能有点问题,因为有的表已经存在,然后它就报错,对该表就不进行导入,在后面加上 ignore=y 就可以导入。
在导入过程中可能遇到错误:
376错误:
ORA-00376: file string cannot be read at this time
文件字符串本次操作不可读
Cause: attempting to read from a file that is not readable. Most likely the file is offline.
(1)原因:表空间是离线
解决方法:检查表空间状态,将其online:
SQL>alter tablespace 表空间名 online; (2)原因:表空间对应的文件不存在
解决方法:在提示错误的表空间对应的文件下,建立对应的表空间(对应的表空间大小根据自己导入的文件的大小进行确定)
SQL>create tablespace ceimsexchange

  2 datafile 'F:\asmfile\asm_file.dbf'
  3 size 100M AutoExtend On Next 10M Maxsize 2048M
  4 extent management local
  5 segment space management auto;
注意F:\asmfile\这个路径必须先建好