一 impdp 导入
--删除用户若用户已经存在(可以使用Oracle自带的sqlplus进行连接)
sql> drop user USER_NAME cascade
sql> /
sql> drop tablespace USER_TABLESPACE including contents and datafiles
--创建表空间下载
sql> CREATE TABLESPACE USER_TABLESPACE DATAFILE 'USER_tablespace.DBF' SIZE 200M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED PERMANENT DEFAULT STORAGE(INITIAL 64K MINEXTENTS 1 MAXEXTENTS 2147483645) MINIMUM EXTENT 64K LOGGING ONLINE
--创建用户
sql> CREATE USER USER_NAME IDENTIFIED BY user_password DEFAULT TABLESPACE USER_TABLESPACE TEMPORARY TABLESPACE TEMP PROFILE DEFAULT
--创建用户目录
sql> CREATE DIRECTORY directory_name as 'filePath'
--示例 my_dir as 'D:/db_dir'
--为用户授权
sql> GRANT CONNECT TO USER_NAME WITH ADMIN OPTION
sql> GRANT DBA TO USER_NAME WITH ADMIN OPTION
sql> GRANT UNLIMITED TABLESPACE TO USER_NAME WITH ADMIN OPTION
sql> GRANT read,write ON DIRECTORY directory_name TO USER_NAME
--执行导入(退出sqlplus在CMD执行导入语句)
impdp USER_NAME/user_password@SID_NAME directory=directory_name dumpfile=USER_NAME.DMP schemas=USER_NAME logfile=USER_NAME.log;
pause;
二 expdp 导出expdp USER_NAME/user_password@SID_NAME directory=directory_name dumpfile=USER_NAME.DMP schemas=USER_NAME logfile=USER_NAME.log;
pause;