oracle导出导入dmp

 1.切换到oracle用户,su - oracle
 
2.输入导出命令,接着是下面的操作(下面已导出民办教育数据库为例):exp mbedu/mbedu@orcl 
[oracle@qtone3 ~]$ exp mbedu/mbedu@orcl 
Export: Release 10.2.0.4.0 - Production on Mon Nov 18 08:33:19 2013
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

EXP-00056: ORACLE error 1017 encountered
ORA-01017: invalid username/password; logon denied
Username: mbedu
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
Enter array fetch buffer size: 4096 >
Export file: ./expdat.dmp > /data/oradata/mbedu95_20131118.dmp
(1)E(ntire database), (2)U(sers), or (3)T(ables): (2)U >
Export grants (yes/no): yes > no
Export table data (yes/no): yes >
Compress extents (yes/no): yes >
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
Note: grants on tables/views/sequences/roles will not be exported
About to export specified users ...

User to be exported: (RETURN to quit) >  
接着导出

3.导出了dmp后,可用scp命令直接复制文件到需要导入的oracle服务器中。 
scp -P [ssh端口] root@目标ip:[源目标路径] [目标目录]
然后输入密码

现在到了导入dmp到目标数据库
4.使用sysdba账号在目标数据库创建表空间:
登录:[oracle@localhost ~]$ sqlplus


SQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 19 08:36:17 2013


Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Enter user-name: system/oraclesys as sysdba


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
然后操作:

 DROP USER mbedu CASCADE;  --非空用户
DROP TABLESPACE mbedu INCLUDING CONTENTS AND DATAFILES; --非空表空间及数据文件
-- 创建ddpg_test表空间及用户
create tablespace mbedu datafile 'mbedu.DBF' size 16M autoextend on next 16M maxsize 4096M;
 
create user mbedu
  identified by mbedu
  default tablespace mbedu
  temporary tablespace TEMP
  profile DEFAULT
  quota unlimited on mbedu;
在此为了简单,可直接赋予dba权限:
grant dba to mbedu;

5.导入dmp到新建表空间:
C:\Users\wusz>imp ddpg_test/ddpg_test@DM   //注:这个导入命令,类似导出,username/password@oracle sid
Import: Release 10.2.0.3.0 - Production on 星期五 3月 30 09:33:28 2012
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
导入文件: EXPDAT.DMP> d:\ddpg_20120330.dmp
输入插入缓冲区大小 (最小为 8192) 30720>
经由常规路径由 EXPORT:V10.02.01 创建的导出文件
警告: 这些对象由 DDPG 导出, 而不是当前用户
已经完成 ZHS16GBK 字符集和 AL16UTF16 NCHAR 字符集中的导入
只列出导入文件的内容 (yes/no): no >
由于对象已存在, 忽略创建错误 (yes/no): no > yes
导入权限 (yes/no): yes > no
导入表数据 (yes/no): yes >
导入整个导出文件 (yes/no): no >
用户名: ddpg    //注:这个是导出时的用户名

输入表 (T) 或分区 (T: P) 名称。空列表表示用户的所有表
输入表 (T) 或分区 (T: P) 的名称或 。如果完成:

. 正在将 DDPG 的对象导入到 DDPG_TEST
. . 正在导入表                    "DDPG_AFFIX"导入了           0 行
. . 正在导入表                  "DDPG_APPROVE"导入了        1786 行
. . 正在导入表                   "DDPG_ASSESS"导入了         840 行
. . 正在导入表               "DDPG_ATTACHMENT"导入了         589 行
. . 正在导入表                     "DDPG_DICT"导入了         333 行
. . 正在导入表                 "DDPG_FUNCTION"导入了         123 行
. . 正在导入表                      "DDPG_LOG"导入了        6287 行
. . 正在导入表                   "DDPG_MODULE"导入了          46 行
. . 正在导入表                     "DDPG_NORM"导入了         515 行
. . 正在导入表                 "DDPG_QAATTACH"导入了        1289 行
. . 正在导入表                  "DDPG_QUALITY"导入了        1318 行
. . 正在导入表                   "DDPG_REPORT"导入了           0 行
. . 正在导入表                     "DDPG_ROLE"导入了           4 行
. . 正在导入表            "DDPG_ROLE_FUNCTION"导入了         312 行
. . 正在导入表                   "DDPG_SCHOOL"导入了          13 行
. . 正在导入表                 "DDPG_TEMPLATE"导入了          18 行
. . 正在导入表                     "DDPG_UNIT"导入了          25 行
. . 正在导入表                     "DDPG_USER"导入了          43 行
即将启用约束条件...
成功终止导入, 没有出现警告。

------------------------------------------------------------------------------------------
 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值