Oracle expdp,impdp导库

---用oracle用户登录服务器,进入oracle命令行

sqlplus / as sysdba

 

---导出schema数据

expdp system/led@LED schemas=ZHGFDB dumpfile=ZHGFDB20160118.dmp logfile=ZHGFDB20160118.log;

 

---导入schema数据到目标用户

impdp system/system@LED dumpfile=ZHGFDB20160118.dmp REMAP_SCHEMA=ZHGFDB:ZHGFDB;

 #如果导入不成功

  1.尝试去掉@LED试试,impdp system/system dumpfile=ZHGFDB20160118.dmp

  2.查询导出数据库和导入数据库字符集,保证其一致,如不一致,将导入库的字符集改成和导出库一样

  3.检查导出库的表空间和导入库的表空间差异

 

---创建表空间
CREATE SMALLFILE TABLESPACE "CTHWDEV" DATAFILE 'D:\APP\BOSYUN\ORADATA\OFBIZ\CTHWDEV' SIZE 250M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
---创建临时表空间
CREATE SMALLFILE TEMPORARY TABLESPACE "CTHWDEVTEMP" TEMPFILE 'D:\APP\BOSYUN\ORADATA\OFBIZ\CTHWDEVTEMP' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M
---创建用户
CREATE USER "CTHWDEV" PROFILE "DEFAULT" IDENTIFIED BY "*******" DEFAULT TABLESPACE "CTHWDEV" TEMPORARY TABLESPACE "CTHWDEVTEMP" ACCOUNT UNLOCK
GRANT "CONNECT" TO "CTHWDEV"

GRANT "DBA" TO "CTHWDEV"
GRANT "RESOURCE" TO "CTHWDEV"
ALTER USER "CTHWDEV" DEFAULT ROLE ALL

REVOKE "CONNECT" FROM "CTHWDEV"
GRANT "CONNECT" TO "CTHWDEV" WITH ADMIN OPTION
ALTER USER "CTHWDEV" DEFAULT ROLE ALL
 

 

#Linux删除用户,表空间,临时表空间

 --删除用户

drop user CTHW_DEV cascade
--如果用户正在使用,先结束会话,再删除该用户
SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME='CTHW_DEV';
ALTER SYSTEM KILL SESSION '272,770';
drop user CTHW_DEV cascade
 --删除表空间
drop tablespace base_data including contents and datafiles;
--删除临时表空间

 

drop tablespace base_temp including contents and datafiles;

 

--修改system用户密码

alter user sys identified by 123456;

你可能感兴趣的:(oracle,expdp,impdp导库)