常用数据库导入导出命令

创建表空间及用户、授权

create tablespace DMS datafile 'D:\db\DMS.BDF' size 1024M;

create user C##DMS identified by oracle default tablespace DMS;

GRANT CONNECT,RESOURCE TO C##DMS;

GRANT CREATE VIEW TO C##DMS;

ALTER USER C##DMS QUOTA UNLIMITED ON DMS;

grant create table to C##DMS;

create or replace directory dir1 as 'D:\';

grant read,write on directory dir1 to IMS_JNPC_REAL;

 

以数据泵的方式导入

impdp C##IMS_JNPC_TEST/oracle@localhost/orcl directory=dir1 dumpfile=ims_jnpc_uat.dmp remap_schema=C##IMS_JNPC_UAT:C##IMS_JNPC_TEST remap_tablespace=IMS_JNPC_UAT:IMS_JNPC_TEST table_exists_action = replace

impdp IMS_JNPC_UAT/oracle@localhost/orcl directory=dir1 dumpfile=IMS_JNPC_REAL_0506.dmp remap_schema=IMS_JNPC_REAL:IMS_JNPC_UAT remap_tablespace=IMS_JNPC_REAL:IMS_JNPC_UAT table_exists_action = replace

 

以数据泵的方式导出  (如导出的数据库和导入的版本不一致,则需要带上版本号--导入数据库的版本,如 version=XX.XX)

expdp IMS_JNPC_REAL/oracle@localhost/orcl schemas=IMS_JNPC_REAL dumpfile=IMS_JNPC_REAL_0506_OK.dmp DIRECTORY=dir1 version=11.2.0.1.0

expdp IMS_JNPC_UAT/oracle@localhost/orcl schemas=IMS_JNPC_UAT dumpfile=IMS_JNPC_UAT_0507.dmp DIRECTORY=dir1 version=11.2.0.1.0


impdp C##XKT/oracle@localhost/orcl directory=dir1 dumpfile=IMS_JNPC_UAT_0507.DMP remap_tablespace=IMS_JNPC_UAT:IMS_JNPC remap_schema=IMS_JNPC_UAT:IMS_JNPC table_exists_action = replace
 

你可能感兴趣的:(oracle)