imp命令導入數據:
imp username/password@SID file=XXX.dmp fromuser=XXX touser=XXX tables=(XXX,XXX) [ignore=y]
其中,
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\這個路徑必須先建好
