首先須要知道dmp文件的表空間和用戶名。(也能夠根據出錯提示獲得:好比用戶名爲fitness,表空間爲fitness_ts )session
建立Oracle相關信息。spa
create user fitness IDENTIFIED by 12345678 --建立用戶code
create tablespace fitness_ts datafile 'd:\data.dbf'SIZE 500M; --須要根據實際的數據大小,或能夠設置表空間自增加it
alter user fitness DEFAULT tablespace fitness_ts; --將表空間指定給用戶io
grant create session,create table,create sequence,create procedure,create trigger, unlimited tablespace to fitness;table
說明:test
grant create session to test;file
--賦予create session的權限權限
grant create table,create view,create trigger, create sequence,create procedure to test;--分配建立表,視圖,觸發器,序列,過程 權限im
grant unlimited tablespace to test; --受權使用表空間
3.導入dmp數據到用戶(full爲導入整個文件,ignore爲忽略建立錯誤)
imp userid=fitness/12345678@orcl file='/home/smjq_lysj2/lysj.dmp' full=y ignore=y
注意:中間可能會報這個用戶沒有導入權限。須要添加如下語句
GRANT IMP_FULL_DATABASE to fitness;