第一步:創建備份文件存儲目錄
create or replace directory back_file as 'D:\app\yangxf\back_or_memery_file';
create or replace directory 目錄名 as 'D:\app\yangxf\back_or_memery_file';
第二步:創建表空間
create tablespace BASE_DATA datafile 'D:\app\yangxf\oradata\base_tablespace\BASE.dbf' size 100M autoextend on next 50m;
create tablespace 表空間名(與備份文件表空間一致) datafile 'D:\app\yangxf\oradata\base_tablespace\備份文件名.dbf' size 100M autoextend on next 50m;
第三步:創建備份文件用戶,指定表空間
create user BASE identified by BASE default tablespace BASE_DATA;
create user 用戶名 identified by 密碼 default tablespace 表空間名;
第四步:授權用戶讀寫備份文件目錄
grant read, write on directory back_file to BASE;
grant read, write on directory 存儲目錄名 to 用戶名;
第五步:授權用戶連接、資源、登錄、dba權限
grant connect,resource,dba to BASE;
第六步:執行導入語句
impdp system/root@orcl directory=back_file dumpfile=BASE.DMP full=y;
impdp 用戶名/密碼@實例名 directory=目錄名 dumpfile=到導入的文件名.DMP full=y;
備注:
刪除用戶下所有對象
drop user JCSJ cascade;
drop user 用戶名 cascade;
刪除表空間
drop tablespace JCSJ_DATA including contents and datafiles;
drop tablespace 表空間名 including contents and datafiles;
超級管理員登錄
sqlplus sys/root@orcl as sysdba;
sqlplus 用戶名/密碼@實例名 as sysdba;