ORACLE导出表导入表数据语法

exp/imp工具:
带参数:rows=y   —— 带数据导出导入;rows=n    —— 不带数据的导出导入,只移植结构。
例如:
 只导出3张表的结构: 
       exp user/pasword@dbServerName owner=user tables=(table1,table2,table3) rows=n file=c:\1.dmp
 连带数据导出: 
       exp user/pasword@dbServerName owner=user tables=(table1,table2,table3) rows=y file=c:\2.dmp
 
       imp user2/pasword@dbServerName2 fromuser=user touser=user2 file=c:\1.dmp 
 
或者 
        imp user2/pasword@dbServerName2 fromuser=user touser=user2 file=c:\2.dmp 
导出一个用户下的所有表数据
常用的命令
       Exp user/password@instance file=file.dmp rows=y log=log_name
其中username/password为导出用户的用户名和密码
      Instance为导出的实例名

导出一个用户下的表结构为sql文件
使用命令好像导出的都是dmp文件
可以使用plsql软件在tools--?export user object
如果不要到处table space,不要勾include storage
选择导出的路径文件名,export可以直接导出了

导入一个用户下的所有表数据

Imp username/password file=file.dmp fromuser=user1 touser=user2 rows=y
其中username/password为导入到 数据库的用户名和密码/
Fromuser为备份数据库时的用户
Touser为导入数据库的用户,一般和username同
 

一、数据导出(exp.exe

1、将指定用户的数据全部导出:

将数据库orclscott用户的数据全部对象导出

exp scott/accp@orcl file=d:\daochu.dmp

 

2、将指定用户的指定表的数据导出:

将数据库orcl中的scott用户的表empdept导出

exp scott/accp@orcl file= d:\daochu.dmptables=(emp,dept)

 

3、将指定用户的指定表空间的数据导出:

将数据库orcl中的表空间testSpace导出

       exp scott/accp@orcl file=d:\daochu.dmptablespaces=(testSpace)




二、数据导入(imp.exe

1、把指定的数据文件全部导入到指定的用户中: full=y意思是值全部数据

d:\daochu.dmp 中的数据导入 orcl数据库的system用户中,

       imp scott/accp@orcl file=d:\daochu.dmp full=y

 

2、把指定的数据文件全部导入到指定的用户中:

如果导入时,数据表已经存在,将报错,对该表不会进行导入;加上ignore=y即可,表示忽略现有表,在现有表上追加记录。

       imp scott/accp@orcl file=d:\daochu.dmp  full=y  ignore=y



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值