不同表空间的两个用户,将A用户的数据库导入B用户

 

 

CREATE TABLESPACE TEST2 DATAFILE 
  'e:\ORACLE\ORADATA\CMP_TABLESPACE\TEST2_DATA_FILE.DBF' SIZE 100M AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED
LOGGING
ONLINE
PERMANENT
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 10M
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;


CREATE USER "user2" IDENTIFIED BY "user2"
 DEFAULT TABLESPACE TEST2
 QUOTA UNLIMITED ON TEST2;

GRANT "CONNECT" TO "user2" WITH ADMIN OPTION;
GRANT "DBA" TO "user2" WITH ADMIN OPTION;
GRANT "RESOURCE" TO "user2" WITH ADMIN OPTION;
ALTER USER "user2" DEFAULT ROLE "CONNECT", "DBA", "RESOURCE";
IMPDP USERID='user2/user2@test as sysdba' remap_schema=user1:user2 remap_tablespace=test1:test2 directory=DATA_PUMP_DIR dumpfile=test.DMP logfile=test.log

 其中

remap_schema=user1:user2 --user1为原schema(即原用户名)  user2为新schema(即新用户名)

你可能感兴趣的:(数据库)