您的位置:首页 > 数据库 > Oracle

oracle 导入导出

2015-11-19 09:48 459 查看
1、exp 和 expdp 都可以导出,imp 和 impdp 都可以导入
2、EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用。EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用,不能在客户端使用。
3、IMP只适用于EXP导出的文件,不适用于EXPDP导出文件;IMPDP只适用于EXPDP导出的文件,而不适用于EXP导出文件。
exp导出 (命令 口令 文件  [模式])
-- 默认导出当前用户
exp ins/ins@orcl_108 file=e:\temp108.dmp
-- 用户模式
exp ins/ins@orcl_108 file=e:\temp108.dmp owner=ins
-- 表模式
exp ins/ins@orcl_108 file=e:\temp108.dmp tables=(sys_user,sys_role)
-- 完全模式(整个数据库)
exp ins/ins@orcl_108 file=e:\temp108.dmp full=y
常用一些参数说明:
query = \"where filed1='王五' \" -- 带条件
log = e:\test.log -- 指定日志文件
exp help=y
imp导入 (命令 口令 文件 模式)
-- 表模式导入
imp system/manager@TEST file=d:\daochu.dmp tables=(table1)
-- 用户模式
imp system/manager@TEST  file=d:\daochu.dmp fromuser=ins touser=ins 用户模式
-- 完全模式
imp system/manager@TEST file=d:\daochu.dmp full=y
常用一些参数说明:
ignore=y -- 忽略已存在错误 继续导入数据
imp help=y 查看帮助
expdp 导出 (命令 口令 目录 文件)-- 默认导出当前用户expdp scott/tiger directory=dump_dir dumpfile=tab.dmp-- 导出指定表expdp scott/tiger directory=dump_dir dumpfile=tab.dmp tables=dept,emp-- 导出用户expdp scott/tiger directory=dump_dir dumpfile=schema.dmp schemas=system,scott-- 导出表空间expdp system/manager directory=dump_dir dumpfile=tablespace.dmp tablespaces=user01,user02-- 导出数据库expdp system/manager directory=dump_dir dumpfile=full.dmp full=Y常用一些参数说明:version=10 -- 高版本到低版本时,可以指定版本导出impdp 导入 (命令 口令 目录 文件)-- 默认导入当前用户impdp scott/tiger DIRECTORY=dpdata1 DUMPFILE=expdp.dmp-- 导到指定用户下impdp scott/tiger DIRECTORY=dpdata1 DUMPFILE=expdp.dmp SCHEMAS=scott;-- 改变表的ownerimpdp system/manager DIRECTORY=dpdata1 DUMPFILE=expdp.dmp TABLES=scott.dept REMAP_SCHEMA=scott:system;-- 导入表空间impdp system/manager DIRECTORY=dpdata1 DUMPFILE=tablespace.dmp TABLESPACES=example;-- 导入数据库impdb system/manager DIRECTORY=dump_dir DUMPFILE=full.dmp FULL=y;常用一些参数说明:TABBLE_EXISTS_ACTION = {SKIP | APPEND | TRUNCATE | FRPLACE }REMAP_SCHEMA = source_schema:target_schema -- 导入到不同用户REMAP_TABLESPACE = source_tablespace:target:tablespace -- 导入到不同表空间

目录创建

一、创建逻辑目录,该命令不会在操作系统创建真正的目录,最好以system等管理员创建。create directory dpdata1 as 'd:\test\dump';二、查看管理理员目录(同时查看操作系统是否存在,因为Oracle并不关心该目录是否存在,如果不存在,则出错)select * from dba_directories;三、给scott用户赋予在指定目录的操作权限,最好以system等管理员赋予。grant read,write on directory dpdata1 to scott;---------------------------------------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: